Chromium Code Reviews| 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/ui/login/login_prompt.h" | 5 #include "chrome/browser/ui/login/login_prompt.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/password_manager/password_manager.h" | 14 #include "chrome/browser/password_manager/password_manager.h" |
| 15 #include "chrome/browser/prerender/prerender_contents.h" | |
| 15 #include "chrome/browser/tab_contents/tab_util.h" | 16 #include "chrome/browser/tab_contents/tab_util.h" |
| 16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 18 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 19 #include "content/public/browser/render_frame_host.h" | 20 #include "content/public/browser/render_frame_host.h" |
| 20 #include "content/public/browser/resource_dispatcher_host.h" | 21 #include "content/public/browser/resource_dispatcher_host.h" |
| 21 #include "content/public/browser/resource_request_info.h" | 22 #include "content/public/browser/resource_request_info.h" |
| 22 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 24 #include "net/base/auth.h" | 25 #include "net/base/auth.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 LoginHandler* handler) { | 421 LoginHandler* handler) { |
| 421 WebContents* parent_contents = handler->GetWebContentsForLogin(); | 422 WebContents* parent_contents = handler->GetWebContentsForLogin(); |
| 422 if (!parent_contents || handler->WasAuthHandled()) { | 423 if (!parent_contents || handler->WasAuthHandled()) { |
| 423 // The request may have been cancelled, or it may be for a renderer | 424 // The request may have been cancelled, or it may be for a renderer |
| 424 // not hosted by a tab (e.g. an extension). Cancel just in case | 425 // not hosted by a tab (e.g. an extension). Cancel just in case |
| 425 // (cancelling twice is a no-op). | 426 // (cancelling twice is a no-op). |
| 426 handler->CancelAuth(); | 427 handler->CancelAuth(); |
| 427 return; | 428 return; |
| 428 } | 429 } |
| 429 | 430 |
| 431 prerender::PrerenderContents* prerender_contents = | |
| 432 prerender::PrerenderContents::FromWebContents(parent_contents); | |
| 433 if (prerender_contents) { | |
| 434 prerender_contents->Destroy(prerender::FINAL_STATUS_AUTH_NEEDED); | |
|
davidben
2014/01/06 22:14:47
Do we want to call handler->CancelAuth() here too?
jam
2014/01/06 22:21:00
this will be equivalent to closing the tab; and th
| |
| 435 return; | |
| 436 } | |
| 437 | |
| 430 PasswordManager* password_manager = | 438 PasswordManager* password_manager = |
| 431 PasswordManager::FromWebContents(parent_contents); | 439 PasswordManager::FromWebContents(parent_contents); |
| 432 if (!password_manager) { | 440 if (!password_manager) { |
| 433 // Same logic as above. | 441 // Same logic as above. |
| 434 handler->CancelAuth(); | 442 handler->CancelAuth(); |
| 435 return; | 443 return; |
| 436 } | 444 } |
| 437 | 445 |
| 438 // Tell the password manager to look for saved passwords. | 446 // Tell the password manager to look for saved passwords. |
| 439 std::vector<PasswordForm> v; | 447 std::vector<PasswordForm> v; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 462 | 470 |
| 463 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, | 471 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, |
| 464 net::URLRequest* request) { | 472 net::URLRequest* request) { |
| 465 LoginHandler* handler = LoginHandler::Create(auth_info, request); | 473 LoginHandler* handler = LoginHandler::Create(auth_info, request); |
| 466 BrowserThread::PostTask( | 474 BrowserThread::PostTask( |
| 467 BrowserThread::UI, FROM_HERE, | 475 BrowserThread::UI, FROM_HERE, |
| 468 base::Bind(&LoginDialogCallback, request->url(), | 476 base::Bind(&LoginDialogCallback, request->url(), |
| 469 make_scoped_refptr(auth_info), make_scoped_refptr(handler))); | 477 make_scoped_refptr(auth_info), make_scoped_refptr(handler))); |
| 470 return handler; | 478 return handler; |
| 471 } | 479 } |
| OLD | NEW |