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

Side by Side Diff: chrome/browser/protector/protector_service.cc

Issue 10108026: Transmit a X-Chrome-UMA-Enabled bit to Google domains from clients that have UMA enabled. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: prefmember for metrics enabled 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
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/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/settings_change_global_error.h" 13 #include "chrome/browser/protector/settings_change_global_error.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/common/chrome_notification_types.h" 15 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "content/public/browser/notification_source.h" 17 #include "content/public/browser/notification_source.h"
18 #include "net/base/registry_controlled_domain.h" 18 #include "net/base/registry_controlled_domain.h"
19 19
20 namespace protector { 20 namespace protector {
21 21
22 namespace { 22 namespace {
23 23
24 // Returns true if changes with URLs |url1| and |url2| can be merged. 24 // Returns true if changes with URLs |url1| and |url2| can be merged.
25 bool CanMerge(const GURL& url1, const GURL& url2) { 25 bool CanMerge(const GURL& url1, const GURL& url2) {
26 VLOG(1) << "Checking if can merge " << url1.spec() << " with " << url2.spec(); 26 VLOG(1) << "Checking if can merge " << url1.spec() << " with " << url2.spec();
27 // All Google URLs are considered the same one. 27 // All Google URLs are considered the same one.
28 if (google_util::IsGoogleHostname(url1.host())) 28 if (google_util::IsGoogleHostname(url1.host(),
29 return google_util::IsGoogleHostname(url2.host()); 29 google_util::DISALLOW_SUBDOMAIN)) {
30 return google_util::IsGoogleHostname(url2.host(),
31 google_util::DISALLOW_SUBDOMAIN);
32 }
30 // Otherwise URLs must have the same domain. 33 // Otherwise URLs must have the same domain.
31 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2); 34 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2);
32 } 35 }
33 36
34 } // namespace 37 } // namespace
35 38
36 ProtectorService::ProtectorService(Profile* profile) 39 ProtectorService::ProtectorService(Profile* profile)
37 : profile_(profile), 40 : profile_(profile),
38 has_active_change_(false) { 41 has_active_change_(false) {
39 // Start observing pref changes. 42 // Start observing pref changes.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 ProtectorService::MatchItemByError::MatchItemByError( 207 ProtectorService::MatchItemByError::MatchItemByError(
205 const SettingsChangeGlobalError* other) : other_(other) { 208 const SettingsChangeGlobalError* other) : other_(other) {
206 } 209 }
207 210
208 bool ProtectorService::MatchItemByError::operator()( 211 bool ProtectorService::MatchItemByError::operator()(
209 const ProtectorService::Item& item) { 212 const ProtectorService::Item& item) {
210 return other_ == item.error.get(); 213 return other_ == item.error.get();
211 } 214 }
212 215
213 } // namespace protector 216 } // namespace protector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698