Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_ui_controller.h

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/timer/elapsed_timer.h" 10 #include "base/timer/elapsed_timer.h"
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 class ManagePasswordsIcon; 24 class ManagePasswordsIcon;
25 25
26 // Per-tab class to control the Omnibox password icon and bubble. 26 // Per-tab class to control the Omnibox password icon and bubble.
27 class ManagePasswordsUIController 27 class ManagePasswordsUIController
28 : public content::WebContentsObserver, 28 : public content::WebContentsObserver,
29 public content::WebContentsUserData<ManagePasswordsUIController>, 29 public content::WebContentsUserData<ManagePasswordsUIController>,
30 public password_manager::PasswordStore::Observer { 30 public password_manager::PasswordStore::Observer {
31 public: 31 public:
32 virtual ~ManagePasswordsUIController(); 32 ~ManagePasswordsUIController() override;
33 33
34 // Called when the user submits a form containing login information, so we 34 // Called when the user submits a form containing login information, so we
35 // can handle later requests to save or blacklist that login information. 35 // can handle later requests to save or blacklist that login information.
36 // This stores the provided object in form_manager_ and triggers the UI to 36 // This stores the provided object in form_manager_ and triggers the UI to
37 // prompt the user about whether they would like to save the password. 37 // prompt the user about whether they would like to save the password.
38 void OnPasswordSubmitted( 38 void OnPasswordSubmitted(
39 scoped_ptr<password_manager::PasswordFormManager> form_manager); 39 scoped_ptr<password_manager::PasswordFormManager> form_manager);
40 40
41 // Called when the password will be saved automatically, but we still wish to 41 // Called when the password will be saved automatically, but we still wish to
42 // visually inform the user that the save has occured. 42 // visually inform the user that the save has occured.
43 void OnAutomaticPasswordSave( 43 void OnAutomaticPasswordSave(
44 scoped_ptr<password_manager::PasswordFormManager> form_manager); 44 scoped_ptr<password_manager::PasswordFormManager> form_manager);
45 45
46 // Called when a form is autofilled with login information, so we can manage 46 // Called when a form is autofilled with login information, so we can manage
47 // password credentials for the current site which are stored in 47 // password credentials for the current site which are stored in
48 // |password_form_map|. This stores a copy of |password_form_map| and shows 48 // |password_form_map|. This stores a copy of |password_form_map| and shows
49 // the manage password icon. 49 // the manage password icon.
50 void OnPasswordAutofilled(const autofill::PasswordFormMap& password_form_map); 50 void OnPasswordAutofilled(const autofill::PasswordFormMap& password_form_map);
51 51
52 // Called when a form is _not_ autofilled due to user blacklisting. This 52 // Called when a form is _not_ autofilled due to user blacklisting. This
53 // stores a copy of |password_form_map| so that we can offer the user the 53 // stores a copy of |password_form_map| so that we can offer the user the
54 // ability to reenable the manager for this form. 54 // ability to reenable the manager for this form.
55 void OnBlacklistBlockedAutofill( 55 void OnBlacklistBlockedAutofill(
56 const autofill::PasswordFormMap& password_form_map); 56 const autofill::PasswordFormMap& password_form_map);
57 57
58 // PasswordStore::Observer implementation. 58 // PasswordStore::Observer implementation.
59 virtual void OnLoginsChanged( 59 void OnLoginsChanged(
60 const password_manager::PasswordStoreChangeList& changes) override; 60 const password_manager::PasswordStoreChangeList& changes) override;
61 61
62 // Called from the model when the user chooses to save a password; passes the 62 // Called from the model when the user chooses to save a password; passes the
63 // action off to the FormManager. The controller MUST be in a pending state, 63 // action off to the FormManager. The controller MUST be in a pending state,
64 // and WILL be in MANAGE_STATE after this method executes. 64 // and WILL be in MANAGE_STATE after this method executes.
65 virtual void SavePassword(); 65 virtual void SavePassword();
66 66
67 // Called from the model when the user chooses to never save passwords; passes 67 // Called from the model when the user chooses to never save passwords; passes
68 // the action off to the FormManager. The controller MUST be in a pending 68 // the action off to the FormManager. The controller MUST be in a pending
69 // state, and WILL be in BLACKLIST_STATE after this method executes. 69 // state, and WILL be in BLACKLIST_STATE after this method executes.
(...skipping 28 matching lines...) Expand all
98 protected: 98 protected:
99 explicit ManagePasswordsUIController( 99 explicit ManagePasswordsUIController(
100 content::WebContents* web_contents); 100 content::WebContents* web_contents);
101 101
102 // The pieces of saving and blacklisting passwords that interact with 102 // The pieces of saving and blacklisting passwords that interact with
103 // FormManager, split off into internal functions for testing/mocking. 103 // FormManager, split off into internal functions for testing/mocking.
104 virtual void SavePasswordInternal(); 104 virtual void SavePasswordInternal();
105 virtual void NeverSavePasswordInternal(); 105 virtual void NeverSavePasswordInternal();
106 106
107 // content::WebContentsObserver: 107 // content::WebContentsObserver:
108 virtual void DidNavigateMainFrame( 108 void DidNavigateMainFrame(
109 const content::LoadCommittedDetails& details, 109 const content::LoadCommittedDetails& details,
110 const content::FrameNavigateParams& params) override; 110 const content::FrameNavigateParams& params) override;
111 virtual void WasHidden() override; 111 void WasHidden() override;
112 112
113 // We create copies of PasswordForm objects that come in with unclear lifetime 113 // We create copies of PasswordForm objects that come in with unclear lifetime
114 // and store them in this vector as well as in |password_form_map_| to ensure 114 // and store them in this vector as well as in |password_form_map_| to ensure
115 // that we destroy them correctly. If |new_password_forms_| gets cleared then 115 // that we destroy them correctly. If |new_password_forms_| gets cleared then
116 // |password_form_map_| is to be cleared too. 116 // |password_form_map_| is to be cleared too.
117 ScopedVector<autofill::PasswordForm> new_password_forms_; 117 ScopedVector<autofill::PasswordForm> new_password_forms_;
118 118
119 // All previously stored credentials for a specific site. 119 // All previously stored credentials for a specific site.
120 // Protected, not private, so we can mess with the value in 120 // Protected, not private, so we can mess with the value in
121 // ManagePasswordsUIControllerMock. 121 // ManagePasswordsUIControllerMock.
(...skipping 14 matching lines...) Expand all
136 // Shows the password bubble without user interaction. The controller MUST 136 // Shows the password bubble without user interaction. The controller MUST
137 // be in PENDING_PASSWORD_AND_BUBBLE_STATE. 137 // be in PENDING_PASSWORD_AND_BUBBLE_STATE.
138 void ShowBubbleWithoutUserInteraction(); 138 void ShowBubbleWithoutUserInteraction();
139 139
140 // Called when a passwordform is autofilled, when a new passwordform is 140 // Called when a passwordform is autofilled, when a new passwordform is
141 // submitted, or when a navigation occurs to update the visibility of the 141 // submitted, or when a navigation occurs to update the visibility of the
142 // manage passwords icon and bubble. 142 // manage passwords icon and bubble.
143 void UpdateBubbleAndIconVisibility(); 143 void UpdateBubbleAndIconVisibility();
144 144
145 // content::WebContentsObserver: 145 // content::WebContentsObserver:
146 virtual void WebContentsDestroyed() override; 146 void WebContentsDestroyed() override;
147 147
148 // Set by OnPasswordSubmitted() when the user submits a form containing login 148 // Set by OnPasswordSubmitted() when the user submits a form containing login
149 // information. If the user responds to a subsequent "Do you want to save 149 // information. If the user responds to a subsequent "Do you want to save
150 // this password?" prompt, we ask this object to save or blacklist the 150 // this password?" prompt, we ask this object to save or blacklist the
151 // associated login information in Chrome's password store. 151 // associated login information in Chrome's password store.
152 scoped_ptr<password_manager::PasswordFormManager> form_manager_; 152 scoped_ptr<password_manager::PasswordFormManager> form_manager_;
153 153
154 // Stores whether autofill was blocked due to a user's decision to blacklist 154 // Stores whether autofill was blocked due to a user's decision to blacklist
155 // the current site ("Never save passwords for this site"). 155 // the current site ("Never save passwords for this site").
156 bool autofill_blocked_; 156 bool autofill_blocked_;
157 157
158 // The origin of the form we're currently dealing with; we'll use this to 158 // The origin of the form we're currently dealing with; we'll use this to
159 // determine which PasswordStore changes we should care about when updating 159 // determine which PasswordStore changes we should care about when updating
160 // |password_form_map_|. 160 // |password_form_map_|.
161 GURL origin_; 161 GURL origin_;
162 162
163 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController); 163 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController);
164 }; 164 };
165 165
166 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ 166 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698