Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" | 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 10 #include "chrome/browser/download/download_request_limiter.h" | 10 #include "chrome/browser/download/download_request_limiter.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
| 27 #include "chrome/common/extensions/user_script.h" | 27 #include "chrome/common/extensions/user_script.h" |
| 28 #include "chrome/common/render_messages.h" | 28 #include "chrome/common/render_messages.h" |
| 29 #include "content/browser/renderer_host/render_view_host.h" | 29 #include "content/browser/renderer_host/render_view_host.h" |
| 30 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 30 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 31 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 31 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
| 32 #include "content/browser/renderer_host/resource_message_filter.h" | 32 #include "content/browser/renderer_host/resource_message_filter.h" |
| 33 #include "content/browser/resource_context.h" | 33 #include "content/browser/resource_context.h" |
| 34 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| 35 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
| 36 #include "content/public/common/referrer.h" | |
|
cbentzel
2011/12/05 18:03:29
Why does this need to be included? Looks like forw
jochen (gone - plz use gerrit)
2011/12/05 20:46:35
Done.
| |
| 36 #include "net/base/load_flags.h" | 37 #include "net/base/load_flags.h" |
| 37 #include "net/base/ssl_config_service.h" | 38 #include "net/base/ssl_config_service.h" |
| 38 | 39 |
| 39 // TODO(oshima): Enable this for other platforms. | 40 // TODO(oshima): Enable this for other platforms. |
| 40 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
| 41 #include "chrome/browser/renderer_host/offline_resource_handler.h" | 42 #include "chrome/browser/renderer_host/offline_resource_handler.h" |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 using content::BrowserThread; | 45 using content::BrowserThread; |
| 45 | 46 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 56 : public ResourceDispatcherHostLoginDelegate { | 57 : public ResourceDispatcherHostLoginDelegate { |
| 57 public: | 58 public: |
| 58 InstantResourceDispatcherHostLoginDelegate() {} | 59 InstantResourceDispatcherHostLoginDelegate() {} |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(InstantResourceDispatcherHostLoginDelegate); | 62 DISALLOW_COPY_AND_ASSIGN(InstantResourceDispatcherHostLoginDelegate); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 void AddPrerenderOnUI( | 65 void AddPrerenderOnUI( |
| 65 int render_process_id, int render_view_id, | 66 int render_process_id, int render_view_id, |
| 66 const GURL& url, const GURL& referrer) { | 67 const GURL& url, const content::Referrer& referrer) { |
| 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 68 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 68 prerender::PrerenderManager* prerender_manager = | 69 prerender::PrerenderManager* prerender_manager = |
| 69 prerender::FindPrerenderManagerUsingRenderProcessId(render_process_id); | 70 prerender::FindPrerenderManagerUsingRenderProcessId(render_process_id); |
| 70 if (!prerender_manager || !prerender_manager->is_enabled()) | 71 if (!prerender_manager || !prerender_manager->is_enabled()) |
| 71 return; | 72 return; |
| 72 | 73 |
| 73 prerender_manager->AddPrerenderFromLinkRelPrerender(render_process_id, | 74 prerender_manager->AddPrerenderFromLinkRelPrerender(render_process_id, |
| 74 render_view_id, | 75 render_view_id, |
| 75 url, | 76 url, |
| 76 referrer); | 77 referrer); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 102 ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() { | 103 ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() { |
| 103 } | 104 } |
| 104 | 105 |
| 105 bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest( | 106 bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest( |
| 106 int child_id, | 107 int child_id, |
| 107 int route_id, | 108 int route_id, |
| 108 const std::string& method, | 109 const std::string& method, |
| 109 const GURL& url, | 110 const GURL& url, |
| 110 ResourceType::Type resource_type, | 111 ResourceType::Type resource_type, |
| 111 const content::ResourceContext& resource_context, | 112 const content::ResourceContext& resource_context, |
| 112 const GURL& referrer) { | 113 const content::Referrer& referrer) { |
| 113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 114 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 114 | 115 |
| 115 // Handle a PREFETCH resource type. If prefetch is disabled, squelch the | 116 // Handle a PREFETCH resource type. If prefetch is disabled, squelch the |
| 116 // request. Otherwise, do a normal request to warm the cache. | 117 // request. Otherwise, do a normal request to warm the cache. |
| 117 if (resource_type == ResourceType::PREFETCH) { | 118 if (resource_type == ResourceType::PREFETCH) { |
| 118 // All PREFETCH requests should be GETs, but be defensive about it. | 119 // All PREFETCH requests should be GETs, but be defensive about it. |
| 119 if (method != "GET") | 120 if (method != "GET") |
| 120 return false; | 121 return false; |
| 121 | 122 |
| 122 // If prefetch is disabled, kill the request. | 123 // If prefetch is disabled, kill the request. |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 AutoLoginPrompter::ShowInfoBarIfPossible(request, info->child_id(), | 349 AutoLoginPrompter::ShowInfoBarIfPossible(request, info->child_id(), |
| 349 info->route_id()); | 350 info->route_id()); |
| 350 } | 351 } |
| 351 | 352 |
| 352 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( | 353 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( |
| 353 net::URLRequest* request, | 354 net::URLRequest* request, |
| 354 content::ResourceResponse* response, | 355 content::ResourceResponse* response, |
| 355 ResourceMessageFilter* filter) { | 356 ResourceMessageFilter* filter) { |
| 356 LoadTimingObserver::PopulateTimingInfo(request, response); | 357 LoadTimingObserver::PopulateTimingInfo(request, response); |
| 357 } | 358 } |
| OLD | NEW |