| OLD | NEW |
| 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 "content/public/browser/render_process_host.h" | 7 #include "content/public/browser/render_process_host.h" |
| 8 #include "content/public/browser/render_view_host.h" | 8 #include "content/public/browser/render_view_host.h" |
| 9 #include "content/public/browser/user_metrics.h" | 9 #include "content/public/browser/user_metrics.h" |
| 10 #include "extensions/browser/api/extensions_api_client.h" | 10 #include "extensions/browser/api/extensions_api_client.h" |
| 11 #include "extensions/browser/guest_view/web_view/web_view_constants.h" | 11 #include "extensions/browser/guest_view/web_view/web_view_constants.h" |
| 12 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 12 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
| 13 #include "extensions/browser/guest_view/web_view/web_view_permission_helper_dele
gate.h" | 13 #include "extensions/browser/guest_view/web_view/web_view_permission_helper_dele
gate.h" |
| 14 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" | 14 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" |
| 15 | 15 |
| 16 using content::BrowserPluginGuestDelegate; | 16 using content::BrowserPluginGuestDelegate; |
| 17 using content::RenderViewHost; | 17 using content::RenderViewHost; |
| 18 | 18 |
| 19 namespace extensions { | 19 namespace extensions { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 static std::string PermissionTypeToString(WebViewPermissionType type) { | 22 static std::string PermissionTypeToString(WebViewPermissionType type) { |
| 23 switch (type) { | 23 switch (type) { |
| 24 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD: | 24 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD: |
| 25 return webview::kPermissionTypeDownload; | 25 return webview::kPermissionTypeDownload; |
| 26 case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM: | 26 case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM: |
| 27 return webview::kPermissionTypeFileSystem; | 27 return webview::kPermissionTypeFileSystem; |
| 28 case WEB_VIEW_PERMISSION_TYPE_FULLSCREEN: |
| 29 return webview::kPermissionTypeFullscreen; |
| 28 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION: | 30 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION: |
| 29 return webview::kPermissionTypeGeolocation; | 31 return webview::kPermissionTypeGeolocation; |
| 30 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: | 32 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: |
| 31 return webview::kPermissionTypeDialog; | 33 return webview::kPermissionTypeDialog; |
| 32 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN: | 34 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN: |
| 33 return webview::kPermissionTypeLoadPlugin; | 35 return webview::kPermissionTypeLoadPlugin; |
| 34 case WEB_VIEW_PERMISSION_TYPE_MEDIA: | 36 case WEB_VIEW_PERMISSION_TYPE_MEDIA: |
| 35 return webview::kPermissionTypeMedia; | 37 return webview::kPermissionTypeMedia; |
| 36 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: | 38 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: |
| 37 return webview::kPermissionTypeNewWindow; | 39 return webview::kPermissionTypeNewWindow; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 54 // have geolocation access on its own. | 56 // have geolocation access on its own. |
| 55 switch (info.permission_type) { | 57 switch (info.permission_type) { |
| 56 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD: | 58 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD: |
| 57 content::RecordAction( | 59 content::RecordAction( |
| 58 UserMetricsAction("WebView.PermissionAllow.Download")); | 60 UserMetricsAction("WebView.PermissionAllow.Download")); |
| 59 break; | 61 break; |
| 60 case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM: | 62 case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM: |
| 61 content::RecordAction( | 63 content::RecordAction( |
| 62 UserMetricsAction("WebView.PermissionAllow.FileSystem")); | 64 UserMetricsAction("WebView.PermissionAllow.FileSystem")); |
| 63 break; | 65 break; |
| 66 case WEB_VIEW_PERMISSION_TYPE_FULLSCREEN: |
| 67 content::RecordAction( |
| 68 UserMetricsAction("WebView.PermissionAllow.Fullscreen")); |
| 69 break; |
| 64 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION: | 70 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION: |
| 65 content::RecordAction( | 71 content::RecordAction( |
| 66 UserMetricsAction("WebView.PermissionAllow.Geolocation")); | 72 UserMetricsAction("WebView.PermissionAllow.Geolocation")); |
| 67 break; | 73 break; |
| 68 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: | 74 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: |
| 69 content::RecordAction( | 75 content::RecordAction( |
| 70 UserMetricsAction("WebView.PermissionAllow.JSDialog")); | 76 UserMetricsAction("WebView.PermissionAllow.JSDialog")); |
| 71 break; | 77 break; |
| 72 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN: | 78 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN: |
| 73 content::RecordAction( | 79 content::RecordAction( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 90 } else { | 96 } else { |
| 91 switch (info.permission_type) { | 97 switch (info.permission_type) { |
| 92 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD: | 98 case WEB_VIEW_PERMISSION_TYPE_DOWNLOAD: |
| 93 content::RecordAction( | 99 content::RecordAction( |
| 94 UserMetricsAction("WebView.PermissionDeny.Download")); | 100 UserMetricsAction("WebView.PermissionDeny.Download")); |
| 95 break; | 101 break; |
| 96 case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM: | 102 case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM: |
| 97 content::RecordAction( | 103 content::RecordAction( |
| 98 UserMetricsAction("WebView.PermissionDeny.FileSystem")); | 104 UserMetricsAction("WebView.PermissionDeny.FileSystem")); |
| 99 break; | 105 break; |
| 106 case WEB_VIEW_PERMISSION_TYPE_FULLSCREEN: |
| 107 content::RecordAction( |
| 108 UserMetricsAction("WebView.PermissionDeny.Fullscreen")); |
| 109 break; |
| 100 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION: | 110 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION: |
| 101 content::RecordAction( | 111 content::RecordAction( |
| 102 UserMetricsAction("WebView.PermissionDeny.Geolocation")); | 112 UserMetricsAction("WebView.PermissionDeny.Geolocation")); |
| 103 break; | 113 break; |
| 104 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: | 114 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: |
| 105 content::RecordAction( | 115 content::RecordAction( |
| 106 UserMetricsAction("WebView.PermissionDeny.JSDialog")); | 116 UserMetricsAction("WebView.PermissionDeny.JSDialog")); |
| 107 break; | 117 break; |
| 108 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN: | 118 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN: |
| 109 content::RecordAction( | 119 content::RecordAction( |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 bool allowed_by_default) | 396 bool allowed_by_default) |
| 387 : callback(callback), | 397 : callback(callback), |
| 388 permission_type(permission_type), | 398 permission_type(permission_type), |
| 389 allowed_by_default(allowed_by_default) { | 399 allowed_by_default(allowed_by_default) { |
| 390 } | 400 } |
| 391 | 401 |
| 392 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { | 402 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { |
| 393 } | 403 } |
| 394 | 404 |
| 395 } // namespace extensions | 405 } // namespace extensions |
| OLD | NEW |