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

Side by Side Diff: android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc

Issue 10946008: Componentize IgnoreNavigationResourceThrottle and add chrome and webview specific implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed presubmit warning for jni_generator.py Created 8 years, 2 months 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 "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h" 5 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h"
6 6
7 #include "android_webview/browser/aw_login_delegate.h" 7 #include "android_webview/browser/aw_login_delegate.h"
8 #include "android_webview/browser/aw_contents_io_thread_client.h" 8 #include "android_webview/browser/aw_contents_io_thread_client.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "chrome/browser/component/navigation_interception/intercept_navigation_ delegate.h"
11 #include "content/public/browser/resource_controller.h" 12 #include "content/public/browser/resource_controller.h"
12 #include "content/public/browser/resource_dispatcher_host.h" 13 #include "content/public/browser/resource_dispatcher_host.h"
13 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" 14 #include "content/public/browser/resource_dispatcher_host_login_delegate.h"
14 #include "content/public/browser/resource_throttle.h" 15 #include "content/public/browser/resource_throttle.h"
15 #include "content/public/common/url_constants.h" 16 #include "content/public/common/url_constants.h"
16 #include "net/base/load_flags.h" 17 #include "net/base/load_flags.h"
17 #include "net/url_request/url_request.h" 18 #include "net/url_request/url_request.h"
18 19
20 using navigation_interception::InterceptNavigationDelegate;
21
19 namespace { 22 namespace {
20 23
21 base::LazyInstance<android_webview::AwResourceDispatcherHostDelegate> 24 base::LazyInstance<android_webview::AwResourceDispatcherHostDelegate>
22 g_webview_resource_dispatcher_host_delegate = LAZY_INSTANCE_INITIALIZER; 25 g_webview_resource_dispatcher_host_delegate = LAZY_INSTANCE_INITIALIZER;
23 26
24 // Will unconditionally cancel this resource request. 27 // Will unconditionally cancel this resource request.
25 class CancelResourceThrottle : public content::ResourceThrottle { 28 class CancelResourceThrottle : public content::ResourceThrottle {
26 public: 29 public:
27 virtual void WillStartRequest(bool* defer) OVERRIDE; 30 virtual void WillStartRequest(bool* defer) OVERRIDE;
28 }; 31 };
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 throttles->push_back(new CancelResourceThrottle); 73 throttles->push_back(new CancelResourceThrottle);
71 } else { 74 } else {
72 int load_flags = request->load_flags(); 75 int load_flags = request->load_flags();
73 load_flags &= ~(net::LOAD_BYPASS_CACHE & 76 load_flags &= ~(net::LOAD_BYPASS_CACHE &
74 net::LOAD_VALIDATE_CACHE & 77 net::LOAD_VALIDATE_CACHE &
75 net::LOAD_PREFERRING_CACHE); 78 net::LOAD_PREFERRING_CACHE);
76 load_flags |= net::LOAD_ONLY_FROM_CACHE; 79 load_flags |= net::LOAD_ONLY_FROM_CACHE;
77 request->set_load_flags(load_flags); 80 request->set_load_flags(load_flags);
78 } 81 }
79 } 82 }
83
84 if (resource_type == ResourceType::MAIN_FRAME) {
85 throttles->push_back(InterceptNavigationDelegate::CreateThrottleFor(
86 request));
87 }
80 } 88 }
81 89
82 bool AwResourceDispatcherHostDelegate::AcceptAuthRequest( 90 bool AwResourceDispatcherHostDelegate::AcceptAuthRequest(
83 net::URLRequest* request, 91 net::URLRequest* request,
84 net::AuthChallengeInfo* auth_info) { 92 net::AuthChallengeInfo* auth_info) {
85 return true; 93 return true;
86 } 94 }
87 95
88 content::ResourceDispatcherHostLoginDelegate* 96 content::ResourceDispatcherHostLoginDelegate*
89 AwResourceDispatcherHostDelegate::CreateLoginDelegate( 97 AwResourceDispatcherHostDelegate::CreateLoginDelegate(
90 net::AuthChallengeInfo* auth_info, 98 net::AuthChallengeInfo* auth_info,
91 net::URLRequest* request) { 99 net::URLRequest* request) {
92 return new AwLoginDelegate(auth_info, request); 100 return new AwLoginDelegate(auth_info, request);
93 } 101 }
94 102
95 } 103 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698