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

Side by Side Diff: chrome/browser/prefs/pref_metrics_service.cc

Issue 27273004: Record stats about kExtensionKnownDisabled with the PrefMetricsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/prefs/pref_metrics_service.h" 5 #include "chrome/browser/prefs/pref_metrics_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/prefs/pref_registry_simple.h" 11 #include "base/prefs/pref_registry_simple.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/browser_shutdown.h" 15 #include "chrome/browser/browser_shutdown.h"
16 // Accessing the Device ID API here is a layering violation. 16 // Accessing the Device ID API here is a layering violation.
17 // TODO(bbudge) Move the API so it's usable here. 17 // TODO(bbudge) Move the API so it's usable here.
18 // http://crbug.com/276485 18 // http://crbug.com/276485
19 #include "chrome/browser/extensions/api/music_manager_private/device_id.h" 19 #include "chrome/browser/extensions/api/music_manager_private/device_id.h"
20 #include "chrome/browser/extensions/extension_prefs.h" 20 #include "chrome/browser/extensions/extension_prefs.h"
bbudge 2013/10/15 18:56:00 I don't think we need this any more.
gab 2013/10/15 19:09:35 Done.
21 #include "chrome/browser/prefs/pref_service_syncable.h" 21 #include "chrome/browser/prefs/pref_service_syncable.h"
22 #include "chrome/browser/prefs/scoped_user_pref_update.h" 22 #include "chrome/browser/prefs/scoped_user_pref_update.h"
23 #include "chrome/browser/prefs/session_startup_pref.h" 23 #include "chrome/browser/prefs/session_startup_pref.h"
24 #include "chrome/browser/prefs/synced_pref_change_registrar.h" 24 #include "chrome/browser/prefs/synced_pref_change_registrar.h"
25 #include "chrome/browser/profiles/incognito_helpers.h" 25 #include "chrome/browser/profiles/incognito_helpers.h"
26 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" 27 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
28 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" 28 #include "chrome/browser/ui/tabs/pinned_tab_codec.h"
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
31 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 31 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
32 #include "crypto/hmac.h" 32 #include "crypto/hmac.h"
33 #include "grit/browser_resources.h" 33 #include "grit/browser_resources.h"
34 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 34 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
35 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
36 36
37 namespace { 37 namespace {
38 38
39 const int kSessionStartupPrefValueMax = SessionStartupPref::kPrefValueMax; 39 const int kSessionStartupPrefValueMax = SessionStartupPref::kPrefValueMax;
40 40
41 // An unregistered preference to fill in indices in kTrackedPrefs below for
42 // preferences that aren't defined on every platform. This is fine as the code
43 // below (e.g. CheckTrackedPreferences()) skips unregistered preferences and
44 // should thus never report any data about that index on the platforms where
45 // that preference is unimplemented.
46 const char kUnregisteredPreference = "unregistered.preference";
bbudge 2013/10/15 18:56:00 I wonder if an empty string might be a better valu
gab 2013/10/15 19:09:35 Used "_" -- it's cuter ;)... but more seriously I
47
41 // These preferences must be kept in sync with the TrackedPreference enum in 48 // These preferences must be kept in sync with the TrackedPreference enum in
42 // tools/metrics/histograms/histograms.xml. To add a new preference, append it 49 // tools/metrics/histograms/histograms.xml. To add a new preference, append it
43 // to the array and add a corresponding value to the histogram enum. 50 // to the array and add a corresponding value to the histogram enum.
44 const char* kTrackedPrefs[] = { 51 const char* kTrackedPrefs[] = {
45 prefs::kShowHomeButton, 52 prefs::kShowHomeButton,
46 prefs::kHomePageIsNewTabPage, 53 prefs::kHomePageIsNewTabPage,
47 prefs::kHomePage, 54 prefs::kHomePage,
48 prefs::kRestoreOnStartup, 55 prefs::kRestoreOnStartup,
49 prefs::kURLsToRestoreOnStartup, 56 prefs::kURLsToRestoreOnStartup,
50 prefs::kExtensionsPref, 57 prefs::kExtensionsPref,
51 prefs::kGoogleServicesLastUsername, 58 prefs::kGoogleServicesLastUsername,
52 prefs::kSearchProviderOverrides, 59 prefs::kSearchProviderOverrides,
53 prefs::kDefaultSearchProviderSearchURL, 60 prefs::kDefaultSearchProviderSearchURL,
54 prefs::kDefaultSearchProviderKeyword, 61 prefs::kDefaultSearchProviderKeyword,
55 prefs::kDefaultSearchProviderName, 62 prefs::kDefaultSearchProviderName,
56 #if !defined(OS_ANDROID) 63 #if !defined(OS_ANDROID)
57 prefs::kPinnedTabs, 64 prefs::kPinnedTabs,
65 #else
66 kUnregisteredPreference,
58 #endif 67 #endif
68 prefs::kExtensionKnownDisabled,
59 }; 69 };
60 70
61 static const size_t kSHA256DigestSize = 32; 71 static const size_t kSHA256DigestSize = 32;
62 72
63 } // namespace 73 } // namespace
64 74
65 PrefMetricsService::PrefMetricsService(Profile* profile) 75 PrefMetricsService::PrefMetricsService(Profile* profile)
66 : profile_(profile), 76 : profile_(profile),
67 prefs_(profile_->GetPrefs()), 77 prefs_(profile_->GetPrefs()),
68 local_state_(g_browser_process->local_state()), 78 local_state_(g_browser_process->local_state()),
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 462 }
453 463
454 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const { 464 bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const {
455 return false; 465 return false;
456 } 466 }
457 467
458 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse( 468 content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse(
459 content::BrowserContext* context) const { 469 content::BrowserContext* context) const {
460 return chrome::GetBrowserContextRedirectedInIncognito(context); 470 return chrome::GetBrowserContextRedirectedInIncognito(context);
461 } 471 }
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698