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" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/content_settings/host_content_settings_map.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map.h" |
13 #include "chrome/browser/download/download_request_limiter.h" | 13 #include "chrome/browser/download/download_request_limiter.h" |
14 #include "chrome/browser/download/download_resource_throttle.h" | 14 #include "chrome/browser/download/download_resource_throttle.h" |
15 #include "chrome/browser/download/download_util.h" | 15 #include "chrome/browser/download/download_util.h" |
16 #include "chrome/browser/extensions/user_script_listener.h" | 16 #include "chrome/browser/extensions/user_script_listener.h" |
17 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 17 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
18 #include "chrome/browser/google/google_util.h" | 18 #include "chrome/browser/google/google_util.h" |
19 #include "chrome/browser/instant/instant_loader.h" | |
20 #include "chrome/browser/net/load_timing_observer.h" | 19 #include "chrome/browser/net/load_timing_observer.h" |
21 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" | 20 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
22 #include "chrome/browser/prerender/prerender_manager.h" | 21 #include "chrome/browser/prerender/prerender_manager.h" |
23 #include "chrome/browser/prerender/prerender_tracker.h" | 22 #include "chrome/browser/prerender/prerender_tracker.h" |
24 #include "chrome/browser/profiles/profile_io_data.h" | 23 #include "chrome/browser/profiles/profile_io_data.h" |
25 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h" | 24 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h" |
26 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" | 25 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" |
27 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 26 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
28 #include "chrome/browser/ui/auto_login_prompter.h" | 27 #include "chrome/browser/ui/auto_login_prompter.h" |
29 #include "chrome/browser/ui/login/login_prompt.h" | 28 #include "chrome/browser/ui/login/login_prompt.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 child_id, route_id, prerender::FINAL_STATUS_AUTH_NEEDED)) { | 227 child_id, route_id, prerender::FINAL_STATUS_AUTH_NEEDED)) { |
229 return true; | 228 return true; |
230 } | 229 } |
231 | 230 |
232 return false; | 231 return false; |
233 } | 232 } |
234 | 233 |
235 ResourceDispatcherHostLoginDelegate* | 234 ResourceDispatcherHostLoginDelegate* |
236 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( | 235 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( |
237 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { | 236 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { |
238 std::string instant_header_value; | |
239 // For instant, return a NULL delegate. Auth navigations don't commit the load | |
sky
2012/08/07 15:57:21
How is this dealt with now?
sreeram
2012/08/07 16:35:03
No need to deal with this now, I think. This was a
| |
240 // (the load remains pending) until the user cancels or succeeds in | |
241 // authorizing. Since we don't allow merging of WebContents with pending loads | |
242 // we disallow auth dialogs from showing during instant. Returning NULL does | |
243 // that. | |
244 // TODO: see if we can handle this case more robustly. | |
245 if (request->extra_request_headers().GetHeader( | |
246 InstantLoader::kInstantHeader, &instant_header_value) && | |
247 instant_header_value == InstantLoader::kInstantHeaderValue) | |
248 return NULL; | |
249 return CreateLoginPrompt(auth_info, request); | 237 return CreateLoginPrompt(auth_info, request); |
250 } | 238 } |
251 | 239 |
252 void ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( | 240 void ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( |
253 const GURL& url, int child_id, int route_id) { | 241 const GURL& url, int child_id, int route_id) { |
254 BrowserThread::PostTask( | 242 BrowserThread::PostTask( |
255 BrowserThread::UI, FROM_HERE, | 243 BrowserThread::UI, FROM_HERE, |
256 base::Bind(&ExternalProtocolHandler::LaunchUrl, url, child_id, route_id)); | 244 base::Bind(&ExternalProtocolHandler::LaunchUrl, url, child_id, route_id)); |
257 } | 245 } |
258 | 246 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 if (base::Base64Encode(serialized, &hashed)) { | 424 if (base::Base64Encode(serialized, &hashed)) { |
437 // If successful, swap the header value with the new one. | 425 // If successful, swap the header value with the new one. |
438 // Note that the list of IDs and the header could be temporarily out of sync | 426 // Note that the list of IDs and the header could be temporarily out of sync |
439 // if IDs are added as we are recreating the header, but we're OK with those | 427 // if IDs are added as we are recreating the header, but we're OK with those |
440 // descrepancies. | 428 // descrepancies. |
441 variation_ids_header_ = hashed; | 429 variation_ids_header_ = hashed; |
442 } else { | 430 } else { |
443 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; | 431 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; |
444 } | 432 } |
445 } | 433 } |
OLD | NEW |