OLD | NEW |
---|---|
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/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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 #include "chrome/browser/android/intercept_download_resource_throttle.h" | 65 #include "chrome/browser/android/intercept_download_resource_throttle.h" |
66 #include "components/navigation_interception/intercept_navigation_delegate.h" | 66 #include "components/navigation_interception/intercept_navigation_delegate.h" |
67 #endif | 67 #endif |
68 | 68 |
69 #if defined(OS_CHROMEOS) | 69 #if defined(OS_CHROMEOS) |
70 #include "chrome/browser/chromeos/login/merge_session_throttle.h" | 70 #include "chrome/browser/chromeos/login/merge_session_throttle.h" |
71 // TODO(oshima): Enable this for other platforms. | 71 // TODO(oshima): Enable this for other platforms. |
72 #include "chrome/browser/renderer_host/offline_resource_throttle.h" | 72 #include "chrome/browser/renderer_host/offline_resource_throttle.h" |
73 #endif | 73 #endif |
74 | 74 |
75 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
76 #include "chrome/browser/apps/app_url_redirector.h" | |
77 #endif | |
78 | |
75 using content::BrowserThread; | 79 using content::BrowserThread; |
76 using content::RenderViewHost; | 80 using content::RenderViewHost; |
77 using content::ResourceDispatcherHostLoginDelegate; | 81 using content::ResourceDispatcherHostLoginDelegate; |
78 using content::ResourceRequestInfo; | 82 using content::ResourceRequestInfo; |
79 using extensions::Extension; | 83 using extensions::Extension; |
80 using extensions::StreamsPrivateAPI; | 84 using extensions::StreamsPrivateAPI; |
81 | 85 |
82 #if defined(OS_ANDROID) | 86 #if defined(OS_ANDROID) |
83 using navigation_interception::InterceptNavigationDelegate; | 87 using navigation_interception::InterceptNavigationDelegate; |
84 #endif | 88 #endif |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 | 259 |
256 ChromeURLRequestUserData* user_data = | 260 ChromeURLRequestUserData* user_data = |
257 ChromeURLRequestUserData::Create(request); | 261 ChromeURLRequestUserData::Create(request); |
258 bool is_prerendering = prerender_tracker_->IsPrerenderingOnIOThread( | 262 bool is_prerendering = prerender_tracker_->IsPrerenderingOnIOThread( |
259 child_id, route_id); | 263 child_id, route_id); |
260 if (is_prerendering) { | 264 if (is_prerendering) { |
261 user_data->set_is_prerender(true); | 265 user_data->set_is_prerender(true); |
262 request->SetPriority(net::IDLE); | 266 request->SetPriority(net::IDLE); |
263 } | 267 } |
264 | 268 |
269 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
270 // Redirect some navigations to apps that have registered matching URL | |
271 // handlers ('url_handlers' in the manifest). | |
272 if (!is_prerendering && resource_type == ResourceType::MAIN_FRAME && | |
darin (slow to review)
2013/09/05 23:54:25
I don't think this file should be built in the OS_
sergeygs
2013/09/06 02:51:14
Done. I guess you're right about this file not bui
| |
273 request->method() != "POST") { | |
274 throttles->push_back(AppUrlRedirector::CreateThrottleFor(request)); | |
not at google - send to devlin
2013/09/06 00:51:30
come to think of it, you should only need to regis
sergeygs
2013/09/06 02:51:14
Sure, I'll test that case. This is registered for
not at google - send to devlin
2013/09/06 03:02:11
As more recently discussed in person, the Extensio
| |
275 } | |
276 #endif | |
277 | |
265 #if defined(OS_ANDROID) | 278 #if defined(OS_ANDROID) |
266 if (!is_prerendering && resource_type == ResourceType::MAIN_FRAME) { | 279 if (!is_prerendering && resource_type == ResourceType::MAIN_FRAME) { |
267 throttles->push_back( | 280 throttles->push_back( |
268 InterceptNavigationDelegate::CreateThrottleFor(request)); | 281 InterceptNavigationDelegate::CreateThrottleFor(request)); |
269 } | 282 } |
270 #endif | 283 #endif |
284 | |
271 #if defined(OS_CHROMEOS) | 285 #if defined(OS_CHROMEOS) |
272 if (resource_type == ResourceType::MAIN_FRAME) { | 286 if (resource_type == ResourceType::MAIN_FRAME) { |
273 // We check offline first, then check safe browsing so that we still can | 287 // We check offline first, then check safe browsing so that we still can |
274 // block unsafe site after we remove offline page. | 288 // block unsafe site after we remove offline page. |
275 throttles->push_back(new OfflineResourceThrottle( | 289 throttles->push_back(new OfflineResourceThrottle( |
276 child_id, route_id, request, appcache_service)); | 290 child_id, route_id, request, appcache_service)); |
277 // Add interstitial page while merge session process (cookie | 291 // Add interstitial page while merge session process (cookie |
278 // reconstruction from OAuth2 refresh token in ChromeOS login) is still in | 292 // reconstruction from OAuth2 refresh token in ChromeOS login) is still in |
279 // progress while we are attempting to load a google property. | 293 // progress while we are attempting to load a google property. |
280 throttles->push_back(new MergeSessionThrottle( | 294 throttles->push_back(new MergeSessionThrottle( |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
637 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) && | 651 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) && |
638 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( | 652 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( |
639 &child_id, &route_id) && | 653 &child_id, &route_id) && |
640 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { | 654 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { |
641 ReportUnsupportedPrerenderScheme(redirect_url); | 655 ReportUnsupportedPrerenderScheme(redirect_url); |
642 prerender_tracker_->TryCancel( | 656 prerender_tracker_->TryCancel( |
643 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); | 657 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); |
644 request->Cancel(); | 658 request->Cancel(); |
645 } | 659 } |
646 } | 660 } |
OLD | NEW |