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

Side by Side Diff: chrome/browser/guestview/webview/webview_guest.h

Issue 69913002: Add UMA for <webview> APIs: a. ClearData, b. when Permission request is allowed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Shorten UMA string literals Created 7 years, 1 month 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 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 #ifndef CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ 5 #ifndef CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_
6 #define CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ 6 #define CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_
7 7
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "chrome/browser/extensions/tab_helper.h" 9 #include "chrome/browser/extensions/tab_helper.h"
10 #include "chrome/browser/guestview/guestview.h" 10 #include "chrome/browser/guestview/guestview.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 uint32 removal_mask, 115 uint32 removal_mask,
116 const base::Closure& callback); 116 const base::Closure& callback);
117 117
118 extensions::ScriptExecutor* script_executor() { 118 extensions::ScriptExecutor* script_executor() {
119 return script_executor_.get(); 119 return script_executor_.get();
120 } 120 }
121 121
122 private: 122 private:
123 virtual ~WebViewGuest(); 123 virtual ~WebViewGuest();
124 124
125 // A map to store the callback for a request keyed by the request's id.
126 struct PermissionResponseInfo {
127 PermissionResponseCallback callback;
128 BrowserPluginPermissionType permission_type;
129 bool allowed_by_default;
130 PermissionResponseInfo();
131 PermissionResponseInfo(const PermissionResponseCallback& callback,
132 BrowserPluginPermissionType permission_type,
133 bool allowed_by_default);
134 ~PermissionResponseInfo();
135 };
136
137 static void RecordUserInitiatedUMA(const PermissionResponseInfo& info,
138 bool allow);
125 // WebContentsObserver implementation. 139 // WebContentsObserver implementation.
126 virtual void DidCommitProvisionalLoadForFrame( 140 virtual void DidCommitProvisionalLoadForFrame(
127 int64 frame_id, 141 int64 frame_id,
128 const string16& frame_unique_name, 142 const string16& frame_unique_name,
129 bool is_main_frame, 143 bool is_main_frame,
130 const GURL& url, 144 const GURL& url,
131 content::PageTransition transition_type, 145 content::PageTransition transition_type,
132 content::RenderViewHost* render_view_host) OVERRIDE; 146 content::RenderViewHost* render_view_host) OVERRIDE;
133 virtual void DidFailProvisionalLoad( 147 virtual void DidFailProvisionalLoad(
134 int64 frame_id, 148 int64 frame_id,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 ObserverList<extensions::TabHelper::ScriptExecutionObserver> 182 ObserverList<extensions::TabHelper::ScriptExecutionObserver>
169 script_observers_; 183 script_observers_;
170 scoped_ptr<extensions::ScriptExecutor> script_executor_; 184 scoped_ptr<extensions::ScriptExecutor> script_executor_;
171 185
172 content::NotificationRegistrar notification_registrar_; 186 content::NotificationRegistrar notification_registrar_;
173 187
174 // A counter to generate a unique request id for a permission request. 188 // A counter to generate a unique request id for a permission request.
175 // We only need the ids to be unique for a given WebViewGuest. 189 // We only need the ids to be unique for a given WebViewGuest.
176 int next_permission_request_id_; 190 int next_permission_request_id_;
177 191
178 // A map to store the callback for a request keyed by the request's id.
179 struct PermissionResponseInfo {
180 PermissionResponseCallback callback;
181 bool allowed_by_default;
182 PermissionResponseInfo();
183 PermissionResponseInfo(const PermissionResponseCallback& callback,
184 bool allowed_by_default);
185 ~PermissionResponseInfo();
186 };
187 typedef std::map<int, PermissionResponseInfo> RequestMap; 192 typedef std::map<int, PermissionResponseInfo> RequestMap;
188 RequestMap pending_permission_requests_; 193 RequestMap pending_permission_requests_;
189 194
190 // True if the user agent is overridden. 195 // True if the user agent is overridden.
191 bool is_overriding_user_agent_; 196 bool is_overriding_user_agent_;
192 197
193 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); 198 DISALLOW_COPY_AND_ASSIGN(WebViewGuest);
194 }; 199 };
195 200
196 #endif // CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_ 201 #endif // CHROME_BROWSER_GUESTVIEW_WEBVIEW_WEBVIEW_GUEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/guestview/webview/plugin_permission_helper.cc ('k') | chrome/browser/guestview/webview/webview_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698