OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/browser/shell_login_dialog.h" | 5 #include "content/shell/browser/shell_login_dialog.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "components/url_formatter/elide_url.h" |
11 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/resource_dispatcher_host.h" | 13 #include "content/public/browser/resource_dispatcher_host.h" |
13 #include "net/base/auth.h" | 14 #include "net/base/auth.h" |
14 #include "net/url_request/url_request.h" | 15 #include "net/url_request/url_request.h" |
15 #include "ui/gfx/text_elider.h" | 16 #include "ui/gfx/text_elider.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 ShellLoginDialog::ShellLoginDialog( | 20 ShellLoginDialog::ShellLoginDialog( |
20 net::AuthChallengeInfo* auth_info, | 21 net::AuthChallengeInfo* auth_info, |
21 net::URLRequest* request) : auth_info_(auth_info), | 22 net::URLRequest* request) : auth_info_(auth_info), |
22 request_(request) { | 23 request_(request) { |
23 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 24 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
24 BrowserThread::PostTask( | 25 BrowserThread::PostTask( |
25 BrowserThread::UI, FROM_HERE, | 26 BrowserThread::UI, FROM_HERE, |
26 base::Bind(&ShellLoginDialog::PrepDialog, this, | 27 base::Bind( |
27 base::ASCIIToUTF16(auth_info->challenger.ToString()), | 28 &ShellLoginDialog::PrepDialog, this, |
28 base::UTF8ToUTF16(auth_info->realm))); | 29 url_formatter::FormatOriginForSecurityDisplay(auth_info->challenger), |
| 30 base::UTF8ToUTF16(auth_info->realm))); |
29 } | 31 } |
30 | 32 |
31 void ShellLoginDialog::OnRequestCancelled() { | 33 void ShellLoginDialog::OnRequestCancelled() { |
32 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 34 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
33 BrowserThread::PostTask( | 35 BrowserThread::PostTask( |
34 BrowserThread::UI, FROM_HERE, | 36 BrowserThread::UI, FROM_HERE, |
35 base::Bind(&ShellLoginDialog::PlatformRequestCancelled, this)); | 37 base::Bind(&ShellLoginDialog::PlatformRequestCancelled, this)); |
36 } | 38 } |
37 | 39 |
38 void ShellLoginDialog::UserAcceptedAuth(const base::string16& username, | 40 void ShellLoginDialog::UserAcceptedAuth(const base::string16& username, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 else | 101 else |
100 request_->CancelAuth(); | 102 request_->CancelAuth(); |
101 ResourceDispatcherHost::Get()->ClearLoginDelegateForRequest(request_); | 103 ResourceDispatcherHost::Get()->ClearLoginDelegateForRequest(request_); |
102 | 104 |
103 BrowserThread::PostTask( | 105 BrowserThread::PostTask( |
104 BrowserThread::UI, FROM_HERE, | 106 BrowserThread::UI, FROM_HERE, |
105 base::Bind(&ShellLoginDialog::PlatformCleanUp, this)); | 107 base::Bind(&ShellLoginDialog::PlatformCleanUp, this)); |
106 } | 108 } |
107 | 109 |
108 } // namespace content | 110 } // namespace content |
OLD | NEW |