| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 password_manager::CredentialInfo info = | 211 password_manager::CredentialInfo info = |
| 212 password_manager::CredentialInfo(form, type_to_return); | 212 password_manager::CredentialInfo(form, type_to_return); |
| 213 passwords_data_.credentials_callback().Run(info); | 213 passwords_data_.credentials_callback().Run(info); |
| 214 passwords_data_.set_credentials_callback( | 214 passwords_data_.set_credentials_callback( |
| 215 ManagePasswordsState::CredentialsCallback()); | 215 ManagePasswordsState::CredentialsCallback()); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void ManagePasswordsUIController::SavePasswordInternal() { | 218 void ManagePasswordsUIController::SavePasswordInternal() { |
| 219 password_manager::PasswordFormManager* form_manager = | 219 password_manager::PasswordFormManager* form_manager = |
| 220 passwords_data_.form_manager(); | 220 passwords_data_.form_manager(); |
| 221 DCHECK(form_manager); | 221 // TODO(vasilii): it's not OK to call SavePassword() when |form_manager| is 0. |
| 222 form_manager->Save(); | 222 // If this is a cause of http://crbug.com/468474 then we should hide the |
| 223 // bubble when ManagePasswordsUIController changes its internal state. |
| 224 if (form_manager) |
| 225 form_manager->Save(); |
| 223 } | 226 } |
| 224 | 227 |
| 225 void ManagePasswordsUIController::NeverSavePassword() { | 228 void ManagePasswordsUIController::NeverSavePassword() { |
| 226 DCHECK(PasswordPendingUserDecision()); | 229 DCHECK(PasswordPendingUserDecision()); |
| 227 NeverSavePasswordInternal(); | 230 NeverSavePasswordInternal(); |
| 228 passwords_data_.TransitionToState(password_manager::ui::BLACKLIST_STATE); | 231 passwords_data_.TransitionToState(password_manager::ui::BLACKLIST_STATE); |
| 229 UpdateBubbleAndIconVisibility(); | 232 UpdateBubbleAndIconVisibility(); |
| 230 } | 233 } |
| 231 | 234 |
| 232 void ManagePasswordsUIController::NeverSavePasswordInternal() { | 235 void ManagePasswordsUIController::NeverSavePasswordInternal() { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); | 340 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); |
| 338 #endif | 341 #endif |
| 339 } | 342 } |
| 340 | 343 |
| 341 void ManagePasswordsUIController::WebContentsDestroyed() { | 344 void ManagePasswordsUIController::WebContentsDestroyed() { |
| 342 password_manager::PasswordStore* password_store = | 345 password_manager::PasswordStore* password_store = |
| 343 GetPasswordStore(web_contents()); | 346 GetPasswordStore(web_contents()); |
| 344 if (password_store) | 347 if (password_store) |
| 345 password_store->RemoveObserver(this); | 348 password_store->RemoveObserver(this); |
| 346 } | 349 } |
| OLD | NEW |