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 28 matching lines...) Expand all Loading... |
39 // Returns the default value for |type|. | 39 // Returns the default value for |type|. |
40 static Type GetDefaultStartupType(); | 40 static Type GetDefaultStartupType(); |
41 | 41 |
42 // What should happen on startup for the specified profile. | 42 // What should happen on startup for the specified profile. |
43 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); | 43 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); |
44 static void SetStartupPref(PrefService* prefs, | 44 static void SetStartupPref(PrefService* prefs, |
45 const SessionStartupPref& pref); | 45 const SessionStartupPref& pref); |
46 static SessionStartupPref GetStartupPref(Profile* profile); | 46 static SessionStartupPref GetStartupPref(Profile* profile); |
47 static SessionStartupPref GetStartupPref(PrefService* prefs); | 47 static SessionStartupPref GetStartupPref(PrefService* prefs); |
48 | 48 |
| 49 // Migrates from "Open the home page" to "Open the following URLs", and sets |
| 50 // the list of URLs to a one-item list containing the user's homepage. |
| 51 static void MigrateIfNecessary(PrefService* prefs); |
| 52 |
49 // Whether the startup type and URLs are managed via policy. | 53 // Whether the startup type and URLs are managed via policy. |
50 static bool TypeIsManaged(PrefService* prefs); | 54 static bool TypeIsManaged(PrefService* prefs); |
51 static bool URLsAreManaged(PrefService* prefs); | 55 static bool URLsAreManaged(PrefService* prefs); |
52 | 56 |
53 // Converts an integer pref value to a SessionStartupPref::Type. | 57 // Converts an integer pref value to a SessionStartupPref::Type. |
54 static SessionStartupPref::Type PrefValueToType(int pref_value); | 58 static SessionStartupPref::Type PrefValueToType(int pref_value); |
55 | 59 |
56 // Returns |true| if a change to startup type or URLS was detected by | 60 // Returns |true| if a change to startup type or URLS was detected by |
57 // ProtectorService. | 61 // ProtectorService. |
58 static bool DidStartupPrefChange(Profile* profile); | 62 static bool DidStartupPrefChange(Profile* profile); |
59 | 63 |
60 // Returns the protected backup of startup type and URLS. | 64 // Returns the protected backup of startup type and URLS. |
61 static SessionStartupPref GetStartupPrefBackup(Profile* profile); | 65 static SessionStartupPref GetStartupPrefBackup(Profile* profile); |
62 | 66 |
63 explicit SessionStartupPref(Type type); | 67 explicit SessionStartupPref(Type type); |
64 | 68 |
65 ~SessionStartupPref(); | 69 ~SessionStartupPref(); |
66 | 70 |
67 // What to do on startup. | 71 // What to do on startup. |
68 Type type; | 72 Type type; |
69 | 73 |
70 // The URLs to restore. Only used if type == URLS. | 74 // The URLs to restore. Only used if type == URLS. |
71 std::vector<GURL> urls; | 75 std::vector<GURL> urls; |
72 }; | 76 }; |
73 | 77 |
74 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ | 78 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ |
OLD | NEW |