| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 UpdateBubbleAndIconVisibility(); | 385 UpdateBubbleAndIconVisibility(); |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 | 388 |
| 389 void ManagePasswordsUIController::ShowBubbleWithoutUserInteraction() { | 389 void ManagePasswordsUIController::ShowBubbleWithoutUserInteraction() { |
| 390 DCHECK(should_pop_up_bubble_); | 390 DCHECK(should_pop_up_bubble_); |
| 391 #if !defined(OS_ANDROID) | 391 #if !defined(OS_ANDROID) |
| 392 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); | 392 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
| 393 if (!browser || browser->toolbar_model()->input_in_progress()) | 393 if (!browser || browser->toolbar_model()->input_in_progress()) |
| 394 return; | 394 return; |
| 395 if (state_ == password_manager::ui::PENDING_PASSWORD_STATE && |
| 396 !password_bubble_experiment::ShouldShowBubble( |
| 397 browser->profile()->GetPrefs())) |
| 398 return; |
| 395 CommandUpdater* updater = browser->command_controller()->command_updater(); | 399 CommandUpdater* updater = browser->command_controller()->command_updater(); |
| 396 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); | 400 updater->ExecuteCommand(IDC_MANAGE_PASSWORDS_FOR_PAGE); |
| 397 #endif | 401 #endif |
| 398 } | 402 } |
| 399 | 403 |
| 400 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { | 404 bool ManagePasswordsUIController::PasswordPendingUserDecision() const { |
| 401 return state_ == password_manager::ui::PENDING_PASSWORD_STATE; | 405 return state_ == password_manager::ui::PENDING_PASSWORD_STATE; |
| 402 } | 406 } |
| 403 | 407 |
| 404 void ManagePasswordsUIController::WebContentsDestroyed() { | 408 void ManagePasswordsUIController::WebContentsDestroyed() { |
| 405 password_manager::PasswordStore* password_store = | 409 password_manager::PasswordStore* password_store = |
| 406 GetPasswordStore(web_contents()); | 410 GetPasswordStore(web_contents()); |
| 407 if (password_store) | 411 if (password_store) |
| 408 password_store->RemoveObserver(this); | 412 password_store->RemoveObserver(this); |
| 409 } | 413 } |
| 410 | 414 |
| 411 void ManagePasswordsUIController::SaveForms( | 415 void ManagePasswordsUIController::SaveForms( |
| 412 ScopedVector<autofill::PasswordForm> local_forms, | 416 ScopedVector<autofill::PasswordForm> local_forms, |
| 413 ScopedVector<autofill::PasswordForm> federated_forms) { | 417 ScopedVector<autofill::PasswordForm> federated_forms) { |
| 414 form_manager_.reset(); | 418 form_manager_.reset(); |
| 415 origin_ = GURL(); | 419 origin_ = GURL(); |
| 416 local_credentials_forms_.swap(local_forms); | 420 local_credentials_forms_.swap(local_forms); |
| 417 federated_credentials_forms_.swap(federated_forms); | 421 federated_credentials_forms_.swap(federated_forms); |
| 418 // The map is useless because usernames may overlap. | 422 // The map is useless because usernames may overlap. |
| 419 password_form_map_.clear(); | 423 password_form_map_.clear(); |
| 420 new_password_forms_.clear(); | 424 new_password_forms_.clear(); |
| 421 } | 425 } |
| OLD | NEW |