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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 : public ResourceDispatcherHostLoginDelegate { | 56 : public ResourceDispatcherHostLoginDelegate { |
57 public: | 57 public: |
58 InstantResourceDispatcherHostLoginDelegate() {} | 58 InstantResourceDispatcherHostLoginDelegate() {} |
59 | 59 |
60 private: | 60 private: |
61 DISALLOW_COPY_AND_ASSIGN(InstantResourceDispatcherHostLoginDelegate); | 61 DISALLOW_COPY_AND_ASSIGN(InstantResourceDispatcherHostLoginDelegate); |
62 }; | 62 }; |
63 | 63 |
64 void AddPrerenderOnUI( | 64 void AddPrerenderOnUI( |
65 int render_process_id, int render_view_id, | 65 int render_process_id, int render_view_id, |
66 const GURL& url, const GURL& referrer) { | 66 const GURL& url, const content::Referrer& referrer) { |
67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
68 prerender::PrerenderManager* prerender_manager = | 68 prerender::PrerenderManager* prerender_manager = |
69 prerender::FindPrerenderManagerUsingRenderProcessId(render_process_id); | 69 prerender::FindPrerenderManagerUsingRenderProcessId(render_process_id); |
70 if (!prerender_manager || !prerender_manager->is_enabled()) | 70 if (!prerender_manager || !prerender_manager->is_enabled()) |
71 return; | 71 return; |
72 | 72 |
73 prerender_manager->AddPrerenderFromLinkRelPrerender(render_process_id, | 73 prerender_manager->AddPrerenderFromLinkRelPrerender(render_process_id, |
74 render_view_id, | 74 render_view_id, |
75 url, | 75 url, |
76 referrer); | 76 referrer); |
(...skipping 25 matching lines...) Expand all Loading... |
102 ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() { | 102 ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() { |
103 } | 103 } |
104 | 104 |
105 bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest( | 105 bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest( |
106 int child_id, | 106 int child_id, |
107 int route_id, | 107 int route_id, |
108 const std::string& method, | 108 const std::string& method, |
109 const GURL& url, | 109 const GURL& url, |
110 ResourceType::Type resource_type, | 110 ResourceType::Type resource_type, |
111 const content::ResourceContext& resource_context, | 111 const content::ResourceContext& resource_context, |
112 const GURL& referrer) { | 112 const content::Referrer& referrer) { |
113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
114 | 114 |
115 // Handle a PREFETCH resource type. If prefetch is disabled, squelch the | 115 // Handle a PREFETCH resource type. If prefetch is disabled, squelch the |
116 // request. Otherwise, do a normal request to warm the cache. | 116 // request. Otherwise, do a normal request to warm the cache. |
117 if (resource_type == ResourceType::PREFETCH) { | 117 if (resource_type == ResourceType::PREFETCH) { |
118 // All PREFETCH requests should be GETs, but be defensive about it. | 118 // All PREFETCH requests should be GETs, but be defensive about it. |
119 if (method != "GET") | 119 if (method != "GET") |
120 return false; | 120 return false; |
121 | 121 |
122 // If prefetch is disabled, kill the request. | 122 // 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(), | 348 AutoLoginPrompter::ShowInfoBarIfPossible(request, info->child_id(), |
349 info->route_id()); | 349 info->route_id()); |
350 } | 350 } |
351 | 351 |
352 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( | 352 void ChromeResourceDispatcherHostDelegate::OnRequestRedirected( |
353 net::URLRequest* request, | 353 net::URLRequest* request, |
354 content::ResourceResponse* response, | 354 content::ResourceResponse* response, |
355 ResourceMessageFilter* filter) { | 355 ResourceMessageFilter* filter) { |
356 LoadTimingObserver::PopulateTimingInfo(request, response); | 356 LoadTimingObserver::PopulateTimingInfo(request, response); |
357 } | 357 } |
OLD | NEW |