OLD | NEW |
1 // Copyright (c) 2012 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 wants to open the New Tab page. | 20 // Indicates the user doesn't want to restore a previous session. |
21 DEFAULT, | 21 DEFAULT, |
22 | 22 |
23 // Deprecated. See comment in session_startup_pref.cc. | |
24 HOMEPAGE, | |
25 | |
26 // Indicates the user wants to restore the last session. | 23 // Indicates the user wants to restore the last session. |
27 LAST, | 24 LAST, |
28 | 25 |
29 // Indicates the user wants to restore a specific set of URLs. The URLs | 26 // Indicates the user wants to restore a specific set of URLs. The URLs |
30 // are contained in urls. | 27 // are contained in urls. |
31 URLS | 28 URLS |
32 }; | 29 }; |
33 | 30 |
34 static void RegisterUserPrefs(PrefService* prefs); | 31 static void RegisterUserPrefs(PrefService* prefs); |
35 | 32 |
36 // What should happen on startup for the specified profile. | 33 // What should happen on startup for the specified profile. |
37 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); | 34 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); |
38 static void SetStartupPref(PrefService* prefs, | 35 static void SetStartupPref(PrefService* prefs, |
39 const SessionStartupPref& pref); | 36 const SessionStartupPref& pref); |
40 static SessionStartupPref GetStartupPref(Profile* profile); | 37 static SessionStartupPref GetStartupPref(Profile* profile); |
41 static SessionStartupPref GetStartupPref(PrefService* prefs); | 38 static SessionStartupPref GetStartupPref(PrefService* prefs); |
42 | 39 |
43 // Whether the startup type and URLs are managed via policy. | 40 // Whether the startup type and URLs are managed via policy. |
44 static bool TypeIsManaged(PrefService* prefs); | 41 static bool TypeIsManaged(PrefService* prefs); |
45 static bool URLsAreManaged(PrefService* prefs); | 42 static bool URLsAreManaged(PrefService* prefs); |
46 | 43 |
| 44 SessionStartupPref(); |
| 45 |
47 explicit SessionStartupPref(Type type); | 46 explicit SessionStartupPref(Type type); |
48 | 47 |
49 ~SessionStartupPref(); | 48 ~SessionStartupPref(); |
50 | 49 |
51 // What to do on startup. | 50 // What to do on startup. |
52 Type type; | 51 Type type; |
53 | 52 |
54 // The URLs to restore. Only used if type == URLS. | 53 // The URLs to restore. Only used if type == URLS. |
55 std::vector<GURL> urls; | 54 std::vector<GURL> urls; |
56 }; | 55 }; |
57 | 56 |
58 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ | 57 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ |
OLD | NEW |