OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // Returns the default value for |type|. | 46 // Returns the default value for |type|. |
47 static Type GetDefaultStartupType(); | 47 static Type GetDefaultStartupType(); |
48 | 48 |
49 // What should happen on startup for the specified profile. | 49 // What should happen on startup for the specified profile. |
50 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); | 50 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); |
51 static void SetStartupPref(PrefService* prefs, | 51 static void SetStartupPref(PrefService* prefs, |
52 const SessionStartupPref& pref); | 52 const SessionStartupPref& pref); |
53 static SessionStartupPref GetStartupPref(Profile* profile); | 53 static SessionStartupPref GetStartupPref(Profile* profile); |
54 static SessionStartupPref GetStartupPref(PrefService* prefs); | 54 static SessionStartupPref GetStartupPref(PrefService* prefs); |
55 | 55 |
| 56 // If the user had the "restore on startup" property set to the deprecated |
| 57 // "Open the home page" value, this migrates them to a value that will have |
| 58 // the same effect. |
| 59 static void MigrateIfNecessary(PrefService* prefs); |
| 60 |
56 // Whether the startup type and URLs are managed via policy. | 61 // Whether the startup type and URLs are managed via policy. |
57 static bool TypeIsManaged(PrefService* prefs); | 62 static bool TypeIsManaged(PrefService* prefs); |
58 static bool URLsAreManaged(PrefService* prefs); | 63 static bool URLsAreManaged(PrefService* prefs); |
59 | 64 |
60 // Converts an integer pref value to a SessionStartupPref::Type. | 65 // Converts an integer pref value to a SessionStartupPref::Type. |
61 static SessionStartupPref::Type PrefValueToType(int pref_value); | 66 static SessionStartupPref::Type PrefValueToType(int pref_value); |
62 | 67 |
63 // Returns |true| if a change to startup type or URLS was detected by | 68 // Returns |true| if a change to startup type or URLS was detected by |
64 // ProtectorService. | 69 // ProtectorService. |
65 static bool DidStartupPrefChange(Profile* profile); | 70 static bool DidStartupPrefChange(Profile* profile); |
66 | 71 |
67 // Returns the protected backup of startup type and URLS. | 72 // Returns the protected backup of startup type and URLS. |
68 static SessionStartupPref GetStartupPrefBackup(Profile* profile); | 73 static SessionStartupPref GetStartupPrefBackup(Profile* profile); |
69 | 74 |
70 explicit SessionStartupPref(Type type); | 75 explicit SessionStartupPref(Type type); |
71 | 76 |
72 ~SessionStartupPref(); | 77 ~SessionStartupPref(); |
73 | 78 |
74 // What to do on startup. | 79 // What to do on startup. |
75 Type type; | 80 Type type; |
76 | 81 |
77 // The URLs to restore. Only used if type == URLS. | 82 // The URLs to restore. Only used if type == URLS. |
78 std::vector<GURL> urls; | 83 std::vector<GURL> urls; |
79 }; | 84 }; |
80 | 85 |
81 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ | 86 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ |
OLD | NEW |