| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BUBBLE_UI_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "components/password_manager/core/browser/password_form_manager.h" | 8 #include "components/password_manager/core/browser/password_form_manager.h" |
| 9 #include "components/password_manager/core/browser/password_store.h" | 9 #include "components/password_manager/core/browser/password_store.h" |
| 10 #include "components/password_manager/core/browser/password_store_change.h" | 10 #include "components/password_manager/core/browser/password_store_change.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // the manage password icon. | 36 // the manage password icon. |
| 37 void OnPasswordAutofilled(const autofill::PasswordFormMap& password_form_map); | 37 void OnPasswordAutofilled(const autofill::PasswordFormMap& password_form_map); |
| 38 | 38 |
| 39 // Called when a form is _not_ autofilled due to user blacklisting. | 39 // Called when a form is _not_ autofilled due to user blacklisting. |
| 40 void OnBlacklistBlockedAutofill(); | 40 void OnBlacklistBlockedAutofill(); |
| 41 | 41 |
| 42 // PasswordStore::Observer implementation. | 42 // PasswordStore::Observer implementation. |
| 43 virtual void OnLoginsChanged( | 43 virtual void OnLoginsChanged( |
| 44 const password_manager::PasswordStoreChangeList& changes) OVERRIDE; | 44 const password_manager::PasswordStoreChangeList& changes) OVERRIDE; |
| 45 | 45 |
| 46 void SavePassword(); | 46 // Called from the model when the user chooses to save a password; passes the |
| 47 // action off to the FormManager. |
| 48 virtual void SavePassword(); |
| 47 | 49 |
| 48 void NeverSavePassword(); | 50 // Called from the model when the user chooses to never save passwords; passes |
| 51 // the action off to the FormManager. |
| 52 virtual void NeverSavePassword(); |
| 49 | 53 |
| 50 // Called when the bubble is opened after the icon gets displayed. We change | 54 // Called when the bubble is opened after the icon gets displayed. We change |
| 51 // the state to know that we do not need to pop up the bubble again. | 55 // the state to know that we do not need to pop up the bubble again. |
| 52 void OnBubbleShown(); | 56 void OnBubbleShown(); |
| 53 | 57 |
| 58 // Open a new tab, pointing to the password manager settings page. |
| 59 virtual void NavigateToPasswordManagerSettingsPage(); |
| 60 |
| 61 virtual const autofill::PasswordForm& PendingCredentials() const; |
| 62 |
| 54 bool manage_passwords_icon_to_be_shown() const { | 63 bool manage_passwords_icon_to_be_shown() const { |
| 55 return manage_passwords_icon_to_be_shown_; | 64 return manage_passwords_icon_to_be_shown_; |
| 56 } | 65 } |
| 57 | 66 |
| 58 bool password_to_be_saved() const { | 67 bool password_to_be_saved() const { |
| 59 return password_to_be_saved_; | 68 return password_to_be_saved_; |
| 60 } | 69 } |
| 61 | 70 |
| 62 bool manage_passwords_bubble_needs_showing() const { | 71 bool manage_passwords_bubble_needs_showing() const { |
| 63 return manage_passwords_bubble_needs_showing_; | 72 return manage_passwords_bubble_needs_showing_; |
| 64 } | 73 } |
| 65 | 74 |
| 66 void unset_manage_passwords_bubble_needs_showing() { | 75 void unset_manage_passwords_bubble_needs_showing() { |
| 67 manage_passwords_bubble_needs_showing_ = false; | 76 manage_passwords_bubble_needs_showing_ = false; |
| 68 } | 77 } |
| 69 | 78 |
| 70 void unset_password_to_be_saved() { | 79 void unset_password_to_be_saved() { |
| 71 password_to_be_saved_ = false; | 80 password_to_be_saved_ = false; |
| 72 } | 81 } |
| 73 | 82 |
| 74 const autofill::PasswordForm& pending_credentials() const { | |
| 75 return form_manager_->pending_credentials(); | |
| 76 } | |
| 77 | |
| 78 const autofill::PasswordFormMap best_matches() const { | 83 const autofill::PasswordFormMap best_matches() const { |
| 79 return password_form_map_; | 84 return password_form_map_; |
| 80 } | 85 } |
| 81 | 86 |
| 82 bool autofill_blocked() const { return autofill_blocked_; } | 87 bool autofill_blocked() const { return autofill_blocked_; } |
| 83 void set_autofill_blocked(bool autofill_blocked) { | 88 void set_autofill_blocked(bool autofill_blocked) { |
| 84 autofill_blocked_ = autofill_blocked; | 89 autofill_blocked_ = autofill_blocked; |
| 85 } | 90 } |
| 86 | 91 |
| 92 protected: |
| 93 explicit ManagePasswordsBubbleUIController( |
| 94 content::WebContents* web_contents); |
| 95 |
| 87 private: | 96 private: |
| 88 friend class content::WebContentsUserData<ManagePasswordsBubbleUIController>; | 97 friend class content::WebContentsUserData<ManagePasswordsBubbleUIController>; |
| 89 | 98 |
| 90 explicit ManagePasswordsBubbleUIController( | |
| 91 content::WebContents* web_contents); | |
| 92 | |
| 93 // Called when a passwordform is autofilled, when a new passwordform is | 99 // Called when a passwordform is autofilled, when a new passwordform is |
| 94 // submitted, or when a navigation occurs to update the visibility of the | 100 // submitted, or when a navigation occurs to update the visibility of the |
| 95 // manage passwords icon and bubble. | 101 // manage passwords icon and bubble. |
| 96 void UpdateBubbleAndIconVisibility(); | 102 void UpdateBubbleAndIconVisibility(); |
| 97 | 103 |
| 98 // content::WebContentsObserver: | 104 // content::WebContentsObserver: |
| 99 virtual void DidNavigateMainFrame( | 105 virtual void DidNavigateMainFrame( |
| 100 const content::LoadCommittedDetails& details, | 106 const content::LoadCommittedDetails& details, |
| 101 const content::FrameNavigateParams& params) OVERRIDE; | 107 const content::FrameNavigateParams& params) OVERRIDE; |
| 102 virtual void WebContentsDestroyed( | 108 virtual void WebContentsDestroyed( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 122 | 128 |
| 123 // The origin of the form we're currently dealing with; we'll use this to | 129 // The origin of the form we're currently dealing with; we'll use this to |
| 124 // determine which PasswordStore changes we should care about when updating | 130 // determine which PasswordStore changes we should care about when updating |
| 125 // |password_form_map_|. | 131 // |password_form_map_|. |
| 126 GURL origin_; | 132 GURL origin_; |
| 127 | 133 |
| 128 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleUIController); | 134 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleUIController); |
| 129 }; | 135 }; |
| 130 | 136 |
| 131 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_ | 137 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_ |
| OLD | NEW |