Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / prefs / session_startup_pref.h
blob0a7aeec08663caaa04295421c18279985cf68cdc
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__
6 #define CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__
8 #include <vector>
10 #include "url/gurl.h"
12 class PrefService;
13 class Profile;
15 namespace user_prefs {
16 class PrefRegistrySyncable;
19 // StartupPref specifies what should happen at startup for a specified profile.
20 // StartupPref is stored in the preferences for a particular profile.
21 struct SessionStartupPref {
22 enum Type {
23 // Indicates the user wants to open the New Tab page.
24 DEFAULT,
26 // Deprecated. See comment in session_startup_pref.cc
27 HOMEPAGE,
29 // Indicates the user wants to restore the last session.
30 LAST,
32 // Indicates the user wants to restore a specific set of URLs. The URLs
33 // are contained in urls.
34 URLS,
36 // Number of values in this enum.
37 TYPE_COUNT
40 // For historical reasons the enum and value registered in the prefs don't
41 // line up. These are the values registered in prefs.
42 // The values are also recorded in Settings.StartupPageLoadSettings histogram,
43 // so make sure to update histograms.xml if you change these.
44 static const int kPrefValueHomePage = 0; // Deprecated
45 static const int kPrefValueLast = 1;
46 static const int kPrefValueURLs = 4;
47 static const int kPrefValueNewTab = 5;
48 static const int kPrefValueMax = 6;
50 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
52 // Returns the default value for |type|.
53 static Type GetDefaultStartupType();
55 // What should happen on startup for the specified profile.
56 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref);
57 static void SetStartupPref(PrefService* prefs,
58 const SessionStartupPref& pref);
59 static SessionStartupPref GetStartupPref(Profile* profile);
60 static SessionStartupPref GetStartupPref(PrefService* prefs);
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);
67 // Whether the startup type and URLs are managed via policy.
68 static bool TypeIsManaged(PrefService* prefs);
69 static bool URLsAreManaged(PrefService* prefs);
71 // Whether the startup type has not been overridden from its default.
72 static bool TypeIsDefault(PrefService* prefs);
74 // Converts an integer pref value to a SessionStartupPref::Type.
75 static SessionStartupPref::Type PrefValueToType(int pref_value);
77 explicit SessionStartupPref(Type type);
79 ~SessionStartupPref();
81 // What to do on startup.
82 Type type;
84 // The URLs to restore. Only used if type == URLS.
85 std::vector<GURL> urls;
88 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__