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 "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
6 | 6 |
7 #include "chrome/browser/password_manager/password_store_factory.h" | 7 #include "chrome/browser/password_manager/password_store_factory.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
10 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 10 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( | 48 ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( |
49 content::WebContents* web_contents) | 49 content::WebContents* web_contents) |
50 : content::WebContentsObserver(web_contents), | 50 : content::WebContentsObserver(web_contents), |
51 display_disposition_( | 51 display_disposition_( |
52 metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING), | 52 metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING), |
53 dismissal_reason_(metrics_util::NOT_DISPLAYED) { | 53 dismissal_reason_(metrics_util::NOT_DISPLAYED) { |
54 ManagePasswordsUIController* controller = | 54 ManagePasswordsUIController* controller = |
55 ManagePasswordsUIController::FromWebContents(web_contents); | 55 ManagePasswordsUIController::FromWebContents(web_contents); |
56 | 56 |
| 57 origin_ = controller->origin(); |
57 state_ = controller->state(); | 58 state_ = controller->state(); |
58 if (password_manager::ui::IsPendingState(state_)) | 59 if (password_manager::ui::IsPendingState(state_)) |
59 pending_password_ = controller->PendingPassword(); | 60 pending_password_ = controller->PendingPassword(); |
60 if (password_manager::ui::IsCredentialsState(state_)) | 61 if (password_manager::ui::IsCredentialsState(state_)) |
61 pending_credentials_.swap(controller->new_password_forms()); | 62 pending_credentials_.swap(controller->new_password_forms()); |
62 else | 63 else |
63 best_matches_ = controller->best_matches(); | 64 best_matches_ = controller->best_matches(); |
64 | 65 |
65 if (password_manager::ui::IsPendingState(state_)) { | 66 if (password_manager::ui::IsPendingState(state_)) { |
66 title_ = l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD); | 67 title_ = l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD); |
67 } else if (state_ == password_manager::ui::BLACKLIST_STATE) { | 68 } else if (state_ == password_manager::ui::BLACKLIST_STATE) { |
68 title_ = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_BLACKLISTED_TITLE); | 69 title_ = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_BLACKLISTED_TITLE); |
69 } else if (state_ == password_manager::ui::CONFIRMATION_STATE) { | 70 } else if (state_ == password_manager::ui::CONFIRMATION_STATE) { |
70 title_ = | 71 title_ = |
71 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TITLE); | 72 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TITLE); |
72 } else if (password_manager::ui::IsCredentialsState(state_)) { | 73 } else if (password_manager::ui::IsCredentialsState(state_)) { |
73 title_ = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_CHOOSE_TITLE); | 74 title_ = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_CHOOSE_TITLE); |
| 75 } else if (state_ == password_manager::ui::ASK_SUBMIT_URL_AND_BUBBLE_STATE) { |
| 76 title_ = |
| 77 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_ASK_TO_SUBMIT_URL_TITLE); |
74 } else { | 78 } else { |
75 title_ = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_TITLE); | 79 title_ = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_TITLE); |
76 } | 80 } |
77 | 81 |
78 base::string16 save_confirmation_link = | 82 base::string16 save_confirmation_link = |
79 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_LINK); | 83 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_LINK); |
80 size_t offset; | 84 size_t offset; |
81 save_confirmation_text_ = | 85 save_confirmation_text_ = |
82 l10n_util::GetStringFUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT, | 86 l10n_util::GetStringFUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT, |
83 save_confirmation_link, &offset); | 87 save_confirmation_link, &offset); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 223 |
220 // static | 224 // static |
221 int ManagePasswordsBubbleModel::UsernameFieldWidth() { | 225 int ManagePasswordsBubbleModel::UsernameFieldWidth() { |
222 return GetFieldWidth(USERNAME_FIELD); | 226 return GetFieldWidth(USERNAME_FIELD); |
223 } | 227 } |
224 | 228 |
225 // static | 229 // static |
226 int ManagePasswordsBubbleModel::PasswordFieldWidth() { | 230 int ManagePasswordsBubbleModel::PasswordFieldWidth() { |
227 return GetFieldWidth(PASSWORD_FIELD); | 231 return GetFieldWidth(PASSWORD_FIELD); |
228 } | 232 } |
OLD | NEW |