OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_utils.h" | 5 #include "chrome/browser/plugins/plugin_utils.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | |
8 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/common/plugin_utils.h" |
9 #include "components/content_settings/core/browser/host_content_settings_map.h" | 9 #include "components/content_settings/core/browser/host_content_settings_map.h" |
10 #include "content/public/common/webplugininfo.h" | 10 #include "content/public/common/webplugininfo.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | |
13 | |
14 #if !defined(DISABLE_NACL) | |
15 #include "components/nacl/common/nacl_constants.h" | |
16 #endif | |
17 | 12 |
18 namespace { | 13 namespace { |
19 | 14 |
20 const char kFlashPluginID[] = "adobe-flash-player"; | 15 const char kFlashPluginID[] = "adobe-flash-player"; |
21 | 16 |
22 // For certain sandboxed Pepper plugins, use the JavaScript Content Settings. | |
23 bool ShouldUseJavaScriptSettingForPlugin(const content::WebPluginInfo& plugin) { | |
24 if (plugin.type != content::WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS && | |
25 plugin.type != | |
26 content::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS) { | |
27 return false; | |
28 } | |
29 | |
30 #if !defined(DISABLE_NACL) | |
31 // Treat Native Client invocations like JavaScript. | |
32 if (plugin.name == base::ASCIIToUTF16(nacl::kNaClPluginName)) | |
33 return true; | |
34 #endif | |
35 | |
36 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) | |
37 // Treat CDM invocations like JavaScript. | |
38 if (plugin.name == base::ASCIIToUTF16(kWidevineCdmDisplayName)) { | |
39 DCHECK_EQ(content::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS, | |
40 plugin.type); | |
41 return true; | |
42 } | |
43 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) | |
44 | |
45 return false; | |
46 } | |
47 | |
48 void GetPluginContentSettingInternal( | 17 void GetPluginContentSettingInternal( |
49 const HostContentSettingsMap* host_content_settings_map, | 18 const HostContentSettingsMap* host_content_settings_map, |
50 bool use_javascript_setting, | 19 bool use_javascript_setting, |
51 const GURL& policy_url, | 20 const GURL& policy_url, |
52 const GURL& plugin_url, | 21 const GURL& plugin_url, |
53 const std::string& resource, | 22 const std::string& resource, |
54 ContentSetting* setting, | 23 ContentSetting* setting, |
55 bool* uses_default_content_setting, | 24 bool* uses_default_content_setting, |
56 bool* is_managed) { | 25 bool* is_managed) { |
57 std::unique_ptr<base::Value> value; | 26 std::unique_ptr<base::Value> value; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 ContentSetting PluginUtils::GetFlashPluginContentSetting( | 87 ContentSetting PluginUtils::GetFlashPluginContentSetting( |
119 const HostContentSettingsMap* host_content_settings_map, | 88 const HostContentSettingsMap* host_content_settings_map, |
120 const GURL& policy_url, | 89 const GURL& policy_url, |
121 const GURL& plugin_url) { | 90 const GURL& plugin_url) { |
122 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; | 91 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; |
123 GetPluginContentSettingInternal( | 92 GetPluginContentSettingInternal( |
124 host_content_settings_map, false /* use_javascript_setting */, policy_url, | 93 host_content_settings_map, false /* use_javascript_setting */, policy_url, |
125 plugin_url, kFlashPluginID, &plugin_setting, nullptr, nullptr); | 94 plugin_url, kFlashPluginID, &plugin_setting, nullptr, nullptr); |
126 return plugin_setting; | 95 return plugin_setting; |
127 } | 96 } |
OLD | NEW |