1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ 6 #define CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ 7 #pragma once 8 9 #include <vector> 10 11 #include "googleurl/src/gurl.h" 12 13 class PrefService; 14 class Profile; 15 16 // StartupPref specifies what should happen at startup for a specified profile. 17 // StartupPref is stored in the preferences for a particular profile. 18 struct SessionStartupPref { 19 enum Type { 20 // Indicates the user doesn't want to restore a previous session. 21 DEFAULT, 22 23 // Indicates the user wants to restore the last session. 24 LAST, 25 26 // Indicates the user wants to restore a specific set of URLs. The URLs 27 // are contained in urls. 28 URLS 29 }; 30 31 static void RegisterUserPrefs(PrefService* prefs); 32 33 // What should happen on startup for the specified profile. 34 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); 35 static void SetStartupPref(PrefService* prefs, 36 const SessionStartupPref& pref); 37 static SessionStartupPref GetStartupPref(Profile* profile); 38 static SessionStartupPref GetStartupPref(PrefService* prefs); 39 40 // Whether the startup type and URLs are managed via policy. 41 static bool TypeIsManaged(PrefService* prefs); 42 static bool URLsAreManaged(PrefService* prefs); 43 44 SessionStartupPref(); 45 46 explicit SessionStartupPref(Type type); 47 48 ~SessionStartupPref(); 49 50 // What to do on startup. 51 Type type; 52 53 // The URLs to restore. Only used if type == URLS. 54 std::vector<GURL> urls; 55 }; 56 57 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ 58