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

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

Issue 24544004: Remove the chrome namespace around ChromeContent[Renderer]Client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 1 month 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 | Annotate | Revision Log
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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 using WebKit::WebURLError; 131 using WebKit::WebURLError;
132 using WebKit::WebURLRequest; 132 using WebKit::WebURLRequest;
133 using WebKit::WebURLResponse; 133 using WebKit::WebURLResponse;
134 using WebKit::WebVector; 134 using WebKit::WebVector;
135 135
136 namespace { 136 namespace {
137 137
138 const char kWebViewTagName[] = "WEBVIEW"; 138 const char kWebViewTagName[] = "WEBVIEW";
139 const char kAdViewTagName[] = "ADVIEW"; 139 const char kAdViewTagName[] = "ADVIEW";
140 140
141 chrome::ChromeContentRendererClient* g_current_client; 141 ChromeContentRendererClient* g_current_client;
142 142
143 static void AppendParams(const std::vector<string16>& additional_names, 143 static void AppendParams(const std::vector<string16>& additional_names,
144 const std::vector<string16>& additional_values, 144 const std::vector<string16>& additional_values,
145 WebVector<WebString>* existing_names, 145 WebVector<WebString>* existing_names,
146 WebVector<WebString>* existing_values) { 146 WebVector<WebString>* existing_values) {
147 DCHECK(additional_names.size() == additional_values.size()); 147 DCHECK(additional_names.size() == additional_values.size());
148 DCHECK(existing_names->size() == existing_values->size()); 148 DCHECK(existing_names->size() == existing_values->size());
149 149
150 size_t existing_size = existing_names->size(); 150 size_t existing_size = existing_names->size();
151 size_t total_size = existing_size + additional_names.size(); 151 size_t total_size = existing_size + additional_names.size();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 #endif 188 #endif
189 189
190 // For certain sandboxed Pepper plugins, use the JavaScript Content Settings. 190 // For certain sandboxed Pepper plugins, use the JavaScript Content Settings.
191 bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) { 191 bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) {
192 if (plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS && 192 if (plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS &&
193 plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS) { 193 plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS) {
194 return false; 194 return false;
195 } 195 }
196 196
197 // Treat Native Client invocations like JavaScript. 197 // Treat Native Client invocations like JavaScript.
198 if (plugin.name == ASCIIToUTF16(chrome::ChromeContentClient::kNaClPluginName)) 198 if (plugin.name == ASCIIToUTF16(ChromeContentClient::kNaClPluginName))
199 return true; 199 return true;
200 200
201 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) 201 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
202 // Treat CDM invocations like JavaScript. 202 // Treat CDM invocations like JavaScript.
203 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) { 203 if (plugin.name == ASCIIToUTF16(kWidevineCdmDisplayName)) {
204 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); 204 DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS);
205 return true; 205 return true;
206 } 206 }
207 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) 207 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
208 208
209 return false; 209 return false;
210 } 210 }
211 211
212 #if defined(ENABLE_PLUGINS) 212 #if defined(ENABLE_PLUGINS)
213 const char* kPredefinedAllowedFileHandleOrigins[] = { 213 const char* kPredefinedAllowedFileHandleOrigins[] = {
214 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789 214 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789
215 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789 215 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789
216 }; 216 };
217 #endif 217 #endif
218 218
219 } // namespace 219 } // namespace
220 220
221 namespace chrome {
222
223 ChromeContentRendererClient::ChromeContentRendererClient() { 221 ChromeContentRendererClient::ChromeContentRendererClient() {
224 g_current_client = this; 222 g_current_client = this;
225 223
226 #if defined(ENABLE_PLUGINS) 224 #if defined(ENABLE_PLUGINS)
227 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) 225 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i)
228 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); 226 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]);
229 #endif 227 #endif
230 } 228 }
231 229
232 ChromeContentRendererClient::~ChromeContentRendererClient() { 230 ChromeContentRendererClient::~ChromeContentRendererClient() {
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 } 580 }
583 #endif 581 #endif
584 582
585 switch (status_value) { 583 switch (status_value) {
586 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: { 584 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: {
587 NOTREACHED(); 585 NOTREACHED();
588 break; 586 break;
589 } 587 }
590 case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: { 588 case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: {
591 const bool is_nacl_plugin = 589 const bool is_nacl_plugin =
592 plugin.name == 590 plugin.name == ASCIIToUTF16(ChromeContentClient::kNaClPluginName);
593 ASCIIToUTF16(chrome::ChromeContentClient::kNaClPluginName);
594 const bool is_nacl_mime_type = 591 const bool is_nacl_mime_type =
595 actual_mime_type == "application/x-nacl"; 592 actual_mime_type == "application/x-nacl";
596 const bool is_pnacl_mime_type = 593 const bool is_pnacl_mime_type =
597 actual_mime_type == "application/x-pnacl"; 594 actual_mime_type == "application/x-pnacl";
598 if (is_nacl_plugin || is_nacl_mime_type || is_pnacl_mime_type) { 595 if (is_nacl_plugin || is_nacl_mime_type || is_pnacl_mime_type) {
599 bool is_nacl_unrestricted = false; 596 bool is_nacl_unrestricted = false;
600 if (is_nacl_mime_type) { 597 if (is_nacl_mime_type) {
601 is_nacl_unrestricted = 598 is_nacl_unrestricted =
602 CommandLine::ForCurrentProcess()->HasSwitch( 599 CommandLine::ForCurrentProcess()->HasSwitch(
603 switches::kEnableNaCl); 600 switches::kEnableNaCl);
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 } 1305 }
1309 1306
1310 bool ChromeContentRendererClient::IsPluginAllowedToCallRequestOSFileHandle( 1307 bool ChromeContentRendererClient::IsPluginAllowedToCallRequestOSFileHandle(
1311 WebKit::WebPluginContainer* container) { 1308 WebKit::WebPluginContainer* container) {
1312 #if defined(ENABLE_PLUGINS) 1309 #if defined(ENABLE_PLUGINS)
1313 if (!container) 1310 if (!container)
1314 return false; 1311 return false;
1315 GURL url = container->element().document().baseURL(); 1312 GURL url = container->element().document().baseURL();
1316 const ExtensionSet* extension_set = extension_dispatcher_->extensions(); 1313 const ExtensionSet* extension_set = extension_dispatcher_->extensions();
1317 1314
1318 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, 1315 if (chrome::IsExtensionOrSharedModuleWhitelisted(
1319 allowed_file_handle_origins_) || 1316 url, extension_set, allowed_file_handle_origins_) ||
1320 IsHostAllowedByCommandLine(url, extension_set, 1317 chrome::IsHostAllowedByCommandLine(
1321 switches::kAllowNaClFileHandleAPI); 1318 url, extension_set, switches::kAllowNaClFileHandleAPI)) {
1322 #else 1319 return true;
1320 }
1321 #endif
1323 return false; 1322 return false;
1324 #endif
1325 } 1323 }
1326 1324
1327 WebKit::WebSpeechSynthesizer* 1325 WebKit::WebSpeechSynthesizer*
1328 ChromeContentRendererClient::OverrideSpeechSynthesizer( 1326 ChromeContentRendererClient::OverrideSpeechSynthesizer(
1329 WebKit::WebSpeechSynthesizerClient* client) { 1327 WebKit::WebSpeechSynthesizerClient* client) {
1330 return new TtsDispatcher(client); 1328 return new TtsDispatcher(client);
1331 } 1329 }
1332 1330
1333 bool ChromeContentRendererClient::AllowBrowserPlugin( 1331 bool ChromeContentRendererClient::AllowBrowserPlugin(
1334 WebKit::WebPluginContainer* container) { 1332 WebKit::WebPluginContainer* container) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 CommandLine* command_line = CommandLine::ForCurrentProcess(); 1394 CommandLine* command_line = CommandLine::ForCurrentProcess();
1397 return !command_line->HasSwitch(switches::kExtensionProcess); 1395 return !command_line->HasSwitch(switches::kExtensionProcess);
1398 } 1396 }
1399 1397
1400 WebKit::WebWorkerPermissionClientProxy* 1398 WebKit::WebWorkerPermissionClientProxy*
1401 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( 1399 ChromeContentRendererClient::CreateWorkerPermissionClientProxy(
1402 content::RenderView* render_view, 1400 content::RenderView* render_view,
1403 WebKit::WebFrame* frame) { 1401 WebKit::WebFrame* frame) {
1404 return new WorkerPermissionClientProxy(render_view, frame); 1402 return new WorkerPermissionClientProxy(render_view, frame);
1405 } 1403 }
1406
1407 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | chrome/renderer/chrome_content_renderer_client_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698