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

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

Issue 2543793003: Add UMA metrics to measure the dismissal cause of dialogs. (Closed)
Patch Set: Created 4 years 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 | chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc » ('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 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 bool reset_state) override; 59 bool reset_state) override;
60 60
61 // WebContentsObserver: 61 // WebContentsObserver:
62 void WasHidden() override; 62 void WasHidden() override;
63 63
64 // BrowserListObserver: 64 // BrowserListObserver:
65 void OnBrowserSetLastActive(Browser* browser) override; 65 void OnBrowserSetLastActive(Browser* browser) override;
66 66
67 private: 67 private:
68 friend class content::WebContentsUserData<JavaScriptDialogTabHelper>; 68 friend class content::WebContentsUserData<JavaScriptDialogTabHelper>;
69 enum class DismissalCause;
70
71 void LogDialogDismissalCause(DismissalCause cause);
69 72
70 // Wrapper around a DialogClosedCallback so that we can intercept it before 73 // Wrapper around a DialogClosedCallback so that we can intercept it before
71 // passing it onto the original callback. 74 // passing it onto the original callback.
72 void OnDialogClosed(DialogClosedCallback callback, 75 void OnDialogClosed(DialogClosedCallback callback,
73 bool success, 76 bool success,
74 const base::string16& user_input); 77 const base::string16& user_input);
75 78
76 void CloseDialog(bool suppress_callback, 79 void CloseDialog(bool suppress_callback,
77 bool success, 80 bool success,
78 const base::string16& user_input); 81 const base::string16& user_input,
82 DismissalCause cause);
79 83
80 void ClearDialogInfo(); 84 void ClearDialogInfo();
81 85
82 // The dialog being displayed on the observed WebContents. 86 // The dialog being displayed on the observed WebContents.
83 base::WeakPtr<JavaScriptDialog> dialog_; 87 base::WeakPtr<JavaScriptDialog> dialog_;
84 88
89 // The type of dialog being displayed. Only valid when |dialog_| is non-null.
90 content::JavaScriptMessageType message_type_ =
91 content::JavaScriptMessageType::JAVASCRIPT_MESSAGE_TYPE_ALERT;
92
85 // The callback provided for when the dialog is closed. Usually the dialog 93 // The callback provided for when the dialog is closed. Usually the dialog
86 // itself calls it, but in the cases where the dialog is closed not by the 94 // itself calls it, but in the cases where the dialog is closed not by the
87 // user's input but by a call to |CloseDialog|, this class will call it. 95 // user's input but by a call to |CloseDialog|, this class will call it.
88 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_; 96 content::JavaScriptDialogManager::DialogClosedCallback dialog_callback_;
89 97
90 base::Closure dialog_shown_; 98 base::Closure dialog_shown_;
91 99
92 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper); 100 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogTabHelper);
93 }; 101 };
94 102
95 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_ 103 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698