| 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 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "chrome/browser/ui/passwords/manage_passwords_state.h" | 12 #include "chrome/browser/ui/passwords/manage_passwords_state.h" |
| 12 #include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h" | 13 #include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h" |
| 13 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" | 14 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" |
| 14 #include "chrome/common/features.h" | 15 #include "chrome/common/features.h" |
| 15 #include "components/password_manager/core/browser/password_store.h" | 16 #include "components/password_manager/core/browser/password_store.h" |
| 16 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
| 17 #include "content/public/browser/web_contents_user_data.h" | 18 #include "content/public/browser/web_contents_user_data.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const password_manager::PasswordStoreChangeList& changes) override; | 73 const password_manager::PasswordStoreChangeList& changes) override; |
| 73 | 74 |
| 74 // Set the state of the Omnibox icon, and possibly show the associated bubble | 75 // Set the state of the Omnibox icon, and possibly show the associated bubble |
| 75 // without user interaction. | 76 // without user interaction. |
| 76 virtual void UpdateIconAndBubbleState(ManagePasswordsIconView* icon); | 77 virtual void UpdateIconAndBubbleState(ManagePasswordsIconView* icon); |
| 77 | 78 |
| 78 bool IsAutomaticallyOpeningBubble() const { | 79 bool IsAutomaticallyOpeningBubble() const { |
| 79 return bubble_status_ == SHOULD_POP_UP; | 80 return bubble_status_ == SHOULD_POP_UP; |
| 80 } | 81 } |
| 81 | 82 |
| 83 base::WeakPtr<PasswordsModelDelegate> GetModelDelegateProxy(); |
| 84 |
| 82 // PasswordsModelDelegate: | 85 // PasswordsModelDelegate: |
| 86 content::WebContents* GetWebContents() const override; |
| 83 const GURL& GetOrigin() const override; | 87 const GURL& GetOrigin() const override; |
| 84 password_manager::ui::State GetState() const override; | 88 password_manager::ui::State GetState() const override; |
| 85 const autofill::PasswordForm& GetPendingPassword() const override; | 89 const autofill::PasswordForm& GetPendingPassword() const override; |
| 86 bool IsPasswordOverridden() const override; | 90 bool IsPasswordOverridden() const override; |
| 87 const std::vector<const autofill::PasswordForm*>& GetCurrentForms() | 91 const std::vector<const autofill::PasswordForm*>& GetCurrentForms() |
| 88 const override; | 92 const override; |
| 89 const std::vector<const autofill::PasswordForm*>& GetFederatedForms() | 93 const std::vector<const autofill::PasswordForm*>& GetFederatedForms() |
| 90 const override; | 94 const override; |
| 91 password_manager::InteractionsStats* GetCurrentInteractionStats() const | 95 password_manager::InteractionsStats* GetCurrentInteractionStats() const |
| 92 override; | 96 override; |
| 93 void OnBubbleShown() override; | 97 void OnBubbleShown() override; |
| 94 void OnBubbleHidden() override; | 98 void OnBubbleHidden() override; |
| 95 void OnNoInteractionOnUpdate() override; | 99 void OnNoInteractionOnUpdate() override; |
| 96 void OnNopeUpdateClicked() override; | 100 void OnNopeUpdateClicked() override; |
| 97 void NeverSavePassword() override; | 101 void NeverSavePassword() override; |
| 98 void SavePassword() override; | 102 void SavePassword() override; |
| 99 void UpdatePassword(const autofill::PasswordForm& password_form) override; | 103 void UpdatePassword(const autofill::PasswordForm& password_form) override; |
| 100 void ChooseCredential( | 104 void ChooseCredential( |
| 101 autofill::PasswordForm form, | 105 const autofill::PasswordForm& form, |
| 102 password_manager::CredentialType credential_type) override; | 106 password_manager::CredentialType credential_type) override; |
| 103 void NavigateToExternalPasswordManager() override; | 107 void NavigateToExternalPasswordManager() override; |
| 104 void NavigateToSmartLockHelpPage() override; | 108 void NavigateToSmartLockHelpPage() override; |
| 105 void NavigateToPasswordManagerSettingsPage() override; | 109 void NavigateToPasswordManagerSettingsPage() override; |
| 106 void NavigateToChromeSignIn() override; | 110 void NavigateToChromeSignIn() override; |
| 107 void OnDialogHidden() override; | 111 void OnDialogHidden() override; |
| 108 | 112 |
| 109 protected: | 113 protected: |
| 110 explicit ManagePasswordsUIController( | 114 explicit ManagePasswordsUIController( |
| 111 content::WebContents* web_contents); | 115 content::WebContents* web_contents); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void WebContentsDestroyed() override; | 169 void WebContentsDestroyed() override; |
| 166 | 170 |
| 167 // The wrapper around current state and data. | 171 // The wrapper around current state and data. |
| 168 ManagePasswordsState passwords_data_; | 172 ManagePasswordsState passwords_data_; |
| 169 | 173 |
| 170 // The controller for the blocking dialogs. | 174 // The controller for the blocking dialogs. |
| 171 std::unique_ptr<PasswordDialogControllerImpl> dialog_controller_; | 175 std::unique_ptr<PasswordDialogControllerImpl> dialog_controller_; |
| 172 | 176 |
| 173 BubbleStatus bubble_status_; | 177 BubbleStatus bubble_status_; |
| 174 | 178 |
| 179 // The bubbles of different types can pop up unpredictably superseding each |
| 180 // other. However, closing the bubble may affect the state of |
| 181 // ManagePasswordsUIController internally. This is undesired if |
| 182 // ManagePasswordsUIController is in the process of opening a new bubble. The |
| 183 // situation is worse on Windows where the bubble is destroyed asynchronously. |
| 184 // Thus, OnBubbleHidden() can be called after the new one is shown. By that |
| 185 // time the internal state of ManagePasswordsUIController has nothing to do |
| 186 // with the old bubble. |
| 187 // Invalidating all the weak pointers will detach the current bubble. |
| 188 base::WeakPtrFactory<ManagePasswordsUIController> weak_ptr_factory_; |
| 189 |
| 175 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController); | 190 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController); |
| 176 }; | 191 }; |
| 177 | 192 |
| 178 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ | 193 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ |
| OLD | NEW |