| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/login_prompt.h" | 5 #include "chrome/browser/login_prompt.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lock.h" | 8 #include "base/lock.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 virtual ~LoginDialogTask() { | 333 virtual ~LoginDialogTask() { |
| 334 } | 334 } |
| 335 | 335 |
| 336 void Run() { | 336 void Run() { |
| 337 WebContents* parent_contents = handler_->GetWebContentsForLogin(); | 337 WebContents* parent_contents = handler_->GetWebContentsForLogin(); |
| 338 if (!parent_contents) { | 338 if (!parent_contents) { |
| 339 // The request was probably cancelled. | 339 // The request was probably cancelled. |
| 340 return; | 340 return; |
| 341 } | 341 } |
| 342 | 342 |
| 343 wstring explanation = l10n_util::GetStringF(IDS_LOGIN_DIALOG_DESCRIPTION, | 343 wstring explanation = auth_info_->realm.empty() ? |
| 344 auth_info_->host, | 344 l10n_util::GetStringF(IDS_LOGIN_DIALOG_DESCRIPTION_NO_REALM, |
| 345 auth_info_->realm); | 345 auth_info_->host) : |
| 346 l10n_util::GetStringF(IDS_LOGIN_DIALOG_DESCRIPTION, |
| 347 auth_info_->host, |
| 348 auth_info_->realm); |
| 346 LoginView* view = new LoginView(explanation); | 349 LoginView* view = new LoginView(explanation); |
| 347 // Tell the password manager to look for saved passwords. There is only | 350 // Tell the password manager to look for saved passwords. There is only |
| 348 // a password manager when dealing with a WebContents type. | 351 // a password manager when dealing with a WebContents type. |
| 349 if (parent_contents->type() == TAB_CONTENTS_WEB) { | 352 if (parent_contents->type() == TAB_CONTENTS_WEB) { |
| 350 PasswordManager* password_manager = | 353 PasswordManager* password_manager = |
| 351 parent_contents->AsWebContents()->GetPasswordManager(); | 354 parent_contents->AsWebContents()->GetPasswordManager(); |
| 352 // Set the model for the login view. The model (password manager) is owned | 355 // Set the model for the login view. The model (password manager) is owned |
| 353 // by the view's parent TabContents, so natural destruction order means we | 356 // by the view's parent TabContents, so natural destruction order means we |
| 354 // don't have to worry about calling SetModel(NULL), because the view will | 357 // don't have to worry about calling SetModel(NULL), because the view will |
| 355 // be deleted before the password manager. | 358 // be deleted before the password manager. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 // Public API | 404 // Public API |
| 402 | 405 |
| 403 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, | 406 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, |
| 404 URLRequest* request, | 407 URLRequest* request, |
| 405 MessageLoop* ui_loop) { | 408 MessageLoop* ui_loop) { |
| 406 LoginHandlerImpl* handler = new LoginHandlerImpl(request, ui_loop); | 409 LoginHandlerImpl* handler = new LoginHandlerImpl(request, ui_loop); |
| 407 ui_loop->PostTask(FROM_HERE, new LoginDialogTask(auth_info, handler)); | 410 ui_loop->PostTask(FROM_HERE, new LoginDialogTask(auth_info, handler)); |
| 408 return handler; | 411 return handler; |
| 409 } | 412 } |
| 410 | 413 |
| OLD | NEW |