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

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

Issue 2412493003: Revert of Move ENABLE_PEPPER_CDMS to a buildflag header. (Closed)
Patch Set: 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
« no previous file with comments | « chrome/browser/plugins/plugin_info_message_filter.h ('k') | chrome/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23 matching lines...) Expand all
34 #include "components/content_settings/core/browser/content_settings_utils.h" 34 #include "components/content_settings/core/browser/content_settings_utils.h"
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 "ppapi/features/features.h"
45 #include "url/gurl.h" 44 #include "url/gurl.h"
46 #include "url/origin.h" 45 #include "url/origin.h"
47 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 46 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
48 47
49 #if defined(ENABLE_EXTENSIONS) 48 #if defined(ENABLE_EXTENSIONS)
50 #include "components/guest_view/browser/guest_view_base.h" 49 #include "components/guest_view/browser/guest_view_base.h"
51 #include "extensions/browser/extension_registry.h" 50 #include "extensions/browser/extension_registry.h"
52 #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"
53 #include "extensions/common/constants.h" 52 #include "extensions/common/constants.h"
54 #include "extensions/common/extension.h" 53 #include "extensions/common/extension.h"
55 #include "extensions/common/manifest_handlers/webview_info.h" 54 #include "extensions/common/manifest_handlers/webview_info.h"
56 #endif 55 #endif
57 56
58 #if !defined(DISABLE_NACL) 57 #if !defined(DISABLE_NACL)
59 #include "components/nacl/common/nacl_constants.h" 58 #include "components/nacl/common/nacl_constants.h"
60 #endif 59 #endif
61 60
62 using content::PluginService; 61 using content::PluginService;
63 using content::WebPluginInfo; 62 using content::WebPluginInfo;
64 63
65 namespace { 64 namespace {
66 65
67 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 66 #if defined(ENABLE_PEPPER_CDMS)
68 67
69 enum PluginAvailabilityStatusForUMA { 68 enum PluginAvailabilityStatusForUMA {
70 PLUGIN_NOT_REGISTERED, 69 PLUGIN_NOT_REGISTERED,
71 PLUGIN_AVAILABLE, 70 PLUGIN_AVAILABLE,
72 PLUGIN_DISABLED, 71 PLUGIN_DISABLED,
73 PLUGIN_AVAILABILITY_STATUS_MAX 72 PLUGIN_AVAILABILITY_STATUS_MAX
74 }; 73 };
75 74
76 static void SendPluginAvailabilityUMA(const std::string& mime_type, 75 static void SendPluginAvailabilityUMA(const std::string& mime_type,
77 PluginAvailabilityStatusForUMA status) { 76 PluginAvailabilityStatusForUMA status) {
78 #if defined(WIDEVINE_CDM_AVAILABLE) 77 #if defined(WIDEVINE_CDM_AVAILABLE)
79 // Only report results for Widevine CDM. 78 // Only report results for Widevine CDM.
80 if (mime_type != kWidevineCdmPluginMimeType) 79 if (mime_type != kWidevineCdmPluginMimeType)
81 return; 80 return;
82 81
83 UMA_HISTOGRAM_ENUMERATION("Plugin.AvailabilityStatus.WidevineCdm", 82 UMA_HISTOGRAM_ENUMERATION("Plugin.AvailabilityStatus.WidevineCdm",
84 status, PLUGIN_AVAILABILITY_STATUS_MAX); 83 status, PLUGIN_AVAILABILITY_STATUS_MAX);
85 #endif // defined(WIDEVINE_CDM_AVAILABLE) 84 #endif // defined(WIDEVINE_CDM_AVAILABLE)
86 } 85 }
87 86
88 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 87 #endif // defined(ENABLE_PEPPER_CDMS)
89 88
90 // Report usage metrics for Silverlight and Flash plugin instantiations to the 89 // Report usage metrics for Silverlight and Flash plugin instantiations to the
91 // RAPPOR service. 90 // RAPPOR service.
92 void ReportMetrics(const std::string& mime_type, 91 void ReportMetrics(const std::string& mime_type,
93 const GURL& url, 92 const GURL& url,
94 const url::Origin& main_frame_origin) { 93 const url::Origin& main_frame_origin) {
95 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 94 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
96 95
97 if (chrome::IsIncognitoSessionActive()) 96 if (chrome::IsIncognitoSessionActive())
98 return; 97 return;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 : BrowserMessageFilter(ChromeMsgStart), 180 : BrowserMessageFilter(ChromeMsgStart),
182 context_(render_process_id, profile), 181 context_(render_process_id, profile),
183 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), 182 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
184 weak_ptr_factory_(this) { 183 weak_ptr_factory_(this) {
185 } 184 }
186 185
187 bool PluginInfoMessageFilter::OnMessageReceived(const IPC::Message& message) { 186 bool PluginInfoMessageFilter::OnMessageReceived(const IPC::Message& message) {
188 IPC_BEGIN_MESSAGE_MAP(PluginInfoMessageFilter, message) 187 IPC_BEGIN_MESSAGE_MAP(PluginInfoMessageFilter, message)
189 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_GetPluginInfo, 188 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_GetPluginInfo,
190 OnGetPluginInfo) 189 OnGetPluginInfo)
191 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 190 #if defined(ENABLE_PEPPER_CDMS)
192 IPC_MESSAGE_HANDLER( 191 IPC_MESSAGE_HANDLER(
193 ChromeViewHostMsg_IsInternalPluginAvailableForMimeType, 192 ChromeViewHostMsg_IsInternalPluginAvailableForMimeType,
194 OnIsInternalPluginAvailableForMimeType) 193 OnIsInternalPluginAvailableForMimeType)
195 #endif 194 #endif
196 IPC_MESSAGE_UNHANDLED(return false) 195 IPC_MESSAGE_UNHANDLED(return false)
197 IPC_END_MESSAGE_MAP() 196 IPC_END_MESSAGE_MAP()
198 return true; 197 return true;
199 } 198 }
200 199
201 void PluginInfoMessageFilter::OnDestruct() const { 200 void PluginInfoMessageFilter::OnDestruct() const {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 params.mime_type), 254 params.mime_type),
256 base::Bind(&PluginInfoMessageFilter::ComponentPluginLookupDone, this, 255 base::Bind(&PluginInfoMessageFilter::ComponentPluginLookupDone, this,
257 params, base::Passed(&output), 256 params, base::Passed(&output),
258 base::Passed(&plugin_metadata), reply_msg)); 257 base::Passed(&plugin_metadata), reply_msg));
259 } else { 258 } else {
260 GetPluginInfoReply(params, std::move(output), std::move(plugin_metadata), 259 GetPluginInfoReply(params, std::move(output), std::move(plugin_metadata),
261 reply_msg); 260 reply_msg);
262 } 261 }
263 } 262 }
264 263
265 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 264 #if defined(ENABLE_PEPPER_CDMS)
266 265
267 void PluginInfoMessageFilter::OnIsInternalPluginAvailableForMimeType( 266 void PluginInfoMessageFilter::OnIsInternalPluginAvailableForMimeType(
268 const std::string& mime_type, 267 const std::string& mime_type,
269 bool* is_available, 268 bool* is_available,
270 std::vector<base::string16>* additional_param_names, 269 std::vector<base::string16>* additional_param_names,
271 std::vector<base::string16>* additional_param_values) { 270 std::vector<base::string16>* additional_param_values) {
272 std::vector<WebPluginInfo> plugins; 271 std::vector<WebPluginInfo> plugins;
273 PluginService::GetInstance()->GetInternalPlugins(&plugins); 272 PluginService::GetInstance()->GetInternalPlugins(&plugins);
274 273
275 bool is_plugin_disabled = false; 274 bool is_plugin_disabled = false;
(...skipping 15 matching lines...) Expand all
291 return; 290 return;
292 } 291 }
293 } 292 }
294 } 293 }
295 294
296 *is_available = false; 295 *is_available = false;
297 SendPluginAvailabilityUMA( 296 SendPluginAvailabilityUMA(
298 mime_type, is_plugin_disabled ? PLUGIN_DISABLED : PLUGIN_NOT_REGISTERED); 297 mime_type, is_plugin_disabled ? PLUGIN_DISABLED : PLUGIN_NOT_REGISTERED);
299 } 298 }
300 299
301 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 300 #endif // defined(ENABLE_PEPPER_CDMS)
302 301
303 void PluginInfoMessageFilter::Context::DecidePluginStatus( 302 void PluginInfoMessageFilter::Context::DecidePluginStatus(
304 const GetPluginInfo_Params& params, 303 const GetPluginInfo_Params& params,
305 const WebPluginInfo& plugin, 304 const WebPluginInfo& plugin,
306 const PluginMetadata* plugin_metadata, 305 const PluginMetadata* plugin_metadata,
307 ChromeViewHostMsg_GetPluginInfo_Status* status) const { 306 ChromeViewHostMsg_GetPluginInfo_Status* status) const {
308 PluginMetadata::SecurityStatus plugin_status = 307 PluginMetadata::SecurityStatus plugin_status =
309 plugin_metadata->GetSecurityStatus(plugin); 308 plugin_metadata->GetSecurityStatus(plugin);
310 309
311 if (plugin_status == PluginMetadata::SECURITY_STATUS_FULLY_TRUSTED) { 310 if (plugin_status == PluginMetadata::SECURITY_STATUS_FULLY_TRUSTED) {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 status == ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) { 507 status == ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) {
509 ChromePluginServiceFilter::GetInstance()->AuthorizePlugin( 508 ChromePluginServiceFilter::GetInstance()->AuthorizePlugin(
510 render_process_id_, path); 509 render_process_id_, path);
511 } 510 }
512 } 511 }
513 512
514 bool PluginInfoMessageFilter::Context::IsPluginEnabled( 513 bool PluginInfoMessageFilter::Context::IsPluginEnabled(
515 const content::WebPluginInfo& plugin) const { 514 const content::WebPluginInfo& plugin) const {
516 return plugin_prefs_->IsPluginEnabled(plugin); 515 return plugin_prefs_->IsPluginEnabled(plugin);
517 } 516 }
OLDNEW
« no previous file with comments | « chrome/browser/plugins/plugin_info_message_filter.h ('k') | chrome/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698