| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 DestroyAccountChooser(); | 144 DestroyAccountChooser(); |
| 145 passwords_data_.OnAutomaticPasswordSave(std::move(form_manager)); | 145 passwords_data_.OnAutomaticPasswordSave(std::move(form_manager)); |
| 146 bubble_status_ = SHOULD_POP_UP; | 146 bubble_status_ = SHOULD_POP_UP; |
| 147 UpdateBubbleAndIconVisibility(); | 147 UpdateBubbleAndIconVisibility(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void ManagePasswordsUIController::OnPasswordAutofilled( | 150 void ManagePasswordsUIController::OnPasswordAutofilled( |
| 151 const autofill::PasswordFormMap& password_form_map, | 151 const autofill::PasswordFormMap& password_form_map, |
| 152 const GURL& origin, | 152 const GURL& origin, |
| 153 const std::vector<scoped_ptr<autofill::PasswordForm>>* federated_matches) { | 153 const std::vector<scoped_ptr<autofill::PasswordForm>>* federated_matches) { |
| 154 // If we fill a form while a dialog is open, then skip the state change; we | 154 // To change to managed state only when the managed state is more important |
| 155 // have | 155 // for the user that the current state. |
| 156 // the information we need, and the dialog will change its own state once the | 156 if (passwords_data_.state() == password_manager::ui::INACTIVE_STATE || |
| 157 // interaction is complete. | 157 passwords_data_.state() == password_manager::ui::MANAGE_STATE) { |
| 158 if (passwords_data_.state() != | |
| 159 password_manager::ui::AUTO_SIGNIN_STATE && | |
| 160 passwords_data_.state() != | |
| 161 password_manager::ui::CREDENTIAL_REQUEST_STATE) { | |
| 162 passwords_data_.OnPasswordAutofilled(password_form_map, origin, | 158 passwords_data_.OnPasswordAutofilled(password_form_map, origin, |
| 163 federated_matches); | 159 federated_matches); |
| 164 UpdateBubbleAndIconVisibility(); | 160 UpdateBubbleAndIconVisibility(); |
| 165 } | 161 } |
| 166 } | 162 } |
| 167 | 163 |
| 168 void ManagePasswordsUIController::OnLoginsChanged( | 164 void ManagePasswordsUIController::OnLoginsChanged( |
| 169 const password_manager::PasswordStoreChangeList& changes) { | 165 const password_manager::PasswordStoreChangeList& changes) { |
| 170 password_manager::ui::State current_state = GetState(); | 166 password_manager::ui::State current_state = GetState(); |
| 171 passwords_data_.ProcessLoginsChanged(changes); | 167 passwords_data_.ProcessLoginsChanged(changes); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); | 423 passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE); |
| 428 } | 424 } |
| 429 } | 425 } |
| 430 | 426 |
| 431 void ManagePasswordsUIController::WebContentsDestroyed() { | 427 void ManagePasswordsUIController::WebContentsDestroyed() { |
| 432 password_manager::PasswordStore* password_store = | 428 password_manager::PasswordStore* password_store = |
| 433 GetPasswordStore(web_contents()); | 429 GetPasswordStore(web_contents()); |
| 434 if (password_store) | 430 if (password_store) |
| 435 password_store->RemoveObserver(this); | 431 password_store->RemoveObserver(this); |
| 436 } | 432 } |
| OLD | NEW |