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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
23 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
24 #include "net/base/auth.h" | 24 #include "net/base/auth.h" |
25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
26 #include "net/http/http_transaction_factory.h" | 26 #include "net/http/http_transaction_factory.h" |
27 #include "net/url_request/url_request.h" | 27 #include "net/url_request/url_request.h" |
28 #include "net/url_request/url_request_context.h" | 28 #include "net/url_request/url_request_context.h" |
29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
30 #include "ui/base/text/text_elider.h" | 30 #include "ui/base/text/text_elider.h" |
31 | 31 |
| 32 using autofill::PasswordForm; |
32 using content::BrowserThread; | 33 using content::BrowserThread; |
33 using content::NavigationController; | 34 using content::NavigationController; |
34 using content::RenderViewHost; | 35 using content::RenderViewHost; |
35 using content::RenderViewHostDelegate; | 36 using content::RenderViewHostDelegate; |
36 using content::ResourceDispatcherHost; | 37 using content::ResourceDispatcherHost; |
37 using content::ResourceRequestInfo; | 38 using content::ResourceRequestInfo; |
38 using content::WebContents; | 39 using content::WebContents; |
39 using content::PasswordForm; | |
40 | 40 |
41 class LoginHandlerImpl; | 41 class LoginHandlerImpl; |
42 | 42 |
43 // Helper to remove the ref from an net::URLRequest to the LoginHandler. | 43 // Helper to remove the ref from an net::URLRequest to the LoginHandler. |
44 // Should only be called from the IO thread, since it accesses an | 44 // Should only be called from the IO thread, since it accesses an |
45 // net::URLRequest. | 45 // net::URLRequest. |
46 void ResetLoginHandlerForRequest(net::URLRequest* request) { | 46 void ResetLoginHandlerForRequest(net::URLRequest* request) { |
47 ResourceDispatcherHost::Get()->ClearLoginDelegateForRequest(request); | 47 ResourceDispatcherHost::Get()->ClearLoginDelegateForRequest(request); |
48 } | 48 } |
49 | 49 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)) << | 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)) << |
106 "Why is OnRequestCancelled called from the UI thread?"; | 106 "Why is OnRequestCancelled called from the UI thread?"; |
107 | 107 |
108 // Reference is no longer valid. | 108 // Reference is no longer valid. |
109 request_ = NULL; | 109 request_ = NULL; |
110 | 110 |
111 // Give up on auth if the request was cancelled. | 111 // Give up on auth if the request was cancelled. |
112 CancelAuth(); | 112 CancelAuth(); |
113 } | 113 } |
114 | 114 |
115 void LoginHandler::SetPasswordForm(const content::PasswordForm& form) { | 115 void LoginHandler::SetPasswordForm(const autofill::PasswordForm& form) { |
116 password_form_ = form; | 116 password_form_ = form; |
117 } | 117 } |
118 | 118 |
119 void LoginHandler::SetPasswordManager(PasswordManager* password_manager) { | 119 void LoginHandler::SetPasswordManager(PasswordManager* password_manager) { |
120 password_manager_ = password_manager; | 120 password_manager_ = password_manager; |
121 } | 121 } |
122 | 122 |
123 WebContents* LoginHandler::GetWebContentsForLogin() const { | 123 WebContents* LoginHandler::GetWebContentsForLogin() const { |
124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
125 | 125 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 459 |
460 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, | 460 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, |
461 net::URLRequest* request) { | 461 net::URLRequest* request) { |
462 LoginHandler* handler = LoginHandler::Create(auth_info, request); | 462 LoginHandler* handler = LoginHandler::Create(auth_info, request); |
463 BrowserThread::PostTask( | 463 BrowserThread::PostTask( |
464 BrowserThread::UI, FROM_HERE, | 464 BrowserThread::UI, FROM_HERE, |
465 base::Bind(&LoginDialogCallback, request->url(), | 465 base::Bind(&LoginDialogCallback, request->url(), |
466 make_scoped_refptr(auth_info), make_scoped_refptr(handler))); | 466 make_scoped_refptr(auth_info), make_scoped_refptr(handler))); |
467 return handler; | 467 return handler; |
468 } | 468 } |
OLD | NEW |