| 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/protector_service.h" | 5 #include "chrome/browser/protector/protector_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/google/google_util.h" | 8 #include "chrome/browser/google/google_util.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/protector/composite_settings_change.h" | 10 #include "chrome/browser/protector/composite_settings_change.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 void ProtectorService::OpenTab(const GURL& url, Browser* browser) { | 113 void ProtectorService::OpenTab(const GURL& url, Browser* browser) { |
| 114 DCHECK(browser); | 114 DCHECK(browser); |
| 115 browser->ShowSingletonTab(url); | 115 browser->ShowSingletonTab(url); |
| 116 } | 116 } |
| 117 | 117 |
| 118 ProtectedPrefsWatcher* ProtectorService::GetPrefsWatcher() { | 118 ProtectedPrefsWatcher* ProtectorService::GetPrefsWatcher() { |
| 119 return prefs_watcher_.get(); | 119 return prefs_watcher_.get(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void ProtectorService::StopWatchingPrefsForTesting() { |
| 123 prefs_watcher_.reset(); |
| 124 } |
| 125 |
| 122 ProtectorService::Item* ProtectorService::FindItemToMergeWith( | 126 ProtectorService::Item* ProtectorService::FindItemToMergeWith( |
| 123 const BaseSettingChange* change) { | 127 const BaseSettingChange* change) { |
| 124 if (!change->CanBeMerged()) | 128 if (!change->CanBeMerged()) |
| 125 return NULL; | 129 return NULL; |
| 126 GURL url = change->GetNewSettingURL(); | 130 GURL url = change->GetNewSettingURL(); |
| 127 for (Items::iterator item = items_.begin(); item != items_.end(); item++) { | 131 for (Items::iterator item = items_.begin(); item != items_.end(); item++) { |
| 128 if (item->change->CanBeMerged() && | 132 if (item->change->CanBeMerged() && |
| 129 CanMerge(url, item->change->GetNewSettingURL())) | 133 CanMerge(url, item->change->GetNewSettingURL())) |
| 130 return &*item; | 134 return &*item; |
| 131 } | 135 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 ProtectorService::MatchItemByError::MatchItemByError( | 216 ProtectorService::MatchItemByError::MatchItemByError( |
| 213 const SettingsChangeGlobalError* other) : other_(other) { | 217 const SettingsChangeGlobalError* other) : other_(other) { |
| 214 } | 218 } |
| 215 | 219 |
| 216 bool ProtectorService::MatchItemByError::operator()( | 220 bool ProtectorService::MatchItemByError::operator()( |
| 217 const ProtectorService::Item& item) { | 221 const ProtectorService::Item& item) { |
| 218 return other_ == item.error.get(); | 222 return other_ == item.error.get(); |
| 219 } | 223 } |
| 220 | 224 |
| 221 } // namespace protector | 225 } // namespace protector |
| OLD | NEW |