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_PROTECTOR_BASE_SETTING_CHANGE_H_ | 5 #ifndef CHROME_BROWSER_PROTECTOR_BASE_SETTING_CHANGE_H_ |
6 #define CHROME_BROWSER_PROTECTOR_BASE_SETTING_CHANGE_H_ | 6 #define CHROME_BROWSER_PROTECTOR_BASE_SETTING_CHANGE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 virtual DisplayName GetApplyDisplayName() const; | 101 virtual DisplayName GetApplyDisplayName() const; |
102 | 102 |
103 // Returns a URL uniquely identifying new (to be applied) settings. | 103 // Returns a URL uniquely identifying new (to be applied) settings. |
104 // ProtectorService uses this URLs to decide whether to merge a change | 104 // ProtectorService uses this URLs to decide whether to merge a change |
105 // with already existing active changes. The URL may be empty. | 105 // with already existing active changes. The URL may be empty. |
106 virtual GURL GetNewSettingURL() const; | 106 virtual GURL GetNewSettingURL() const; |
107 | 107 |
108 // Returns true if this change can be merged with other changes. | 108 // Returns true if this change can be merged with other changes. |
109 virtual bool CanBeMerged() const; | 109 virtual bool CanBeMerged() const; |
110 | 110 |
| 111 // Returns |false| if this change is not user-visible. It won't be presented |
| 112 // to user on it's own then, but may be merged with other changes and applied |
| 113 // or discarded. |
| 114 virtual bool IsUserVisible() const; |
| 115 |
111 protected: | 116 protected: |
112 // Profile instance we've been associated with by an |Init| call. | 117 // Profile instance we've been associated with by an |Init| call. |
113 Profile* profile() { return profile_; } | 118 Profile* profile() { return profile_; } |
114 | 119 |
115 private: | 120 private: |
116 Profile* profile_; | 121 Profile* profile_; |
117 | 122 |
118 DISALLOW_COPY_AND_ASSIGN(BaseSettingChange); | 123 DISALLOW_COPY_AND_ASSIGN(BaseSettingChange); |
119 }; | 124 }; |
120 | 125 |
121 // Display name priorities of various change types: | 126 // Display name priorities of various change types: |
122 extern const size_t kDefaultSearchProviderChangeNamePriority; | 127 extern const size_t kDefaultSearchProviderChangeNamePriority; |
123 extern const size_t kSessionStartupChangeNamePriority; | 128 extern const size_t kSessionStartupChangeNamePriority; |
| 129 extern const size_t kHomepageChangeNamePriority; |
124 | 130 |
125 // TODO(ivankr): CompositeSettingChange that incapsulates multiple | 131 // TODO(ivankr): CompositeSettingChange that incapsulates multiple |
126 // BaseSettingChange instances. | 132 // BaseSettingChange instances. |
127 | 133 |
128 // Allocates and initializes BaseSettingChange implementation for default search | 134 // Allocates and initializes BaseSettingChange implementation for default search |
129 // provider setting. Reports corresponding histograms. Both |actual| and | 135 // provider setting. Reports corresponding histograms. Both |actual| and |
130 // |backup| may be NULL if corresponding values are unknown or invalid. | 136 // |backup| may be NULL if corresponding values are unknown or invalid. |
131 // |backup| will be owned by the returned |BaseSettingChange| instance. |actual| | 137 // |backup| will be owned by the returned |BaseSettingChange| instance. |actual| |
132 // is not owned and is safe to destroy after Protector::ShowChange has been | 138 // is not owned and is safe to destroy after Protector::ShowChange has been |
133 // called for the returned instance. | 139 // called for the returned instance. |
134 BaseSettingChange* CreateDefaultSearchProviderChange(const TemplateURL* actual, | 140 BaseSettingChange* CreateDefaultSearchProviderChange(const TemplateURL* actual, |
135 TemplateURL* backup); | 141 TemplateURL* backup); |
136 | 142 |
137 // Allocates and initializes BaseSettingChange implementation for session | 143 // Allocates and initializes BaseSettingChange implementation for session |
138 // startup setting, including the pinned tabs. Reports corresponding histograms. | 144 // startup setting, including the pinned tabs. Reports corresponding histograms. |
139 BaseSettingChange* CreateSessionStartupChange( | 145 BaseSettingChange* CreateSessionStartupChange( |
140 const SessionStartupPref& actual_startup_pref, | 146 const SessionStartupPref& actual_startup_pref, |
141 const PinnedTabCodec::Tabs& actual_pinned_tabs, | 147 const PinnedTabCodec::Tabs& actual_pinned_tabs, |
142 const SessionStartupPref& backup_startup_pref, | 148 const SessionStartupPref& backup_startup_pref, |
143 const PinnedTabCodec::Tabs& backup_pinned_tabs); | 149 const PinnedTabCodec::Tabs& backup_pinned_tabs); |
144 | 150 |
| 151 BaseSettingChange* CreateHomepageChange( |
| 152 const std::string& actual_homepage, |
| 153 bool actual_homepage_is_ntp, |
| 154 bool actual_show_homepage, |
| 155 const std::string& backup_homepage, |
| 156 bool backup_homepage_is_ntp, |
| 157 bool backup_show_homepage); |
| 158 |
145 // Allocates and initializes BaseSettingChange implementation for an unknown | 159 // Allocates and initializes BaseSettingChange implementation for an unknown |
146 // preferences change with invalid backup. | 160 // preferences change with invalid backup. |
147 BaseSettingChange* CreatePrefsBackupInvalidChange(); | 161 BaseSettingChange* CreatePrefsBackupInvalidChange(); |
148 | 162 |
149 } // namespace protector | 163 } // namespace protector |
150 | 164 |
151 #endif // CHROME_BROWSER_PROTECTOR_BASE_SETTING_CHANGE_H_ | 165 #endif // CHROME_BROWSER_PROTECTOR_BASE_SETTING_CHANGE_H_ |
OLD | NEW |