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

Side by Side Diff: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.cc

Issue 2739513002: Settings reset prompt: add UMA metrics reporting. (Closed)
Patch Set: Addressed comments. Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/safe_browsing/settings_reset_prompt/settings_reset_prom pt_model.h" 5 #include "chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prom pt_model.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/metrics/histogram_macros.h"
11 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/google/google_brand.h" 13 #include "chrome/browser/google/google_brand.h"
13 #include "chrome/browser/prefs/session_startup_pref.h" 14 #include "chrome/browser/prefs/session_startup_pref.h"
14 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" 15 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h"
15 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" 16 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
16 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" 17 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prom pt_config.h" 19 #include "chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prom pt_config.h"
19 #include "chrome/browser/search_engines/template_url_service_factory.h" 20 #include "chrome/browser/search_engines/template_url_service_factory.h"
20 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler. h" 21 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler. h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 SettingsResetPromptModel::ResetState 270 SettingsResetPromptModel::ResetState
270 SettingsResetPromptModel::startup_urls_reset_state() const { 271 SettingsResetPromptModel::startup_urls_reset_state() const {
271 return startup_urls_reset_state_; 272 return startup_urls_reset_state_;
272 } 273 }
273 274
274 const SettingsResetPromptModel::ExtensionMap& 275 const SettingsResetPromptModel::ExtensionMap&
275 SettingsResetPromptModel::extensions_to_disable() const { 276 SettingsResetPromptModel::extensions_to_disable() const {
276 return extensions_to_disable_; 277 return extensions_to_disable_;
277 } 278 }
278 279
280 void SettingsResetPromptModel::ReportUmaMetrics() const {
281 UMA_HISTOGRAM_BOOLEAN("SettingsResetPrompt.PromptWanted",
282 ShouldPromptForReset());
283 UMA_HISTOGRAM_ENUMERATION("SettingsResetPrompt.DefaultSearchResetState",
284 default_search_reset_state(), RESET_STATE_MAX);
285 UMA_HISTOGRAM_ENUMERATION("SettingsResetPrompt.StartupUrlsResetState",
286 startup_urls_reset_state(), RESET_STATE_MAX);
287 UMA_HISTOGRAM_ENUMERATION("SettingsResetPrompt.HomepageResetState",
288 homepage_reset_state(), RESET_STATE_MAX);
289 UMA_HISTOGRAM_SPARSE_SLOWLY("SettingsResetPrompt.NumberOfExtensionsToDisable",
jwd 2017/03/07 18:08:37 I'm not super keen on this being sparse, since it
alito 2017/03/07 20:42:05 Changed this to a count histogram. I think that wi
290 extensions_to_disable().size());
291 UMA_HISTOGRAM_SPARSE_SLOWLY(
292 "SettingsResetPrompt.DelayBeforePromptParam",
293 prompt_config_->delay_before_prompt().InSeconds());
294 }
295
279 // static 296 // static
280 void SettingsResetPromptModel::OnSettingsFetched( 297 void SettingsResetPromptModel::OnSettingsFetched(
281 Profile* profile, 298 Profile* profile,
282 std::unique_ptr<SettingsResetPromptConfig> prompt_config, 299 std::unique_ptr<SettingsResetPromptConfig> prompt_config,
283 SettingsResetPromptModel::CreateCallback callback, 300 SettingsResetPromptModel::CreateCallback callback,
284 std::unique_ptr<BrandcodedDefaultSettings> default_settings) { 301 std::unique_ptr<BrandcodedDefaultSettings> default_settings) {
285 DCHECK(profile); 302 DCHECK(profile);
286 DCHECK(prompt_config); 303 DCHECK(prompt_config);
287 DCHECK(default_settings); 304 DCHECK(default_settings);
288 305
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 GetExtension(profile_, extension_id); 531 GetExtension(profile_, extension_id);
515 if (extension && management_policy->MustRemainEnabled(extension, nullptr)) 532 if (extension && management_policy->MustRemainEnabled(extension, nullptr))
516 return true; 533 return true;
517 } 534 }
518 } 535 }
519 536
520 return false; 537 return false;
521 } 538 }
522 539
523 } // namespace safe_browsing. 540 } // namespace safe_browsing.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698