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 #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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 struct CredentialInfo; | 25 struct CredentialInfo; |
| 26 struct InteractionsStats; | 26 struct InteractionsStats; |
| 27 class PasswordFormManager; | 27 class PasswordFormManager; |
| 28 } | 28 } |
| 29 | 29 |
| 30 class AccountChooserPrompt; | 30 class AccountChooserPrompt; |
| 31 class AutoSigninFirstRunPrompt; | 31 class AutoSigninFirstRunPrompt; |
| 32 class ManagePasswordsIconView; | 32 class ManagePasswordsIconView; |
| 33 class PasswordDialogController; | 33 class PasswordDialogController; |
| 34 class PasswordDialogControllerImpl; | 34 class PasswordDialogControllerImpl; |
| 35 class PasswordsModelDelegateProxy; | |
| 35 | 36 |
| 36 // Per-tab class to control the Omnibox password icon and bubble. | 37 // Per-tab class to control the Omnibox password icon and bubble. |
| 37 class ManagePasswordsUIController | 38 class ManagePasswordsUIController |
| 38 : public content::WebContentsObserver, | 39 : public content::WebContentsObserver, |
| 39 public content::WebContentsUserData<ManagePasswordsUIController>, | 40 public content::WebContentsUserData<ManagePasswordsUIController>, |
| 40 public password_manager::PasswordStore::Observer, | 41 public password_manager::PasswordStore::Observer, |
| 41 public PasswordsModelDelegate, | 42 public PasswordsModelDelegate, |
| 42 public PasswordsClientUIDelegate { | 43 public PasswordsClientUIDelegate { |
| 43 public: | 44 public: |
| 44 ~ManagePasswordsUIController() override; | 45 ~ManagePasswordsUIController() override; |
| (...skipping 27 matching lines...) Expand all 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 PasswordsModelDelegateProxy* GetModelDelegateProxy() const { | |
| 84 return bubble_delegate_proxy_.get(); | |
| 85 } | |
| 86 | |
| 82 // PasswordsModelDelegate: | 87 // PasswordsModelDelegate: |
| 88 content::WebContents* GetWebContents() const override; | |
| 83 const GURL& GetOrigin() const override; | 89 const GURL& GetOrigin() const override; |
| 84 password_manager::ui::State GetState() const override; | 90 password_manager::ui::State GetState() const override; |
| 85 const autofill::PasswordForm& GetPendingPassword() const override; | 91 const autofill::PasswordForm& GetPendingPassword() const override; |
| 86 bool IsPasswordOverridden() const override; | 92 bool IsPasswordOverridden() const override; |
| 87 const std::vector<const autofill::PasswordForm*>& GetCurrentForms() | 93 const std::vector<const autofill::PasswordForm*>& GetCurrentForms() |
| 88 const override; | 94 const override; |
| 89 const std::vector<const autofill::PasswordForm*>& GetFederatedForms() | 95 const std::vector<const autofill::PasswordForm*>& GetFederatedForms() |
| 90 const override; | 96 const override; |
| 91 password_manager::InteractionsStats* GetCurrentInteractionStats() const | 97 password_manager::InteractionsStats* GetCurrentInteractionStats() const |
| 92 override; | 98 override; |
| 93 void OnBubbleShown() override; | 99 void OnBubbleShown() override; |
| 94 void OnBubbleHidden() override; | 100 void OnBubbleHidden() override; |
| 95 void OnNoInteractionOnUpdate() override; | 101 void OnNoInteractionOnUpdate() override; |
| 96 void OnNopeUpdateClicked() override; | 102 void OnNopeUpdateClicked() override; |
| 97 void NeverSavePassword() override; | 103 void NeverSavePassword() override; |
| 98 void SavePassword() override; | 104 void SavePassword() override; |
| 99 void UpdatePassword(const autofill::PasswordForm& password_form) override; | 105 void UpdatePassword(const autofill::PasswordForm& password_form) override; |
| 100 void ChooseCredential( | 106 void ChooseCredential( |
| 101 autofill::PasswordForm form, | 107 const autofill::PasswordForm& form, |
| 102 password_manager::CredentialType credential_type) override; | 108 password_manager::CredentialType credential_type) override; |
| 103 void NavigateToExternalPasswordManager() override; | 109 void NavigateToExternalPasswordManager() override; |
| 104 void NavigateToSmartLockHelpPage() override; | 110 void NavigateToSmartLockHelpPage() override; |
| 105 void NavigateToPasswordManagerSettingsPage() override; | 111 void NavigateToPasswordManagerSettingsPage() override; |
| 106 void NavigateToChromeSignIn() override; | 112 void NavigateToChromeSignIn() override; |
| 107 void OnDialogHidden() override; | 113 void OnDialogHidden() override; |
| 108 | 114 |
| 109 protected: | 115 protected: |
| 110 explicit ManagePasswordsUIController( | 116 explicit ManagePasswordsUIController( |
| 111 content::WebContents* web_contents); | 117 content::WebContents* web_contents); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 | 169 |
| 164 // content::WebContentsObserver: | 170 // content::WebContentsObserver: |
| 165 void WebContentsDestroyed() override; | 171 void WebContentsDestroyed() override; |
| 166 | 172 |
| 167 // The wrapper around current state and data. | 173 // The wrapper around current state and data. |
| 168 ManagePasswordsState passwords_data_; | 174 ManagePasswordsState passwords_data_; |
| 169 | 175 |
| 170 // The controller for the blocking dialogs. | 176 // The controller for the blocking dialogs. |
| 171 std::unique_ptr<PasswordDialogControllerImpl> dialog_controller_; | 177 std::unique_ptr<PasswordDialogControllerImpl> dialog_controller_; |
| 172 | 178 |
| 179 // A proxy for the bubble. The bubbles of different types can pop up | |
|
sky
2016/08/03 19:42:00
Forgive me if I am misunderstanding the problem, b
vasilii
2016/08/04 09:29:13
I do close the existing bubble and ignore anything
| |
| 180 // unpredictably superseding each other. However, closing the bubble may | |
| 181 // affect the state of ManagePasswordsUIController internally. This is | |
| 182 // undesired if ManagePasswordsUIController is in the process of opening a new | |
| 183 // bubble. The situation is worse on Windows where the bubble is destroyed | |
| 184 // asynchronously. Thus, OnBubbleHidden() can be called after the new one is | |
| 185 // shown. By that time the internal state of ManagePasswordsUIController has | |
| 186 // nothing to do with the old bubble. | |
| 187 std::unique_ptr<PasswordsModelDelegateProxy> bubble_delegate_proxy_; | |
| 188 | |
| 173 BubbleStatus bubble_status_; | 189 BubbleStatus bubble_status_; |
| 174 | 190 |
| 175 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController); | 191 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController); |
| 176 }; | 192 }; |
| 177 | 193 |
| 178 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ | 194 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ |
| OLD | NEW |