diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-02-13 10:55:42 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-03-05 13:33:38 +0000 |
commit | 248b70b82a40964d5594eb04feca0fa36716185d (patch) | |
tree | 44e31d9dd0ac2cb79f48633eefbc5496e013c347 /chromium/chrome/browser/prefs/session_startup_pref.h | |
parent | cabfcdd1db482729ded525feae56911a99792773 (diff) | |
download | qtwebengine-chromium-248b70b82a40964d5594eb04feca0fa36716185d.tar.gz |
BASELINE: Update Chromium to 79.0.3945.147
And new simplified snapshot filter
Change-Id: I7c692bedd5b3833f05565bd6f6939115350b233a
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/chrome/browser/prefs/session_startup_pref.h')
-rw-r--r-- | chromium/chrome/browser/prefs/session_startup_pref.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/chromium/chrome/browser/prefs/session_startup_pref.h b/chromium/chrome/browser/prefs/session_startup_pref.h new file mode 100644 index 00000000000..ebcb6e9850a --- /dev/null +++ b/chromium/chrome/browser/prefs/session_startup_pref.h @@ -0,0 +1,85 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ +#define CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ + +#include <vector> + +#include "url/gurl.h" + +class PrefService; +class Profile; + +namespace user_prefs { +class PrefRegistrySyncable; +} + +// StartupPref specifies what should happen at startup for a specified profile. +// StartupPref is stored in the preferences for a particular profile. +struct SessionStartupPref { + // Integer values should not be changed because reset reports depend on these. + enum Type { + // Indicates the user wants to open the New Tab page. + DEFAULT = 0, + + // Indicates the user wants to restore the last session. + LAST = 2, + + // Indicates the user wants to restore a specific set of URLs. The URLs + // are contained in urls. + URLS = 3, + }; + + // For historical reasons the enum and value registered in the prefs don't + // line up. These are the values registered in prefs. + // The values are also recorded in Settings.StartupPageLoadSettings histogram, + // so make sure to update histograms.xml if you change these. + enum PrefValue { + kPrefValueLast = 1, + kPrefValueURLs = 4, + kPrefValueNewTab = 5, + kPrefValueMax = 6, + }; + + static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); + + // Returns the default value for |type|. + static Type GetDefaultStartupType(); + + // What should happen on startup for the specified profile. + static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); + static void SetStartupPref(PrefService* prefs, + const SessionStartupPref& pref); + static SessionStartupPref GetStartupPref(Profile* profile); + static SessionStartupPref GetStartupPref(PrefService* prefs); + + // Whether the startup type and URLs are managed via mandatory policy. + static bool TypeIsManaged(PrefService* prefs); + static bool URLsAreManaged(PrefService* prefs); + + // Whether the startup type has a recommended value (regardless of whether or + // not that value is in use). + static bool TypeHasRecommendedValue(PrefService* prefs); + + // Whether the startup type has not been overridden from its default. + static bool TypeIsDefault(PrefService* prefs); + + // Converts an integer pref value to a SessionStartupPref::Type. + static SessionStartupPref::Type PrefValueToType(int pref_value); + + explicit SessionStartupPref(Type type); + + SessionStartupPref(const SessionStartupPref& other); + + ~SessionStartupPref(); + + // What to do on startup. + Type type; + + // The URLs to restore. Only used if type == URLS. + std::vector<GURL> urls; +}; + +#endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ |