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