OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2189 WebPlugin* RenderView::createPlugin(WebFrame* frame, | 2189 WebPlugin* RenderView::createPlugin(WebFrame* frame, |
2190 const WebPluginParams& params) { | 2190 const WebPluginParams& params) { |
2191 FilePath path; | 2191 FilePath path; |
2192 std::string actual_mime_type; | 2192 std::string actual_mime_type; |
2193 render_thread_->Send(new ViewHostMsg_GetPluginPath( | 2193 render_thread_->Send(new ViewHostMsg_GetPluginPath( |
2194 params.url, frame->top()->url(), params.mimeType.utf8(), &path, | 2194 params.url, frame->top()->url(), params.mimeType.utf8(), &path, |
2195 &actual_mime_type)); | 2195 &actual_mime_type)); |
2196 if (path.value().empty()) | 2196 if (path.value().empty()) |
2197 return NULL; | 2197 return NULL; |
2198 | 2198 |
2199 if (!AllowContentType(CONTENT_SETTINGS_TYPE_PLUGINS) && | 2199 if (CommandLine::ForCurrentProcess()->HasSwitch( |
2200 path.value() != kDefaultPluginLibraryName) { | 2200 switches::kEnableClickToPlay)) { |
2201 didNotAllowPlugins(frame); | 2201 if (!AllowContentType(CONTENT_SETTINGS_TYPE_PLUGINS) && |
2202 return CreatePluginPlaceholder(frame, params); | 2202 path.value() != kDefaultPluginLibraryName) { |
| 2203 didNotAllowPlugins(frame); |
| 2204 return CreatePluginPlaceholder(frame, params); |
| 2205 } |
2203 } | 2206 } |
2204 return CreatePluginInternal(frame, params, actual_mime_type, path); | 2207 return CreatePluginInternal(frame, params, actual_mime_type, path); |
2205 } | 2208 } |
2206 | 2209 |
2207 WebWorker* RenderView::createWorker(WebFrame* frame, WebWorkerClient* client) { | 2210 WebWorker* RenderView::createWorker(WebFrame* frame, WebWorkerClient* client) { |
2208 WebApplicationCacheHostImpl* appcache_host = | 2211 WebApplicationCacheHostImpl* appcache_host = |
2209 WebApplicationCacheHostImpl::FromFrame(frame); | 2212 WebApplicationCacheHostImpl::FromFrame(frame); |
2210 int appcache_host_id = appcache_host ? appcache_host->host_id() : 0; | 2213 int appcache_host_id = appcache_host ? appcache_host->host_id() : 0; |
2211 return new WebWorkerProxy(client, RenderThread::current(), routing_id_, | 2214 return new WebWorkerProxy(client, RenderThread::current(), routing_id_, |
2212 appcache_host_id); | 2215 appcache_host_id); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2324 AllowContentType(CONTENT_SETTINGS_TYPE_IMAGES)) | 2327 AllowContentType(CONTENT_SETTINGS_TYPE_IMAGES)) |
2325 return true; | 2328 return true; |
2326 | 2329 |
2327 if (IsWhitelistedForContentSettings(frame)) | 2330 if (IsWhitelistedForContentSettings(frame)) |
2328 return true; | 2331 return true; |
2329 | 2332 |
2330 DidBlockContentType(CONTENT_SETTINGS_TYPE_IMAGES); | 2333 DidBlockContentType(CONTENT_SETTINGS_TYPE_IMAGES); |
2331 return false; // Other protocols fall through here. | 2334 return false; // Other protocols fall through here. |
2332 } | 2335 } |
2333 | 2336 |
| 2337 bool RenderView::allowPlugins(WebFrame* frame, bool enabled_per_settings) { |
| 2338 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 2339 switches::kEnableClickToPlay)) { |
| 2340 return WebFrameClient::allowPlugins(frame, enabled_per_settings); |
| 2341 } |
| 2342 return (enabled_per_settings && |
| 2343 AllowContentType(CONTENT_SETTINGS_TYPE_PLUGINS)); |
| 2344 } |
| 2345 |
| 2346 |
2334 void RenderView::loadURLExternally( | 2347 void RenderView::loadURLExternally( |
2335 WebFrame* frame, const WebURLRequest& request, | 2348 WebFrame* frame, const WebURLRequest& request, |
2336 WebNavigationPolicy policy) { | 2349 WebNavigationPolicy policy) { |
2337 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2350 GURL referrer(request.httpHeaderField(WebString::fromUTF8("Referer"))); |
2338 if (policy == WebKit::WebNavigationPolicyDownload) { | 2351 if (policy == WebKit::WebNavigationPolicyDownload) { |
2339 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer)); | 2352 Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer)); |
2340 } else { | 2353 } else { |
2341 OpenURL(request.url(), referrer, policy); | 2354 OpenURL(request.url(), referrer, policy); |
2342 } | 2355 } |
2343 } | 2356 } |
(...skipping 2848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5192 // top level navigation and routed back to the host. | 5205 // top level navigation and routed back to the host. |
5193 WebKit::WebFrame* opener = frame->opener(); | 5206 WebKit::WebFrame* opener = frame->opener(); |
5194 if (opener) { | 5207 if (opener) { |
5195 if (url.GetOrigin() != GURL(opener->url()).GetOrigin()) | 5208 if (url.GetOrigin() != GURL(opener->url()).GetOrigin()) |
5196 return true; | 5209 return true; |
5197 } | 5210 } |
5198 } | 5211 } |
5199 return false; | 5212 return false; |
5200 } | 5213 } |
5201 | 5214 |
OLD | NEW |