| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/lock.h" | 11 #include "base/synchronization/lock.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/browser_thread.h" | 13 #include "chrome/browser/browser_thread.h" |
| 14 #include "chrome/browser/password_manager/password_manager.h" | 14 #include "chrome/browser/password_manager/password_manager.h" |
| 15 #include "chrome/browser/renderer_host/render_process_host.h" | 15 #include "chrome/browser/renderer_host/render_process_host.h" |
| 16 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 16 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 17 #include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" | 17 #include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" |
| 18 #include "chrome/browser/tab_contents/constrained_window.h" | 18 #include "chrome/browser/tab_contents/constrained_window.h" |
| 19 #include "chrome/browser/tab_contents/tab_contents.h" | 19 #include "chrome/browser/tab_contents/tab_contents.h" |
| 20 #include "chrome/browser/tab_contents/tab_util.h" | 20 #include "chrome/browser/tab_contents/tab_util.h" |
| 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 BrowserThread::PostTask( | 311 BrowserThread::PostTask( |
| 312 BrowserThread::UI, FROM_HERE, | 312 BrowserThread::UI, FROM_HERE, |
| 313 NewRunnableMethod(this, &LoginHandler::RemoveObservers)); | 313 NewRunnableMethod(this, &LoginHandler::RemoveObservers)); |
| 314 | 314 |
| 315 // Delete this object once all InvokeLaters have been called. | 315 // Delete this object once all InvokeLaters have been called. |
| 316 BrowserThread::ReleaseSoon(BrowserThread::IO, FROM_HERE, this); | 316 BrowserThread::ReleaseSoon(BrowserThread::IO, FROM_HERE, this); |
| 317 } | 317 } |
| 318 | 318 |
| 319 // Returns whether authentication had been handled (SetAuth or CancelAuth). | 319 // Returns whether authentication had been handled (SetAuth or CancelAuth). |
| 320 bool LoginHandler::WasAuthHandled() const { | 320 bool LoginHandler::WasAuthHandled() const { |
| 321 AutoLock lock(handled_auth_lock_); | 321 base::AutoLock lock(handled_auth_lock_); |
| 322 bool was_handled = handled_auth_; | 322 bool was_handled = handled_auth_; |
| 323 return was_handled; | 323 return was_handled; |
| 324 } | 324 } |
| 325 | 325 |
| 326 // Marks authentication as handled and returns the previous handled state. | 326 // Marks authentication as handled and returns the previous handled state. |
| 327 bool LoginHandler::TestAndSetAuthHandled() { | 327 bool LoginHandler::TestAndSetAuthHandled() { |
| 328 AutoLock lock(handled_auth_lock_); | 328 base::AutoLock lock(handled_auth_lock_); |
| 329 bool was_handled = handled_auth_; | 329 bool was_handled = handled_auth_; |
| 330 handled_auth_ = true; | 330 handled_auth_ = true; |
| 331 return was_handled; | 331 return was_handled; |
| 332 } | 332 } |
| 333 | 333 |
| 334 // Calls SetAuth from the IO loop. | 334 // Calls SetAuth from the IO loop. |
| 335 void LoginHandler::SetAuthDeferred(const std::wstring& username, | 335 void LoginHandler::SetAuthDeferred(const std::wstring& username, |
| 336 const std::wstring& password) { | 336 const std::wstring& password) { |
| 337 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 337 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 338 | 338 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 // Public API | 462 // Public API |
| 463 | 463 |
| 464 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, | 464 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, |
| 465 net::URLRequest* request) { | 465 net::URLRequest* request) { |
| 466 LoginHandler* handler = LoginHandler::Create(auth_info, request); | 466 LoginHandler* handler = LoginHandler::Create(auth_info, request); |
| 467 BrowserThread::PostTask( | 467 BrowserThread::PostTask( |
| 468 BrowserThread::UI, FROM_HERE, new LoginDialogTask( | 468 BrowserThread::UI, FROM_HERE, new LoginDialogTask( |
| 469 request->url(), auth_info, handler)); | 469 request->url(), auth_info, handler)); |
| 470 return handler; | 470 return handler; |
| 471 } | 471 } |
| OLD | NEW |