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

Unified Diff: chrome/browser/protector/base_setting_change.cc

Issue 9968007: [protector] Support for collapsing multiple changes into a single one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/protector/base_setting_change.cc
diff --git a/chrome/browser/protector/base_setting_change.cc b/chrome/browser/protector/base_setting_change.cc
index 805d48b96f17813477f95bb27031e170361e0c62..4c5ba032dd38eefc4a2ae9d1639ee5973ac79c3e 100644
--- a/chrome/browser/protector/base_setting_change.cc
+++ b/chrome/browser/protector/base_setting_change.cc
@@ -3,11 +3,20 @@
// found in the LICENSE file.
#include "chrome/browser/protector/base_setting_change.h"
+#include "chrome/browser/protector/composite_settings_change.h"
#include "base/logging.h"
namespace protector {
+// static
+const size_t kDefaultSearchProviderChangeNamePriority = 100U;
+// static
+const size_t kSessionStartupChangeNamePriority = 50U;
+
+// static
+const size_t BaseSettingChange::kDefaultNamePriority = 0U;
+
BaseSettingChange::BaseSettingChange()
: profile_(NULL) {
}
@@ -15,6 +24,20 @@ BaseSettingChange::BaseSettingChange()
BaseSettingChange::~BaseSettingChange() {
}
+CompositeSettingsChange* BaseSettingChange::MergeWith(
+ BaseSettingChange* other) {
+ CompositeSettingsChange* composite_change = new CompositeSettingsChange();
+ CHECK(composite_change->Init(profile_));
+ composite_change->MergeWith(this);
+ composite_change->MergeWith(other);
+ return composite_change;
+}
+
+bool BaseSettingChange::Contains(const BaseSettingChange* other) const {
+ // BaseSettingChange can only contain itself.
+ return this == other;
+}
+
bool BaseSettingChange::Init(Profile* profile) {
DCHECK(profile);
profile_ = profile;
@@ -30,4 +53,17 @@ void BaseSettingChange::Discard(Browser* browser) {
void BaseSettingChange::Timeout() {
}
+BaseSettingChange::DisplayName BaseSettingChange::GetApplyDisplayName() const {
+ return DisplayName(kDefaultNamePriority, string16());
+}
+
+GURL BaseSettingChange::GetNewSettingURL() const {
+ return GURL();
+}
+
+bool BaseSettingChange::CanBeMerged() const {
+ // By default change can be collapsed if it has a non-empty keyword.
+ return !GetNewSettingURL().is_empty();
+}
+
} // namespace protector
« no previous file with comments | « chrome/browser/protector/base_setting_change.h ('k') | chrome/browser/protector/composite_settings_change.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698