Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ui_controller.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 10 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 10 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 #endif | 198 #endif |
| 199 } | 199 } |
| 200 | 200 |
| 201 void ManagePasswordsUIController::SavePassword() { | 201 void ManagePasswordsUIController::SavePassword() { |
| 202 DCHECK(PasswordPendingUserDecision()); | 202 DCHECK(PasswordPendingUserDecision()); |
| 203 SavePasswordInternal(); | 203 SavePasswordInternal(); |
| 204 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); | 204 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); |
| 205 UpdateBubbleAndIconVisibility(); | 205 UpdateBubbleAndIconVisibility(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void ManagePasswordsUIController::UpdatePassword( | |
| 209 const autofill::PasswordForm& password_form) { | |
| 210 DCHECK(PasswordPendingUserDecision()); | |
| 211 UpdatePasswordInternal(password_form); | |
| 212 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); | |
| 213 UpdateBubbleAndIconVisibility(); | |
| 214 } | |
| 215 | |
| 208 void ManagePasswordsUIController::ChooseCredential( | 216 void ManagePasswordsUIController::ChooseCredential( |
| 209 const autofill::PasswordForm& form, | 217 const autofill::PasswordForm& form, |
| 210 password_manager::CredentialType credential_type) { | 218 password_manager::CredentialType credential_type) { |
| 211 DCHECK_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, state()); | 219 DCHECK_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, state()); |
| 212 DCHECK(!passwords_data_.credentials_callback().is_null()); | 220 DCHECK(!passwords_data_.credentials_callback().is_null()); |
| 213 | 221 |
| 214 // Here, |credential_type| refers to whether the credential was originally | 222 // Here, |credential_type| refers to whether the credential was originally |
| 215 // passed into ::OnChooseCredentials as part of the |local_credentials| or | 223 // passed into ::OnChooseCredentials as part of the |local_credentials| or |
| 216 // |federated_credentials| lists (e.g. whether it is an existing credential | 224 // |federated_credentials| lists (e.g. whether it is an existing credential |
| 217 // saved for this origin, or whether we should synthesize a new | 225 // saved for this origin, or whether we should synthesize a new |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 245 ManagePasswordsState::CredentialsCallback()); | 253 ManagePasswordsState::CredentialsCallback()); |
| 246 } | 254 } |
| 247 | 255 |
| 248 void ManagePasswordsUIController::SavePasswordInternal() { | 256 void ManagePasswordsUIController::SavePasswordInternal() { |
| 249 password_manager::PasswordFormManager* form_manager = | 257 password_manager::PasswordFormManager* form_manager = |
| 250 passwords_data_.form_manager(); | 258 passwords_data_.form_manager(); |
| 251 DCHECK(form_manager); | 259 DCHECK(form_manager); |
| 252 form_manager->Save(); | 260 form_manager->Save(); |
| 253 } | 261 } |
| 254 | 262 |
| 263 void ManagePasswordsUIController::UpdatePasswordInternal( | |
| 264 const autofill::PasswordForm& password_form) { | |
| 265 password_manager::PasswordFormManager* form_manager = | |
| 266 passwords_data_.form_manager(); | |
| 267 DCHECK(form_manager); | |
|
vabr (Chromium)
2015/06/19 18:03:16
Please remove this DCHECK, it is not very useful.
dvadym
2015/06/22 14:43:33
Done.
| |
| 268 form_manager->Update(password_form); | |
| 269 } | |
| 270 | |
| 255 void ManagePasswordsUIController::NeverSavePassword() { | 271 void ManagePasswordsUIController::NeverSavePassword() { |
| 256 DCHECK(PasswordPendingUserDecision()); | 272 DCHECK(PasswordPendingUserDecision()); |
| 257 NeverSavePasswordInternal(); | 273 NeverSavePasswordInternal(); |
| 258 passwords_data_.TransitionToState(password_manager::ui::BLACKLIST_STATE); | 274 passwords_data_.TransitionToState(password_manager::ui::BLACKLIST_STATE); |
| 259 UpdateBubbleAndIconVisibility(); | 275 UpdateBubbleAndIconVisibility(); |
| 260 } | 276 } |
| 261 | 277 |
| 262 void ManagePasswordsUIController::NeverSavePasswordInternal() { | 278 void ManagePasswordsUIController::NeverSavePasswordInternal() { |
| 263 password_manager::PasswordFormManager* form_manager = | 279 password_manager::PasswordFormManager* form_manager = |
| 264 passwords_data_.form_manager(); | 280 passwords_data_.form_manager(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); | 380 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); |
| 365 #endif | 381 #endif |
| 366 } | 382 } |
| 367 | 383 |
| 368 void ManagePasswordsUIController::WebContentsDestroyed() { | 384 void ManagePasswordsUIController::WebContentsDestroyed() { |
| 369 password_manager::PasswordStore* password_store = | 385 password_manager::PasswordStore* password_store = |
| 370 GetPasswordStore(web_contents()); | 386 GetPasswordStore(web_contents()); |
| 371 if (password_store) | 387 if (password_store) |
| 372 password_store->RemoveObserver(this); | 388 password_store->RemoveObserver(this); |
| 373 } | 389 } |
| OLD | NEW |