Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: chrome/browser/prefs/session_startup_pref.h

Issue 1312693005: Remove migration of obsolete value for "session.restore_on_startup". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url-to-restore-on-startup
Patch Set: Remove unused free function Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 11
12 class PrefService; 12 class PrefService;
13 class Profile; 13 class Profile;
14 14
15 namespace user_prefs { 15 namespace user_prefs {
16 class PrefRegistrySyncable; 16 class PrefRegistrySyncable;
17 } 17 }
18 18
19 // StartupPref specifies what should happen at startup for a specified profile. 19 // StartupPref specifies what should happen at startup for a specified profile.
20 // StartupPref is stored in the preferences for a particular profile. 20 // StartupPref is stored in the preferences for a particular profile.
21 struct SessionStartupPref { 21 struct SessionStartupPref {
22 enum Type { 22 enum Type {
23 // Indicates the user wants to open the New Tab page. 23 // Indicates the user wants to open the New Tab page.
24 DEFAULT, 24 DEFAULT,
25 25
26 // Deprecated. See comment in session_startup_pref.cc
27 HOMEPAGE,
28
29 // Indicates the user wants to restore the last session. 26 // Indicates the user wants to restore the last session.
30 LAST, 27 LAST,
31 28
32 // 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
33 // are contained in urls. 30 // are contained in urls.
34 URLS, 31 URLS,
35 32
36 // Number of values in this enum. 33 // Number of values in this enum.
37 TYPE_COUNT 34 TYPE_COUNT
38 }; 35 };
39 36
40 // For historical reasons the enum and value registered in the prefs don't 37 // For historical reasons the enum and value registered in the prefs don't
41 // line up. These are the values registered in prefs. 38 // line up. These are the values registered in prefs.
42 // The values are also recorded in Settings.StartupPageLoadSettings histogram, 39 // The values are also recorded in Settings.StartupPageLoadSettings histogram,
43 // so make sure to update histograms.xml if you change these. 40 // so make sure to update histograms.xml if you change these.
44 static const int kPrefValueHomePage = 0; // Deprecated
bartfab (slow) 2015/08/31 15:36:43 +asvitkine@chromium.org Your advice is needed is n
45 static const int kPrefValueLast = 1; 41 static const int kPrefValueLast = 1;
46 static const int kPrefValueURLs = 4; 42 static const int kPrefValueURLs = 4;
47 static const int kPrefValueNewTab = 5; 43 static const int kPrefValueNewTab = 5;
48 static const int kPrefValueMax = 6; 44 static const int kPrefValueMax = 6;
49 45
50 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 46 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
51 47
52 // Returns the default value for |type|. 48 // Returns the default value for |type|.
53 static Type GetDefaultStartupType(); 49 static Type GetDefaultStartupType();
54 50
55 // What should happen on startup for the specified profile. 51 // What should happen on startup for the specified profile.
56 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); 52 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref);
57 static void SetStartupPref(PrefService* prefs, 53 static void SetStartupPref(PrefService* prefs,
58 const SessionStartupPref& pref); 54 const SessionStartupPref& pref);
59 static SessionStartupPref GetStartupPref(Profile* profile); 55 static SessionStartupPref GetStartupPref(Profile* profile);
60 static SessionStartupPref GetStartupPref(PrefService* prefs); 56 static SessionStartupPref GetStartupPref(PrefService* prefs);
61 57
62 // If the user had the "restore on startup" property set to the deprecated
63 // "Open the home page" value, this migrates them to a value that will have
64 // the same effect.
65 static void MigrateIfNecessary(PrefService* prefs);
66
67 // Whether the startup type and URLs are managed via policy. 58 // Whether the startup type and URLs are managed via policy.
68 static bool TypeIsManaged(PrefService* prefs); 59 static bool TypeIsManaged(PrefService* prefs);
69 static bool URLsAreManaged(PrefService* prefs); 60 static bool URLsAreManaged(PrefService* prefs);
70 61
71 // Whether the startup type has not been overridden from its default. 62 // Whether the startup type has not been overridden from its default.
72 static bool TypeIsDefault(PrefService* prefs); 63 static bool TypeIsDefault(PrefService* prefs);
73 64
74 // Converts an integer pref value to a SessionStartupPref::Type. 65 // Converts an integer pref value to a SessionStartupPref::Type.
75 static SessionStartupPref::Type PrefValueToType(int pref_value); 66 static SessionStartupPref::Type PrefValueToType(int pref_value);
76 67
77 explicit SessionStartupPref(Type type); 68 explicit SessionStartupPref(Type type);
78 69
79 ~SessionStartupPref(); 70 ~SessionStartupPref();
80 71
81 // What to do on startup. 72 // What to do on startup.
82 Type type; 73 Type type;
83 74
84 // The URLs to restore. Only used if type == URLS. 75 // The URLs to restore. Only used if type == URLS.
85 std::vector<GURL> urls; 76 std::vector<GURL> urls;
86 }; 77 };
87 78
88 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ 79 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698