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 "chrome/browser/guest_view/web_view/plugin_permission_helper.h" | 5 #include "chrome/browser/guest_view/web_view/plugin_permission_helper.h" |
6 | 6 |
7 #include "chrome/browser/guest_view/web_view/web_view_guest.h" | 7 #include "chrome/browser/guest_view/web_view/web_view_guest.h" |
8 #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" | 8 #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" |
9 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 9 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 const char kPluginName[] = "name"; | 66 const char kPluginName[] = "name"; |
67 const char kPluginIdentifier[] = "identifier"; | 67 const char kPluginIdentifier[] = "identifier"; |
68 | 68 |
69 WebViewGuest* webview = WebViewGuest::FromWebContents(web_contents()); | 69 WebViewGuest* webview = WebViewGuest::FromWebContents(web_contents()); |
70 if (!webview) | 70 if (!webview) |
71 return; | 71 return; |
72 | 72 |
73 base::DictionaryValue info; | 73 base::DictionaryValue info; |
74 info.SetString(std::string(kPluginName), name); | 74 info.SetString(std::string(kPluginName), name); |
75 info.SetString(std::string(kPluginIdentifier), identifier); | 75 info.SetString(std::string(kPluginIdentifier), identifier); |
76 webview->RequestPermission(static_cast<BrowserPluginPermissionType>( | 76 webview->RequestPermission( |
77 WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN), | 77 WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN, |
78 info, | 78 info, |
79 base::Bind(&PluginPermissionHelper::OnPermissionResponse, | 79 base::Bind(&PluginPermissionHelper::OnPermissionResponse, |
80 weak_factory_.GetWeakPtr(), | 80 weak_factory_.GetWeakPtr(), |
81 identifier), | 81 identifier), |
82 true /* allowed_by_default */); | 82 true /* allowed_by_default */); |
83 content::RecordAction( | 83 content::RecordAction( |
84 base::UserMetricsAction("WebView.Guest.PluginLoadRequest")); | 84 base::UserMetricsAction("WebView.Guest.PluginLoadRequest")); |
85 } | 85 } |
86 | 86 |
87 void PluginPermissionHelper::OnCouldNotLoadPlugin( | 87 void PluginPermissionHelper::OnCouldNotLoadPlugin( |
(...skipping 22 matching lines...) Expand all Loading... |
110 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 110 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
111 | 111 |
112 void PluginPermissionHelper::OnPermissionResponse(const std::string& identifier, | 112 void PluginPermissionHelper::OnPermissionResponse(const std::string& identifier, |
113 bool allow, | 113 bool allow, |
114 const std::string& input) { | 114 const std::string& input) { |
115 if (allow) { | 115 if (allow) { |
116 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( | 116 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( |
117 web_contents(), true, identifier); | 117 web_contents(), true, identifier); |
118 } | 118 } |
119 } | 119 } |
OLD | NEW |