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