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" |
11 #include "chrome/browser/protector/keys.h" | 11 #include "chrome/browser/protector/keys.h" |
12 #include "chrome/browser/protector/protected_prefs_watcher.h" | 12 #include "chrome/browser/protector/protected_prefs_watcher.h" |
13 #include "chrome/browser/protector/protector_utils.h" | 13 #include "chrome/browser/protector/protector_utils.h" |
14 #include "chrome/browser/protector/settings_change_global_error.h" | 14 #include "chrome/browser/protector/settings_change_global_error.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
19 #include "net/base/registry_controlled_domain.h" | 19 #include "net/base/registry_controlled_domain.h" |
20 | 20 |
21 namespace protector { | 21 namespace protector { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 // Returns true if changes with URLs |url1| and |url2| can be merged. | 25 // Returns true if changes with URLs |url1| and |url2| can be merged. |
26 bool CanMerge(const GURL& url1, const GURL& url2) { | 26 bool CanMerge(const GURL& url1, const GURL& url2) { |
27 VLOG(1) << "Checking if can merge " << url1.spec() << " with " << url2.spec(); | 27 VLOG(1) << "Checking if can merge " << url1.spec() << " with " << url2.spec(); |
28 // All Google URLs are considered the same one. | 28 // All Google URLs are considered the same one. |
29 if (google_util::IsGoogleHostname(url1.host())) | 29 if (google_util::IsGoogleHostname(url1.host(), |
30 return google_util::IsGoogleHostname(url2.host()); | 30 google_util::DISALLOW_SUBDOMAIN)) { |
| 31 return google_util::IsGoogleHostname(url2.host(), |
| 32 google_util::DISALLOW_SUBDOMAIN); |
| 33 } |
31 // Otherwise URLs must have the same domain. | 34 // Otherwise URLs must have the same domain. |
32 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2); | 35 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2); |
33 } | 36 } |
34 | 37 |
35 } // namespace | 38 } // namespace |
36 | 39 |
37 ProtectorService::ProtectorService(Profile* profile) | 40 ProtectorService::ProtectorService(Profile* profile) |
38 : profile_(profile), | 41 : profile_(profile), |
39 has_active_change_(false) { | 42 has_active_change_(false) { |
40 // Start observing pref changes. | 43 // Start observing pref changes. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 ProtectorService::MatchItemByError::MatchItemByError( | 215 ProtectorService::MatchItemByError::MatchItemByError( |
213 const SettingsChangeGlobalError* other) : other_(other) { | 216 const SettingsChangeGlobalError* other) : other_(other) { |
214 } | 217 } |
215 | 218 |
216 bool ProtectorService::MatchItemByError::operator()( | 219 bool ProtectorService::MatchItemByError::operator()( |
217 const ProtectorService::Item& item) { | 220 const ProtectorService::Item& item) { |
218 return other_ == item.error.get(); | 221 return other_ == item.error.get(); |
219 } | 222 } |
220 | 223 |
221 } // namespace protector | 224 } // namespace protector |
OLD | NEW |