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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_permission_helper.cc

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/guest_view/web_view/web_view_permission_helper.h" 5 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/metrics/user_metrics.h"
11 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
13 #include "components/guest_view/browser/guest_view_event.h" 14 #include "components/guest_view/browser/guest_view_event.h"
14 #include "content/public/browser/render_process_host.h" 15 #include "content/public/browser/render_process_host.h"
15 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/user_metrics.h"
17 #include "extensions/browser/api/extensions_api_client.h" 17 #include "extensions/browser/api/extensions_api_client.h"
18 #include "extensions/browser/guest_view/web_view/web_view_constants.h" 18 #include "extensions/browser/guest_view/web_view/web_view_constants.h"
19 #include "extensions/browser/guest_view/web_view/web_view_guest.h" 19 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
20 #include "extensions/browser/guest_view/web_view/web_view_permission_helper_dele gate.h" 20 #include "extensions/browser/guest_view/web_view/web_view_permission_helper_dele gate.h"
21 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" 21 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h"
22 #include "ppapi/features/features.h" 22 #include "ppapi/features/features.h"
23 23
24 using base::UserMetricsAction;
24 using content::BrowserPluginGuestDelegate; 25 using content::BrowserPluginGuestDelegate;
25 using content::RenderViewHost; 26 using content::RenderViewHost;
26 using guest_view::GuestViewEvent; 27 using guest_view::GuestViewEvent;
27 28
28 namespace extensions { 29 namespace extensions {
29 30
30 namespace { 31 namespace {
31 static std::string PermissionTypeToString(WebViewPermissionType type) { 32 static std::string PermissionTypeToString(WebViewPermissionType type) {
32 switch (type) { 33 switch (type) {
33 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD: 34 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD:
(...skipping 24 matching lines...) Expand all
58 void RecordUserInitiatedUMA( 59 void RecordUserInitiatedUMA(
59 const WebViewPermissionHelper::PermissionResponseInfo& info, 60 const WebViewPermissionHelper::PermissionResponseInfo& info,
60 bool allow) { 61 bool allow) {
61 if (allow) { 62 if (allow) {
62 // Note that |allow| == true means the embedder explicitly allowed the 63 // Note that |allow| == true means the embedder explicitly allowed the
63 // request. For some requests they might still fail. An example of such 64 // request. For some requests they might still fail. An example of such
64 // scenario would be: an embedder allows geolocation request but doesn't 65 // scenario would be: an embedder allows geolocation request but doesn't
65 // have geolocation access on its own. 66 // have geolocation access on its own.
66 switch (info.permission_type) { 67 switch (info.permission_type) {
67 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD: 68 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD:
68 content::RecordAction( 69 base::RecordAction(
69 UserMetricsAction("WebView.PermissionAllow.Download")); 70 UserMetricsAction("WebView.PermissionAllow.Download"));
70 break; 71 break;
71 case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM: 72 case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM:
72 content::RecordAction( 73 base::RecordAction(
73 UserMetricsAction("WebView.PermissionAllow.FileSystem")); 74 UserMetricsAction("WebView.PermissionAllow.FileSystem"));
74 break; 75 break;
75 case WEB_VIEW_PERMISSION_TYPE_FULLSCREEN: 76 case WEB_VIEW_PERMISSION_TYPE_FULLSCREEN:
76 content::RecordAction( 77 base::RecordAction(
77 UserMetricsAction("WebView.PermissionAllow.Fullscreen")); 78 UserMetricsAction("WebView.PermissionAllow.Fullscreen"));
78 break; 79 break;
79 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION: 80 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION:
80 content::RecordAction( 81 base::RecordAction(
81 UserMetricsAction("WebView.PermissionAllow.Geolocation")); 82 UserMetricsAction("WebView.PermissionAllow.Geolocation"));
82 break; 83 break;
83 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: 84 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG:
84 content::RecordAction( 85 base::RecordAction(
85 UserMetricsAction("WebView.PermissionAllow.JSDialog")); 86 UserMetricsAction("WebView.PermissionAllow.JSDialog"));
86 break; 87 break;
87 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN: 88 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN:
88 content::RecordAction( 89 base::RecordAction(
89 UserMetricsAction("WebView.Guest.PermissionAllow.PluginLoad")); 90 UserMetricsAction("WebView.Guest.PermissionAllow.PluginLoad"));
90 break; 91 break;
91 case WEB_VIEW_PERMISSION_TYPE_MEDIA: 92 case WEB_VIEW_PERMISSION_TYPE_MEDIA:
92 content::RecordAction( 93 base::RecordAction(UserMetricsAction("WebView.PermissionAllow.Media"));
93 UserMetricsAction("WebView.PermissionAllow.Media"));
94 break; 94 break;
95 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: 95 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW:
96 content::RecordAction( 96 base::RecordAction(
97 UserMetricsAction("BrowserPlugin.PermissionAllow.NewWindow")); 97 UserMetricsAction("BrowserPlugin.PermissionAllow.NewWindow"));
98 break; 98 break;
99 case WEB_VIEW_PERMISSION_TYPE_POINTER_LOCK: 99 case WEB_VIEW_PERMISSION_TYPE_POINTER_LOCK:
100 content::RecordAction( 100 base::RecordAction(
101 UserMetricsAction("WebView.PermissionAllow.PointerLock")); 101 UserMetricsAction("WebView.PermissionAllow.PointerLock"));
102 break; 102 break;
103 default: 103 default:
104 break; 104 break;
105 } 105 }
106 } else { 106 } else {
107 switch (info.permission_type) { 107 switch (info.permission_type) {
108 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD: 108 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD:
109 content::RecordAction( 109 base::RecordAction(
110 UserMetricsAction("WebView.PermissionDeny.Download")); 110 UserMetricsAction("WebView.PermissionDeny.Download"));
111 break; 111 break;
112 case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM: 112 case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM:
113 content::RecordAction( 113 base::RecordAction(
114 UserMetricsAction("WebView.PermissionDeny.FileSystem")); 114 UserMetricsAction("WebView.PermissionDeny.FileSystem"));
115 break; 115 break;
116 case WEB_VIEW_PERMISSION_TYPE_FULLSCREEN: 116 case WEB_VIEW_PERMISSION_TYPE_FULLSCREEN:
117 content::RecordAction( 117 base::RecordAction(
118 UserMetricsAction("WebView.PermissionDeny.Fullscreen")); 118 UserMetricsAction("WebView.PermissionDeny.Fullscreen"));
119 break; 119 break;
120 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION: 120 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION:
121 content::RecordAction( 121 base::RecordAction(
122 UserMetricsAction("WebView.PermissionDeny.Geolocation")); 122 UserMetricsAction("WebView.PermissionDeny.Geolocation"));
123 break; 123 break;
124 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: 124 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG:
125 content::RecordAction( 125 base::RecordAction(
126 UserMetricsAction("WebView.PermissionDeny.JSDialog")); 126 UserMetricsAction("WebView.PermissionDeny.JSDialog"));
127 break; 127 break;
128 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN: 128 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN:
129 content::RecordAction( 129 base::RecordAction(
130 UserMetricsAction("WebView.Guest.PermissionDeny.PluginLoad")); 130 UserMetricsAction("WebView.Guest.PermissionDeny.PluginLoad"));
131 break; 131 break;
132 case WEB_VIEW_PERMISSION_TYPE_MEDIA: 132 case WEB_VIEW_PERMISSION_TYPE_MEDIA:
133 content::RecordAction( 133 base::RecordAction(UserMetricsAction("WebView.PermissionDeny.Media"));
134 UserMetricsAction("WebView.PermissionDeny.Media"));
135 break; 134 break;
136 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: 135 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW:
137 content::RecordAction( 136 base::RecordAction(
138 UserMetricsAction("BrowserPlugin.PermissionDeny.NewWindow")); 137 UserMetricsAction("BrowserPlugin.PermissionDeny.NewWindow"));
139 break; 138 break;
140 case WEB_VIEW_PERMISSION_TYPE_POINTER_LOCK: 139 case WEB_VIEW_PERMISSION_TYPE_POINTER_LOCK:
141 content::RecordAction( 140 base::RecordAction(
142 UserMetricsAction("WebView.PermissionDeny.PointerLock")); 141 UserMetricsAction("WebView.PermissionDeny.PointerLock"));
143 break; 142 break;
144 default: 143 default:
145 break; 144 break;
146 } 145 }
147 } 146 }
148 } 147 }
149 148
150 } // namespace 149 } // namespace
151 150
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 allowed_by_default(allowed_by_default) { 404 allowed_by_default(allowed_by_default) {
406 } 405 }
407 406
408 WebViewPermissionHelper::PermissionResponseInfo::PermissionResponseInfo( 407 WebViewPermissionHelper::PermissionResponseInfo::PermissionResponseInfo(
409 const PermissionResponseInfo& other) = default; 408 const PermissionResponseInfo& other) = default;
410 409
411 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { 410 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() {
412 } 411 }
413 412
414 } // namespace extensions 413 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_permission_helper.h ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698