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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 2367553002: [HBD] Merge two identical ShouldUseJavaScriptSettingForPlugin impls (Closed)
Patch Set: merge origin/master Created 4 years, 3 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
« chrome/common/plugin_utils.cc ('K') | « chrome/common/plugin_utils.cc ('k') | no next file » | 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/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #include "third_party/WebKit/public/web/WebDocument.h" 108 #include "third_party/WebKit/public/web/WebDocument.h"
109 #include "third_party/WebKit/public/web/WebElement.h" 109 #include "third_party/WebKit/public/web/WebElement.h"
110 #include "third_party/WebKit/public/web/WebLocalFrame.h" 110 #include "third_party/WebKit/public/web/WebLocalFrame.h"
111 #include "third_party/WebKit/public/web/WebPluginContainer.h" 111 #include "third_party/WebKit/public/web/WebPluginContainer.h"
112 #include "third_party/WebKit/public/web/WebPluginParams.h" 112 #include "third_party/WebKit/public/web/WebPluginParams.h"
113 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 113 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
114 #include "ui/base/l10n/l10n_util.h" 114 #include "ui/base/l10n/l10n_util.h"
115 #include "ui/base/layout.h" 115 #include "ui/base/layout.h"
116 #include "ui/base/resource/resource_bundle.h" 116 #include "ui/base/resource/resource_bundle.h"
117 #include "ui/base/webui/jstemplate_builder.h" 117 #include "ui/base/webui/jstemplate_builder.h"
118 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
119 118
120 #if !defined(DISABLE_NACL) 119 #if !defined(DISABLE_NACL)
121 #include "components/nacl/common/nacl_constants.h" 120 #include "components/nacl/common/nacl_constants.h"
122 #include "components/nacl/renderer/nacl_helper.h" 121 #include "components/nacl/renderer/nacl_helper.h"
123 #endif 122 #endif
124 123
125 #if defined(ENABLE_EXTENSIONS) 124 #if defined(ENABLE_EXTENSIONS)
126 #include "chrome/common/extensions/chrome_extensions_client.h" 125 #include "chrome/common/extensions/chrome_extensions_client.h"
127 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" 126 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h"
128 #include "extensions/common/extension_urls.h" 127 #include "extensions/common/extension_urls.h"
129 #include "extensions/common/switches.h" 128 #include "extensions/common/switches.h"
130 #include "extensions/renderer/dispatcher.h" 129 #include "extensions/renderer/dispatcher.h"
131 #include "extensions/renderer/renderer_extension_registry.h" 130 #include "extensions/renderer/renderer_extension_registry.h"
132 #endif 131 #endif
133 132
134 #if defined(ENABLE_PLUGINS) 133 #if defined(ENABLE_PLUGINS)
134 #include "chrome/common/plugin_utils.h"
135 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" 135 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h"
136 #include "chrome/renderer/plugins/power_saver_info.h" 136 #include "chrome/renderer/plugins/power_saver_info.h"
137 #endif 137 #endif
138 138
139 #if defined(ENABLE_PRINTING) 139 #if defined(ENABLE_PRINTING)
140 #include "chrome/common/chrome_content_client.h" 140 #include "chrome/common/chrome_content_client.h"
141 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h" 141 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h"
142 #include "components/printing/renderer/print_web_view_helper.h" 142 #include "components/printing/renderer/print_web_view_helper.h"
143 #include "printing/print_settings.h" 143 #include "printing/print_settings.h"
144 #endif 144 #endif
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 228 }
229 229
230 for (size_t i = 0; i < additional_names.size(); ++i) { 230 for (size_t i = 0; i < additional_names.size(); ++i) {
231 names[existing_size + i] = additional_names[i]; 231 names[existing_size + i] = additional_names[i];
232 values[existing_size + i] = additional_values[i]; 232 values[existing_size + i] = additional_values[i];
233 } 233 }
234 234
235 existing_names->swap(names); 235 existing_names->swap(names);
236 existing_values->swap(values); 236 existing_values->swap(values);
237 } 237 }
238
239 // For certain sandboxed Pepper plugins, use the JavaScript Content Settings.
240 bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) {
241 if (plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS &&
242 plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS) {
243 return false;
244 }
245
246 #if !defined(DISABLE_NACL)
247 // Treat Native Client invocations like JavaScript.
248 if (plugin.name == ASCIIToUTF16(nacl::kNaClPluginName))
249 return true;
250 #endif
251
252 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
253 // Treat CDM invocations like JavaScript.
254 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) {
255 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS);
256 return true;
257 }
258 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
259
260 return false;
261 }
262 #endif // defined(ENABLE_PLUGINS) 238 #endif // defined(ENABLE_PLUGINS)
263 239
264 #if defined(ENABLE_SPELLCHECK) 240 #if defined(ENABLE_SPELLCHECK)
265 class SpellCheckReplacer : public content::RenderViewVisitor { 241 class SpellCheckReplacer : public content::RenderViewVisitor {
266 public: 242 public:
267 explicit SpellCheckReplacer(SpellCheck* spellcheck) 243 explicit SpellCheckReplacer(SpellCheck* spellcheck)
268 : spellcheck_(spellcheck) {} 244 : spellcheck_(spellcheck) {}
269 bool Visit(content::RenderView* render_view) override; 245 bool Visit(content::RenderView* render_view) override;
270 246
271 private: 247 private:
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 1455
1480 url::Replacements<char> r; 1456 url::Replacements<char> r;
1481 r.SetPath(path.c_str(), url::Component(0, path.length())); 1457 r.SetPath(path.c_str(), url::Component(0, path.length()));
1482 1458
1483 if (result == internal::NUM_PLUGIN_ERROR) 1459 if (result == internal::NUM_PLUGIN_ERROR)
1484 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; 1460 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS;
1485 1461
1486 RecordYouTubeRewriteUMA(result); 1462 RecordYouTubeRewriteUMA(result);
1487 return corrected_url.ReplaceComponents(r); 1463 return corrected_url.ReplaceComponents(r);
1488 } 1464 }
OLDNEW
« chrome/common/plugin_utils.cc ('K') | « chrome/common/plugin_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698