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

Side by Side Diff: chrome/browser/plugins/plugin_info_message_filter.cc

Issue 2378573005: [HBD] Blanket BLOCK on all non-HTTP(s) and non-FILE URLs for Flash. (Closed)
Patch Set: fix formatting Created 4 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/plugins/plugin_info_message_filter.h" 5 #include "chrome/browser/plugins/plugin_info_message_filter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 24 matching lines...) Expand all
35 #include "components/content_settings/core/browser/host_content_settings_map.h" 35 #include "components/content_settings/core/browser/host_content_settings_map.h"
36 #include "components/content_settings/core/common/content_settings.h" 36 #include "components/content_settings/core/common/content_settings.h"
37 #include "components/prefs/pref_service.h" 37 #include "components/prefs/pref_service.h"
38 #include "components/rappor/rappor_service.h" 38 #include "components/rappor/rappor_service.h"
39 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
40 #include "content/public/browser/plugin_service.h" 40 #include "content/public/browser/plugin_service.h"
41 #include "content/public/browser/plugin_service_filter.h" 41 #include "content/public/browser/plugin_service_filter.h"
42 #include "content/public/common/content_constants.h" 42 #include "content/public/common/content_constants.h"
43 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 43 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
44 #include "url/gurl.h" 44 #include "url/gurl.h"
45 #include "url/origin.h"
45 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 46 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
46 47
47 #if defined(ENABLE_EXTENSIONS) 48 #if defined(ENABLE_EXTENSIONS)
48 #include "components/guest_view/browser/guest_view_base.h" 49 #include "components/guest_view/browser/guest_view_base.h"
49 #include "extensions/browser/extension_registry.h" 50 #include "extensions/browser/extension_registry.h"
50 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" 51 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
51 #include "extensions/common/constants.h" 52 #include "extensions/common/constants.h"
52 #include "extensions/common/extension.h" 53 #include "extensions/common/extension.h"
53 #include "extensions/common/manifest_handlers/webview_info.h" 54 #include "extensions/common/manifest_handlers/webview_info.h"
54 #endif 55 #endif
(...skipping 27 matching lines...) Expand all
82 status, PLUGIN_AVAILABILITY_STATUS_MAX); 83 status, PLUGIN_AVAILABILITY_STATUS_MAX);
83 #endif // defined(WIDEVINE_CDM_AVAILABLE) 84 #endif // defined(WIDEVINE_CDM_AVAILABLE)
84 } 85 }
85 86
86 #endif // defined(ENABLE_PEPPER_CDMS) 87 #endif // defined(ENABLE_PEPPER_CDMS)
87 88
88 // Report usage metrics for Silverlight and Flash plugin instantiations to the 89 // Report usage metrics for Silverlight and Flash plugin instantiations to the
89 // RAPPOR service. 90 // RAPPOR service.
90 void ReportMetrics(const std::string& mime_type, 91 void ReportMetrics(const std::string& mime_type,
91 const GURL& url, 92 const GURL& url,
92 const GURL& origin_url) { 93 const url::Origin& top_origin) {
93 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 94 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
94 95
95 if (chrome::IsIncognitoSessionActive()) 96 if (chrome::IsIncognitoSessionActive())
96 return; 97 return;
97 rappor::RapporService* rappor_service = g_browser_process->rappor_service(); 98 rappor::RapporService* rappor_service = g_browser_process->rappor_service();
98 if (!rappor_service) 99 if (!rappor_service)
99 return; 100 return;
101 if (top_origin.unique())
102 return;
100 103
101 if (mime_type == content::kFlashPluginSwfMimeType || 104 if (mime_type == content::kFlashPluginSwfMimeType ||
102 mime_type == content::kFlashPluginSplMimeType) { 105 mime_type == content::kFlashPluginSplMimeType) {
103 rappor_service->RecordSample( 106 rappor_service->RecordSample(
104 "Plugins.FlashOriginUrl", rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, 107 "Plugins.FlashOriginUrl", rappor::ETLD_PLUS_ONE_RAPPOR_TYPE,
105 net::registry_controlled_domains::GetDomainAndRegistry( 108 net::registry_controlled_domains::GetDomainAndRegistry(
106 origin_url, 109 GURL(top_origin.Serialize()),
107 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); 110 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES));
108 rappor_service->RecordSample( 111 rappor_service->RecordSample(
109 "Plugins.FlashUrl", rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, 112 "Plugins.FlashUrl", rappor::ETLD_PLUS_ONE_RAPPOR_TYPE,
110 net::registry_controlled_domains::GetDomainAndRegistry( 113 net::registry_controlled_domains::GetDomainAndRegistry(
111 url, 114 url,
112 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); 115 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES));
113 } 116 }
114 } 117 }
115 118
116 #if defined(ENABLE_EXTENSIONS) 119 #if defined(ENABLE_EXTENSIONS)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 203
201 // Destroy on the UI thread because we contain a |PrefMember|. 204 // Destroy on the UI thread because we contain a |PrefMember|.
202 content::BrowserThread::DeleteOnUIThread::Destruct(this); 205 content::BrowserThread::DeleteOnUIThread::Destruct(this);
203 } 206 }
204 207
205 PluginInfoMessageFilter::~PluginInfoMessageFilter() {} 208 PluginInfoMessageFilter::~PluginInfoMessageFilter() {}
206 209
207 struct PluginInfoMessageFilter::GetPluginInfo_Params { 210 struct PluginInfoMessageFilter::GetPluginInfo_Params {
208 int render_frame_id; 211 int render_frame_id;
209 GURL url; 212 GURL url;
210 GURL top_origin_url; 213 url::Origin top_origin_url;
nasko 2016/09/30 20:38:48 This variable is no longer an URL.
tommycli 2016/09/30 21:20:41 Done.
211 std::string mime_type; 214 std::string mime_type;
212 }; 215 };
213 216
214 void PluginInfoMessageFilter::OnGetPluginInfo( 217 void PluginInfoMessageFilter::OnGetPluginInfo(int render_frame_id,
215 int render_frame_id, 218 const GURL& url,
216 const GURL& url, 219 const url::Origin& top_origin_url,
nasko 2016/09/30 20:38:48 Not an URL
tommycli 2016/09/30 21:20:41 Done.
217 const GURL& top_origin_url, 220 const std::string& mime_type,
218 const std::string& mime_type, 221 IPC::Message* reply_msg) {
219 IPC::Message* reply_msg) {
220 GetPluginInfo_Params params = { 222 GetPluginInfo_Params params = {
221 render_frame_id, 223 render_frame_id,
222 url, 224 url,
223 top_origin_url, 225 top_origin_url,
224 mime_type 226 mime_type
225 }; 227 };
226 PluginService::GetInstance()->GetPlugins( 228 PluginService::GetInstance()->GetPlugins(
227 base::Bind(&PluginInfoMessageFilter::PluginsLoaded, 229 base::Bind(&PluginInfoMessageFilter::PluginsLoaded,
228 weak_ptr_factory_.GetWeakPtr(), 230 weak_ptr_factory_.GetWeakPtr(),
229 params, reply_msg)); 231 params, reply_msg));
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 if (extensions::WebViewRendererState::GetInstance()->IsGuest( 392 if (extensions::WebViewRendererState::GetInstance()->IsGuest(
391 render_process_id_)) 393 render_process_id_))
392 *status = ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized; 394 *status = ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized;
393 } 395 }
394 #endif 396 #endif
395 } 397 }
396 398
397 bool PluginInfoMessageFilter::Context::FindEnabledPlugin( 399 bool PluginInfoMessageFilter::Context::FindEnabledPlugin(
398 int render_frame_id, 400 int render_frame_id,
399 const GURL& url, 401 const GURL& url,
400 const GURL& top_origin_url, 402 const url::Origin& top_origin_url,
401 const std::string& mime_type, 403 const std::string& mime_type,
402 ChromeViewHostMsg_GetPluginInfo_Status* status, 404 ChromeViewHostMsg_GetPluginInfo_Status* status,
403 WebPluginInfo* plugin, 405 WebPluginInfo* plugin,
404 std::string* actual_mime_type, 406 std::string* actual_mime_type,
405 std::unique_ptr<PluginMetadata>* plugin_metadata) const { 407 std::unique_ptr<PluginMetadata>* plugin_metadata) const {
406 *status = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed; 408 *status = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed;
407 409
408 bool allow_wildcard = true; 410 bool allow_wildcard = true;
409 std::vector<WebPluginInfo> matching_plugins; 411 std::vector<WebPluginInfo> matching_plugins;
410 std::vector<std::string> mime_types; 412 std::vector<std::string> mime_types;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 status == ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) { 512 status == ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) {
511 ChromePluginServiceFilter::GetInstance()->AuthorizePlugin( 513 ChromePluginServiceFilter::GetInstance()->AuthorizePlugin(
512 render_process_id_, path); 514 render_process_id_, path);
513 } 515 }
514 } 516 }
515 517
516 bool PluginInfoMessageFilter::Context::IsPluginEnabled( 518 bool PluginInfoMessageFilter::Context::IsPluginEnabled(
517 const content::WebPluginInfo& plugin) const { 519 const content::WebPluginInfo& plugin) const {
518 return plugin_prefs_->IsPluginEnabled(plugin); 520 return plugin_prefs_->IsPluginEnabled(plugin);
519 } 521 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698