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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/protector/base_setting_change.h" 5 #include "chrome/browser/protector/base_setting_change.h"
6 #include "chrome/browser/protector/composite_settings_change.h"
6 7
7 #include "base/logging.h" 8 #include "base/logging.h"
8 9
9 namespace protector { 10 namespace protector {
10 11
12 // static
13 const size_t kDefaultSearchProviderChangeNamePriority = 100U;
14 // static
15 const size_t kSessionStartupChangeNamePriority = 50U;
16
17 // static
18 const size_t BaseSettingChange::kDefaultNamePriority = 0U;
19
11 BaseSettingChange::BaseSettingChange() 20 BaseSettingChange::BaseSettingChange()
12 : profile_(NULL) { 21 : profile_(NULL) {
13 } 22 }
14 23
15 BaseSettingChange::~BaseSettingChange() { 24 BaseSettingChange::~BaseSettingChange() {
16 } 25 }
17 26
27 CompositeSettingsChange* BaseSettingChange::MergeWith(
28 BaseSettingChange* other) {
29 CompositeSettingsChange* composite_change = new CompositeSettingsChange();
30 CHECK(composite_change->Init(profile_));
31 composite_change->MergeWith(this);
32 composite_change->MergeWith(other);
33 return composite_change;
34 }
35
36 bool BaseSettingChange::Contains(const BaseSettingChange* other) const {
37 // BaseSettingChange can only contain itself.
38 return this == other;
39 }
40
18 bool BaseSettingChange::Init(Profile* profile) { 41 bool BaseSettingChange::Init(Profile* profile) {
19 DCHECK(profile); 42 DCHECK(profile);
20 profile_ = profile; 43 profile_ = profile;
21 return true; 44 return true;
22 } 45 }
23 46
24 void BaseSettingChange::Apply(Browser* browser) { 47 void BaseSettingChange::Apply(Browser* browser) {
25 } 48 }
26 49
27 void BaseSettingChange::Discard(Browser* browser) { 50 void BaseSettingChange::Discard(Browser* browser) {
28 } 51 }
29 52
30 void BaseSettingChange::Timeout() { 53 void BaseSettingChange::Timeout() {
31 } 54 }
32 55
56 BaseSettingChange::DisplayName BaseSettingChange::GetApplyDisplayName() const {
57 return DisplayName(kDefaultNamePriority, string16());
58 }
59
60 GURL BaseSettingChange::GetNewSettingURL() const {
61 return GURL();
62 }
63
64 bool BaseSettingChange::CanBeMerged() const {
65 // By default change can be collapsed if it has a non-empty keyword.
66 return !GetNewSettingURL().is_empty();
67 }
68
33 } // namespace protector 69 } // namespace protector
OLDNEW
« 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