| 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 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 | 11 |
| 12 class PrefService; | 12 class PrefService; |
| 13 class Profile; |
| 14 |
| 15 namespace user_prefs { |
| 13 class PrefRegistrySyncable; | 16 class PrefRegistrySyncable; |
| 14 class Profile; | 17 } |
| 15 | 18 |
| 16 // StartupPref specifies what should happen at startup for a specified profile. | 19 // StartupPref specifies what should happen at startup for a specified profile. |
| 17 // StartupPref is stored in the preferences for a particular profile. | 20 // StartupPref is stored in the preferences for a particular profile. |
| 18 struct SessionStartupPref { | 21 struct SessionStartupPref { |
| 19 enum Type { | 22 enum Type { |
| 20 // Indicates the user wants to open the New Tab page. | 23 // Indicates the user wants to open the New Tab page. |
| 21 DEFAULT, | 24 DEFAULT, |
| 22 | 25 |
| 23 // Deprecated. See comment in session_startup_pref.cc | 26 // Deprecated. See comment in session_startup_pref.cc |
| 24 HOMEPAGE, | 27 HOMEPAGE, |
| 25 | 28 |
| 26 // Indicates the user wants to restore the last session. | 29 // Indicates the user wants to restore the last session. |
| 27 LAST, | 30 LAST, |
| 28 | 31 |
| 29 // Indicates the user wants to restore a specific set of URLs. The URLs | 32 // Indicates the user wants to restore a specific set of URLs. The URLs |
| 30 // are contained in urls. | 33 // are contained in urls. |
| 31 URLS, | 34 URLS, |
| 32 | 35 |
| 33 // Number of values in this enum. | 36 // Number of values in this enum. |
| 34 TYPE_COUNT | 37 TYPE_COUNT |
| 35 }; | 38 }; |
| 36 | 39 |
| 37 // For historical reasons the enum and value registered in the prefs don't | 40 // For historical reasons the enum and value registered in the prefs don't |
| 38 // line up. These are the values registered in prefs. | 41 // line up. These are the values registered in prefs. |
| 39 static const int kPrefValueHomePage = 0; // Deprecated | 42 static const int kPrefValueHomePage = 0; // Deprecated |
| 40 static const int kPrefValueLast = 1; | 43 static const int kPrefValueLast = 1; |
| 41 static const int kPrefValueURLs = 4; | 44 static const int kPrefValueURLs = 4; |
| 42 static const int kPrefValueNewTab = 5; | 45 static const int kPrefValueNewTab = 5; |
| 43 | 46 |
| 44 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 47 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
| 45 | 48 |
| 46 // Returns the default value for |type|. | 49 // Returns the default value for |type|. |
| 47 static Type GetDefaultStartupType(); | 50 static Type GetDefaultStartupType(); |
| 48 | 51 |
| 49 // What should happen on startup for the specified profile. | 52 // What should happen on startup for the specified profile. |
| 50 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); | 53 static void SetStartupPref(Profile* profile, const SessionStartupPref& pref); |
| 51 static void SetStartupPref(PrefService* prefs, | 54 static void SetStartupPref(PrefService* prefs, |
| 52 const SessionStartupPref& pref); | 55 const SessionStartupPref& pref); |
| 53 static SessionStartupPref GetStartupPref(Profile* profile); | 56 static SessionStartupPref GetStartupPref(Profile* profile); |
| 54 static SessionStartupPref GetStartupPref(PrefService* prefs); | 57 static SessionStartupPref GetStartupPref(PrefService* prefs); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 ~SessionStartupPref(); | 80 ~SessionStartupPref(); |
| 78 | 81 |
| 79 // What to do on startup. | 82 // What to do on startup. |
| 80 Type type; | 83 Type type; |
| 81 | 84 |
| 82 // The URLs to restore. Only used if type == URLS. | 85 // The URLs to restore. Only used if type == URLS. |
| 83 std::vector<GURL> urls; | 86 std::vector<GURL> urls; |
| 84 }; | 87 }; |
| 85 | 88 |
| 86 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ | 89 #endif // CHROME_BROWSER_PREFS_SESSION_STARTUP_PREF_H__ |
| OLD | NEW |