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

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: Re-enable the two tests Created 5 years 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
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/browser/prefs/session_startup_pref.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
36 // Number of values in this enum.
37 TYPE_COUNT
38 }; 32 };
39 33
40 // For historical reasons the enum and value registered in the prefs don't 34 // For historical reasons the enum and value registered in the prefs don't
41 // line up. These are the values registered in prefs. 35 // line up. These are the values registered in prefs.
42 // The values are also recorded in Settings.StartupPageLoadSettings histogram, 36 // The values are also recorded in Settings.StartupPageLoadSettings histogram,
43 // so make sure to update histograms.xml if you change these. 37 // so make sure to update histograms.xml if you change these.
44 static const int kPrefValueHomePage = 0; // Deprecated
45 static const int kPrefValueLast = 1; 38 static const int kPrefValueLast = 1;
46 static const int kPrefValueURLs = 4; 39 static const int kPrefValueURLs = 4;
47 static const int kPrefValueNewTab = 5; 40 static const int kPrefValueNewTab = 5;
48 static const int kPrefValueMax = 6; 41 static const int kPrefValueMax = 6;
49 42
50 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 43 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
51 44
52 // Returns the default value for |type|. 45 // Returns the default value for |type|.
53 static Type GetDefaultStartupType(); 46 static Type GetDefaultStartupType();
54 47
55 // What should happen on startup for the specified profile. 48 // What should happen on startup for the specified profile.
56 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); 49 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref);
57 static void SetStartupPref(PrefService* prefs, 50 static void SetStartupPref(PrefService* prefs,
58 const SessionStartupPref& pref); 51 const SessionStartupPref& pref);
59 static SessionStartupPref GetStartupPref(Profile* profile); 52 static SessionStartupPref GetStartupPref(Profile* profile);
60 static SessionStartupPref GetStartupPref(PrefService* prefs); 53 static SessionStartupPref GetStartupPref(PrefService* prefs);
61 54
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. 55 // Whether the startup type and URLs are managed via policy.
68 static bool TypeIsManaged(PrefService* prefs); 56 static bool TypeIsManaged(PrefService* prefs);
69 static bool URLsAreManaged(PrefService* prefs); 57 static bool URLsAreManaged(PrefService* prefs);
70 58
71 // Whether the startup type has not been overridden from its default. 59 // Whether the startup type has not been overridden from its default.
72 static bool TypeIsDefault(PrefService* prefs); 60 static bool TypeIsDefault(PrefService* prefs);
73 61
74 // Converts an integer pref value to a SessionStartupPref::Type. 62 // Converts an integer pref value to a SessionStartupPref::Type.
75 static SessionStartupPref::Type PrefValueToType(int pref_value); 63 static SessionStartupPref::Type PrefValueToType(int pref_value);
76 64
77 explicit SessionStartupPref(Type type); 65 explicit SessionStartupPref(Type type);
78 66
79 ~SessionStartupPref(); 67 ~SessionStartupPref();
80 68
81 // What to do on startup. 69 // What to do on startup.
82 Type type; 70 Type type;
83 71
84 // The URLs to restore. Only used if type == URLS. 72 // The URLs to restore. Only used if type == URLS.
85 std::vector<GURL> urls; 73 std::vector<GURL> urls;
86 }; 74 };
87 75
88 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ 76 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__
OLDNEW
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/browser/prefs/session_startup_pref.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698