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

Side by Side Diff: chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc

Issue 2435843002: Remove UMA collection no longer needed. (Closed)
Patch Set: Created 4 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
« 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ui/javascript_dialogs/javascript_dialog_tab_helper.h" 5 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/feature_list.h" 8 #include "base/feature_list.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "chrome/browser/engagement/site_engagement_service.h" 10 #include "chrome/browser/engagement/site_engagement_service.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 content::WebContents* alerting_web_contents, 52 content::WebContents* alerting_web_contents,
53 const GURL& origin_url, 53 const GURL& origin_url,
54 content::JavaScriptMessageType message_type, 54 content::JavaScriptMessageType message_type,
55 const base::string16& message_text, 55 const base::string16& message_text,
56 const base::string16& default_prompt_text, 56 const base::string16& default_prompt_text,
57 const DialogClosedCallback& callback, 57 const DialogClosedCallback& callback,
58 bool* did_suppress_message) { 58 bool* did_suppress_message) {
59 SiteEngagementService* site_engagement_service = SiteEngagementService::Get( 59 SiteEngagementService* site_engagement_service = SiteEngagementService::Get(
60 Profile::FromBrowserContext(alerting_web_contents->GetBrowserContext())); 60 Profile::FromBrowserContext(alerting_web_contents->GetBrowserContext()));
61 double engagement_score = site_engagement_service->GetScore(origin_url); 61 double engagement_score = site_engagement_service->GetScore(origin_url);
62 switch (message_type) {
63 case content::JAVASCRIPT_MESSAGE_TYPE_ALERT:
64 UMA_HISTOGRAM_PERCENTAGE("JSDialogs.SiteEngagementOfDialogs.Alert",
65 engagement_score);
66 break;
67 case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM:
68 UMA_HISTOGRAM_PERCENTAGE("JSDialogs.SiteEngagementOfDialogs.Confirm",
69 engagement_score);
70 break;
71 case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT:
72 UMA_HISTOGRAM_PERCENTAGE("JSDialogs.SiteEngagementOfDialogs.Prompt",
73 engagement_score);
74 break;
75 }
76 int32_t message_length = static_cast<int32_t>(message_text.length()); 62 int32_t message_length = static_cast<int32_t>(message_text.length());
77 if (engagement_score == 0) { 63 if (engagement_score == 0) {
78 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.EngagementNone", 64 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.EngagementNone",
79 message_length); 65 message_length);
80 } else if (engagement_score < 1) { 66 } else if (engagement_score < 1) {
81 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.EngagementLessThanOne", 67 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.EngagementLessThanOne",
82 message_length); 68 message_length);
83 } else if (engagement_score < 5) { 69 } else if (engagement_score < 5) {
84 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.EngagementOneToFive", 70 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.EngagementOneToFive",
85 message_length); 71 message_length);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 DCHECK(dialog_); 204 DCHECK(dialog_);
219 205
220 dialog_->CloseDialogWithoutCallback(); 206 dialog_->CloseDialogWithoutCallback();
221 if (!suppress_callback) 207 if (!suppress_callback)
222 dialog_callback_.Run(success, user_input); 208 dialog_callback_.Run(success, user_input);
223 209
224 dialog_.reset(); 210 dialog_.reset();
225 dialog_callback_.Reset(); 211 dialog_callback_.Reset();
226 BrowserList::RemoveObserver(this); 212 BrowserList::RemoveObserver(this);
227 } 213 }
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