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

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

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

Powered by Google App Engine
This is Rietveld 408576698