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

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

Issue 63273002: Rename WebKit namespace to blink (part 4) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 #include "chrome/renderer/spellchecker/spellcheck.h" 110 #include "chrome/renderer/spellchecker/spellcheck.h"
111 #include "chrome/renderer/spellchecker/spellcheck_provider.h" 111 #include "chrome/renderer/spellchecker/spellcheck_provider.h"
112 #endif 112 #endif
113 113
114 using autofill::AutofillAgent; 114 using autofill::AutofillAgent;
115 using autofill::PasswordAutofillAgent; 115 using autofill::PasswordAutofillAgent;
116 using autofill::PasswordGenerationAgent; 116 using autofill::PasswordGenerationAgent;
117 using content::RenderThread; 117 using content::RenderThread;
118 using content::WebPluginInfo; 118 using content::WebPluginInfo;
119 using extensions::Extension; 119 using extensions::Extension;
120 using WebKit::WebCache; 120 using blink::WebCache;
121 using WebKit::WebConsoleMessage; 121 using blink::WebConsoleMessage;
122 using WebKit::WebDataSource; 122 using blink::WebDataSource;
123 using WebKit::WebDocument; 123 using blink::WebDocument;
124 using WebKit::WebFrame; 124 using blink::WebFrame;
125 using WebKit::WebPlugin; 125 using blink::WebPlugin;
126 using WebKit::WebPluginParams; 126 using blink::WebPluginParams;
127 using WebKit::WebSecurityOrigin; 127 using blink::WebSecurityOrigin;
128 using WebKit::WebSecurityPolicy; 128 using blink::WebSecurityPolicy;
129 using WebKit::WebString; 129 using blink::WebString;
130 using WebKit::WebURL; 130 using blink::WebURL;
131 using WebKit::WebURLError; 131 using blink::WebURLError;
132 using WebKit::WebURLRequest; 132 using blink::WebURLRequest;
133 using WebKit::WebURLResponse; 133 using blink::WebURLResponse;
134 using WebKit::WebVector; 134 using blink::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 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,
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 *error_domain = LocalizedError::kHttpErrorDomain; 910 *error_domain = LocalizedError::kHttpErrorDomain;
911 return true; 911 return true;
912 } 912 }
913 913
914 bool ChromeContentRendererClient::ShouldSuppressErrorPage(const GURL& url) { 914 bool ChromeContentRendererClient::ShouldSuppressErrorPage(const GURL& url) {
915 // Do not flash an error page if the Instant new tab page fails to load. 915 // Do not flash an error page if the Instant new tab page fails to load.
916 return search_bouncer_.get() && search_bouncer_->IsNewTabPage(url); 916 return search_bouncer_.get() && search_bouncer_->IsNewTabPage(url);
917 } 917 }
918 918
919 void ChromeContentRendererClient::GetNavigationErrorStrings( 919 void ChromeContentRendererClient::GetNavigationErrorStrings(
920 WebKit::WebFrame* frame, 920 blink::WebFrame* frame,
921 const WebKit::WebURLRequest& failed_request, 921 const blink::WebURLRequest& failed_request,
922 const WebKit::WebURLError& error, 922 const blink::WebURLError& error,
923 const std::string& accept_languages, 923 const std::string& accept_languages,
924 std::string* error_html, 924 std::string* error_html,
925 string16* error_description) { 925 string16* error_description) {
926 const GURL failed_url = error.unreachableURL; 926 const GURL failed_url = error.unreachableURL;
927 const Extension* extension = NULL; 927 const Extension* extension = NULL;
928 928
929 if (failed_url.is_valid() && 929 if (failed_url.is_valid() &&
930 !failed_url.SchemeIs(extensions::kExtensionScheme)) { 930 !failed_url.SchemeIs(extensions::kExtensionScheme)) {
931 extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL( 931 extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL(
932 failed_url); 932 failed_url);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 // uninstalled. 1075 // uninstalled.
1076 if (frame->top()->document().url() == url) { 1076 if (frame->top()->document().url() == url) {
1077 if (is_extension_url != extension_dispatcher_->is_extension_process()) 1077 if (is_extension_url != extension_dispatcher_->is_extension_process())
1078 return true; 1078 return true;
1079 } 1079 }
1080 1080
1081 return false; 1081 return false;
1082 } 1082 }
1083 1083
1084 bool ChromeContentRendererClient::WillSendRequest( 1084 bool ChromeContentRendererClient::WillSendRequest(
1085 WebKit::WebFrame* frame, 1085 blink::WebFrame* frame,
1086 content::PageTransition transition_type, 1086 content::PageTransition transition_type,
1087 const GURL& url, 1087 const GURL& url,
1088 const GURL& first_party_for_cookies, 1088 const GURL& first_party_for_cookies,
1089 GURL* new_url) { 1089 GURL* new_url) {
1090 // Check whether the request should be allowed. If not allowed, we reset the 1090 // Check whether the request should be allowed. If not allowed, we reset the
1091 // URL to something invalid to prevent the request and cause an error. 1091 // URL to something invalid to prevent the request and cause an error.
1092 if (url.SchemeIs(extensions::kExtensionScheme) && 1092 if (url.SchemeIs(extensions::kExtensionScheme) &&
1093 !extensions::ResourceRequestPolicy::CanRequestResource( 1093 !extensions::ResourceRequestPolicy::CanRequestResource(
1094 url, 1094 url,
1095 frame, 1095 frame,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 1141
1142 unsigned long long ChromeContentRendererClient::VisitedLinkHash( 1142 unsigned long long ChromeContentRendererClient::VisitedLinkHash(
1143 const char* canonical_url, size_t length) { 1143 const char* canonical_url, size_t length) {
1144 return visited_link_slave_->ComputeURLFingerprint(canonical_url, length); 1144 return visited_link_slave_->ComputeURLFingerprint(canonical_url, length);
1145 } 1145 }
1146 1146
1147 bool ChromeContentRendererClient::IsLinkVisited(unsigned long long link_hash) { 1147 bool ChromeContentRendererClient::IsLinkVisited(unsigned long long link_hash) {
1148 return visited_link_slave_->IsVisited(link_hash); 1148 return visited_link_slave_->IsVisited(link_hash);
1149 } 1149 }
1150 1150
1151 WebKit::WebPrescientNetworking* 1151 blink::WebPrescientNetworking*
1152 ChromeContentRendererClient::GetPrescientNetworking() { 1152 ChromeContentRendererClient::GetPrescientNetworking() {
1153 return prescient_networking_dispatcher_.get(); 1153 return prescient_networking_dispatcher_.get();
1154 } 1154 }
1155 1155
1156 bool ChromeContentRendererClient::ShouldOverridePageVisibilityState( 1156 bool ChromeContentRendererClient::ShouldOverridePageVisibilityState(
1157 const content::RenderView* render_view, 1157 const content::RenderView* render_view,
1158 WebKit::WebPageVisibilityState* override_state) { 1158 blink::WebPageVisibilityState* override_state) {
1159 if (!prerender::PrerenderHelper::IsPrerendering(render_view)) 1159 if (!prerender::PrerenderHelper::IsPrerendering(render_view))
1160 return false; 1160 return false;
1161 1161
1162 *override_state = WebKit::WebPageVisibilityStatePrerender; 1162 *override_state = blink::WebPageVisibilityStatePrerender;
1163 return true; 1163 return true;
1164 } 1164 }
1165 1165
1166 bool ChromeContentRendererClient::HandleGetCookieRequest( 1166 bool ChromeContentRendererClient::HandleGetCookieRequest(
1167 content::RenderView* sender, 1167 content::RenderView* sender,
1168 const GURL& url, 1168 const GURL& url,
1169 const GURL& first_party_for_cookies, 1169 const GURL& first_party_for_cookies,
1170 std::string* cookies) { 1170 std::string* cookies) {
1171 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame)) { 1171 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame)) {
1172 IPC::SyncMessage* msg = new ChromeViewHostMsg_GetCookies( 1172 IPC::SyncMessage* msg = new ChromeViewHostMsg_GetCookies(
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 1298
1299 bool ChromeContentRendererClient::IsExternalPepperPlugin( 1299 bool ChromeContentRendererClient::IsExternalPepperPlugin(
1300 const std::string& module_name) { 1300 const std::string& module_name) {
1301 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. 1301 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed.
1302 // We must defer certain plugin events for NaCl instances since we switch 1302 // We must defer certain plugin events for NaCl instances since we switch
1303 // from the in-process to the out-of-process proxy after instantiating them. 1303 // from the in-process to the out-of-process proxy after instantiating them.
1304 return module_name == "Native Client"; 1304 return module_name == "Native Client";
1305 } 1305 }
1306 1306
1307 bool ChromeContentRendererClient::IsPluginAllowedToCallRequestOSFileHandle( 1307 bool ChromeContentRendererClient::IsPluginAllowedToCallRequestOSFileHandle(
1308 WebKit::WebPluginContainer* container) { 1308 blink::WebPluginContainer* container) {
1309 #if defined(ENABLE_PLUGINS) 1309 #if defined(ENABLE_PLUGINS)
1310 if (!container) 1310 if (!container)
1311 return false; 1311 return false;
1312 GURL url = container->element().document().baseURL(); 1312 GURL url = container->element().document().baseURL();
1313 const ExtensionSet* extension_set = extension_dispatcher_->extensions(); 1313 const ExtensionSet* extension_set = extension_dispatcher_->extensions();
1314 1314
1315 if (chrome::IsExtensionOrSharedModuleWhitelisted( 1315 if (chrome::IsExtensionOrSharedModuleWhitelisted(
1316 url, extension_set, allowed_file_handle_origins_) || 1316 url, extension_set, allowed_file_handle_origins_) ||
1317 chrome::IsHostAllowedByCommandLine( 1317 chrome::IsHostAllowedByCommandLine(
1318 url, extension_set, switches::kAllowNaClFileHandleAPI)) { 1318 url, extension_set, switches::kAllowNaClFileHandleAPI)) {
1319 return true; 1319 return true;
1320 } 1320 }
1321 #endif 1321 #endif
1322 return false; 1322 return false;
1323 } 1323 }
1324 1324
1325 WebKit::WebSpeechSynthesizer* 1325 blink::WebSpeechSynthesizer*
1326 ChromeContentRendererClient::OverrideSpeechSynthesizer( 1326 ChromeContentRendererClient::OverrideSpeechSynthesizer(
1327 WebKit::WebSpeechSynthesizerClient* client) { 1327 blink::WebSpeechSynthesizerClient* client) {
1328 return new TtsDispatcher(client); 1328 return new TtsDispatcher(client);
1329 } 1329 }
1330 1330
1331 bool ChromeContentRendererClient::AllowBrowserPlugin( 1331 bool ChromeContentRendererClient::AllowBrowserPlugin(
1332 WebKit::WebPluginContainer* container) { 1332 blink::WebPluginContainer* container) {
1333 if (CommandLine::ForCurrentProcess()->HasSwitch( 1333 if (CommandLine::ForCurrentProcess()->HasSwitch(
1334 switches::kEnableBrowserPluginForAllViewTypes)) 1334 switches::kEnableBrowserPluginForAllViewTypes))
1335 return true; 1335 return true;
1336 1336
1337 // If this |BrowserPlugin| <object> in the |container| is not inside a 1337 // If this |BrowserPlugin| <object> in the |container| is not inside a
1338 // <webview>/<adview> shadowHost, we disable instantiating this plugin. This 1338 // <webview>/<adview> shadowHost, we disable instantiating this plugin. This
1339 // is to discourage and prevent developers from accidentally attaching 1339 // is to discourage and prevent developers from accidentally attaching
1340 // <object> directly in apps. 1340 // <object> directly in apps.
1341 // 1341 //
1342 // Note that this check below does *not* ensure any security, it is still 1342 // Note that this check below does *not* ensure any security, it is still
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 bool ChromeContentRendererClient::ShouldEnableSiteIsolationPolicy() const { 1388 bool ChromeContentRendererClient::ShouldEnableSiteIsolationPolicy() const {
1389 // SiteIsolationPolicy is off by default. We would like to activate cross-site 1389 // SiteIsolationPolicy is off by default. We would like to activate cross-site
1390 // document blocking (for UMA data collection) for normal renderer processes 1390 // document blocking (for UMA data collection) for normal renderer processes
1391 // running a normal web page from the Internet. We only turn on 1391 // running a normal web page from the Internet. We only turn on
1392 // SiteIsolationPolicy for a renderer process that does not have the extension 1392 // SiteIsolationPolicy for a renderer process that does not have the extension
1393 // flag on. 1393 // flag on.
1394 CommandLine* command_line = CommandLine::ForCurrentProcess(); 1394 CommandLine* command_line = CommandLine::ForCurrentProcess();
1395 return !command_line->HasSwitch(switches::kExtensionProcess); 1395 return !command_line->HasSwitch(switches::kExtensionProcess);
1396 } 1396 }
1397 1397
1398 WebKit::WebWorkerPermissionClientProxy* 1398 blink::WebWorkerPermissionClientProxy*
1399 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( 1399 ChromeContentRendererClient::CreateWorkerPermissionClientProxy(
1400 content::RenderView* render_view, 1400 content::RenderView* render_view,
1401 WebKit::WebFrame* frame) { 1401 blink::WebFrame* frame) {
1402 return new WorkerPermissionClientProxy(render_view, frame); 1402 return new WorkerPermissionClientProxy(render_view, frame);
1403 } 1403 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | chrome/renderer/chrome_content_renderer_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698