| 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" |
| 11 #include "content/public/browser/navigation_details.h" | 11 #include "content/public/browser/navigation_details.h" |
| 12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
| 13 #include "content/public/browser/web_contents_user_data.h" | 13 #include "content/public/browser/web_contents_user_data.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 class WebContents; | 16 class WebContents; |
| 17 } | 17 } |
| 18 | 18 |
| 19 class ManagePasswordsIcon; |
| 20 |
| 19 // Per-tab class to control the Omnibox password icon and bubble. | 21 // Per-tab class to control the Omnibox password icon and bubble. |
| 20 class ManagePasswordsBubbleUIController | 22 class ManagePasswordsBubbleUIController |
| 21 : public content::WebContentsObserver, | 23 : public content::WebContentsObserver, |
| 22 public content::WebContentsUserData<ManagePasswordsBubbleUIController>, | 24 public content::WebContentsUserData<ManagePasswordsBubbleUIController>, |
| 23 public password_manager::PasswordStore::Observer { | 25 public password_manager::PasswordStore::Observer { |
| 24 public: | 26 public: |
| 25 virtual ~ManagePasswordsBubbleUIController(); | 27 virtual ~ManagePasswordsBubbleUIController(); |
| 26 | 28 |
| 27 // Called when the user submits a form containing login information, so we | 29 // Called when the user submits a form containing login information, so we |
| 28 // can handle later requests to save or blacklist that login information. | 30 // can handle later requests to save or blacklist that login information. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 const password_manager::PasswordStoreChangeList& changes) OVERRIDE; | 46 const password_manager::PasswordStoreChangeList& changes) OVERRIDE; |
| 45 | 47 |
| 46 // Called from the model when the user chooses to save a password; passes the | 48 // Called from the model when the user chooses to save a password; passes the |
| 47 // action off to the FormManager. | 49 // action off to the FormManager. |
| 48 virtual void SavePassword(); | 50 virtual void SavePassword(); |
| 49 | 51 |
| 50 // Called from the model when the user chooses to never save passwords; passes | 52 // Called from the model when the user chooses to never save passwords; passes |
| 51 // the action off to the FormManager. | 53 // the action off to the FormManager. |
| 52 virtual void NeverSavePassword(); | 54 virtual void NeverSavePassword(); |
| 53 | 55 |
| 54 // Called when the bubble is opened after the icon gets displayed. We change | |
| 55 // the state to know that we do not need to pop up the bubble again. | |
| 56 void OnBubbleShown(); | |
| 57 | |
| 58 // Open a new tab, pointing to the password manager settings page. | 56 // Open a new tab, pointing to the password manager settings page. |
| 59 virtual void NavigateToPasswordManagerSettingsPage(); | 57 virtual void NavigateToPasswordManagerSettingsPage(); |
| 60 | 58 |
| 61 virtual const autofill::PasswordForm& PendingCredentials() const; | 59 virtual const autofill::PasswordForm& PendingCredentials() const; |
| 62 | 60 |
| 61 // Set the state of the Omnibox icon, and possibly show the associated bubble |
| 62 // without user interaction. |
| 63 virtual void UpdateIconAndBubbleState(ManagePasswordsIcon* icon); |
| 64 |
| 63 bool manage_passwords_icon_to_be_shown() const { | 65 bool manage_passwords_icon_to_be_shown() const { |
| 64 return manage_passwords_icon_to_be_shown_; | 66 return manage_passwords_icon_to_be_shown_; |
| 65 } | 67 } |
| 66 | 68 |
| 67 bool password_to_be_saved() const { | 69 bool password_to_be_saved() const { |
| 68 return password_to_be_saved_; | 70 return password_to_be_saved_; |
| 69 } | 71 } |
| 70 | 72 |
| 71 bool manage_passwords_bubble_needs_showing() const { | 73 bool manage_passwords_bubble_needs_showing() const { |
| 72 return manage_passwords_bubble_needs_showing_; | 74 return manage_passwords_bubble_needs_showing_; |
| 73 } | 75 } |
| 74 | 76 |
| 75 void unset_manage_passwords_bubble_needs_showing() { | |
| 76 manage_passwords_bubble_needs_showing_ = false; | |
| 77 } | |
| 78 | |
| 79 void unset_password_to_be_saved() { | 77 void unset_password_to_be_saved() { |
| 80 password_to_be_saved_ = false; | 78 password_to_be_saved_ = false; |
| 81 } | 79 } |
| 82 | 80 |
| 83 const autofill::PasswordFormMap best_matches() const { | 81 const autofill::PasswordFormMap best_matches() const { |
| 84 return password_form_map_; | 82 return password_form_map_; |
| 85 } | 83 } |
| 86 | 84 |
| 87 bool autofill_blocked() const { return autofill_blocked_; } | 85 bool autofill_blocked() const { return autofill_blocked_; } |
| 88 void set_autofill_blocked(bool autofill_blocked) { | 86 void set_autofill_blocked(bool autofill_blocked) { |
| 89 autofill_blocked_ = autofill_blocked; | 87 autofill_blocked_ = autofill_blocked; |
| 90 } | 88 } |
| 91 | 89 |
| 90 const GURL& origin() const { return origin_; } |
| 91 |
| 92 protected: | 92 protected: |
| 93 explicit ManagePasswordsBubbleUIController( | 93 explicit ManagePasswordsBubbleUIController( |
| 94 content::WebContents* web_contents); | 94 content::WebContents* web_contents); |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 friend class content::WebContentsUserData<ManagePasswordsBubbleUIController>; | 97 friend class content::WebContentsUserData<ManagePasswordsBubbleUIController>; |
| 98 | 98 |
| 99 // Called when a passwordform is autofilled, when a new passwordform is | 99 // Called when a passwordform is autofilled, when a new passwordform is |
| 100 // 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 |
| 101 // manage passwords icon and bubble. | 101 // manage passwords icon and bubble. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 128 | 128 |
| 129 // 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 |
| 130 // determine which PasswordStore changes we should care about when updating | 130 // determine which PasswordStore changes we should care about when updating |
| 131 // |password_form_map_|. | 131 // |password_form_map_|. |
| 132 GURL origin_; | 132 GURL origin_; |
| 133 | 133 |
| 134 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleUIController); | 134 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleUIController); |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 #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 |