Chromium Code Reviews| 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 #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 BaseSettingChange::kDefaultNamePriority = 0U; | |
| 14 | |
| 11 BaseSettingChange::BaseSettingChange() | 15 BaseSettingChange::BaseSettingChange() |
| 12 : profile_(NULL) { | 16 : profile_(NULL) { |
| 13 } | 17 } |
| 14 | 18 |
| 15 BaseSettingChange::~BaseSettingChange() { | 19 BaseSettingChange::~BaseSettingChange() { |
| 16 } | 20 } |
| 17 | 21 |
| 22 CompositeSettingsChange* BaseSettingChange::MergeWith( | |
| 23 BaseSettingChange* other) { | |
| 24 CompositeSettingsChange* composite_change = new CompositeSettingsChange; | |
|
whywhat
2012/04/06 16:28:32
nit: I think we should use () always for construct
Ivan Korotkov
2012/04/09 14:46:47
Done.
| |
| 25 CHECK(composite_change->Init(profile_)); | |
| 26 composite_change->MergeWith(this); | |
| 27 composite_change->MergeWith(other); | |
| 28 return composite_change; | |
| 29 } | |
| 30 | |
| 31 bool BaseSettingChange::Contains(const BaseSettingChange* other) const { | |
| 32 // BaseSettingChange can only contain itself. | |
| 33 return this == other; | |
| 34 } | |
| 35 | |
| 18 bool BaseSettingChange::Init(Profile* profile) { | 36 bool BaseSettingChange::Init(Profile* profile) { |
| 19 DCHECK(profile); | 37 DCHECK(profile); |
| 20 profile_ = profile; | 38 profile_ = profile; |
| 21 return true; | 39 return true; |
| 22 } | 40 } |
| 23 | 41 |
| 24 void BaseSettingChange::Apply(Browser* browser) { | 42 void BaseSettingChange::Apply(Browser* browser) { |
| 25 } | 43 } |
| 26 | 44 |
| 27 void BaseSettingChange::Discard(Browser* browser) { | 45 void BaseSettingChange::Discard(Browser* browser) { |
| 28 } | 46 } |
| 29 | 47 |
| 30 void BaseSettingChange::Timeout() { | 48 void BaseSettingChange::Timeout() { |
| 31 } | 49 } |
| 32 | 50 |
| 51 BaseSettingChange::DisplayName BaseSettingChange::GetApplyDisplayName() const { | |
| 52 return DisplayName(kDefaultNamePriority, string16()); | |
| 53 } | |
| 54 | |
| 55 std::string BaseSettingChange::GetApplyKeyword() const { | |
| 56 // By default change should not be collapsed with others. | |
| 57 return std::string(); | |
|
whywhat
2012/04/06 16:28:32
Maybe this property should be returned by clearer
Ivan Korotkov
2012/04/09 14:46:47
In most cases, the IsCollapsible will have the sam
whywhat
2012/04/10 09:55:44
So? I see nothing wrong with that :)
Ivan Korotkov
2012/04/10 11:19:49
Er, well, code duplication is bad isn't it? :)
If
whywhat
2012/04/10 11:22:08
There would be none if IsCollapsible() would be im
Ivan Korotkov
2012/04/10 11:33:17
Ok, you've convinced me :)
| |
| 58 } | |
| 59 | |
| 33 } // namespace protector | 60 } // namespace protector |
| OLD | NEW |