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_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "components/autofill/content/common/autofill_driver.mojom.h" | 13 #include "components/autofill/content/common/autofill_driver.mojom.h" |
14 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h" | 14 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h" |
15 #include "components/password_manager/content/browser/credential_manager_impl.h" | 15 #include "components/password_manager/content/browser/credential_manager_impl.h" |
16 #include "components/password_manager/core/browser/password_manager.h" | 16 #include "components/password_manager/core/browser/password_manager.h" |
17 #include "components/password_manager/core/browser/password_manager_client.h" | 17 #include "components/password_manager/core/browser/password_manager_client.h" |
18 #include "components/password_manager/core/browser/password_reuse_detection_mana ger.h" | |
18 #include "components/password_manager/sync/browser/sync_credentials_filter.h" | 19 #include "components/password_manager/sync/browser/sync_credentials_filter.h" |
19 #include "components/prefs/pref_member.h" | 20 #include "components/prefs/pref_member.h" |
21 #include "content/public/browser/render_widget_host.h" | |
20 #include "content/public/browser/web_contents_binding_set.h" | 22 #include "content/public/browser/web_contents_binding_set.h" |
21 #include "content/public/browser/web_contents_observer.h" | 23 #include "content/public/browser/web_contents_observer.h" |
22 #include "content/public/browser/web_contents_user_data.h" | 24 #include "content/public/browser/web_contents_user_data.h" |
23 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
24 | 26 |
25 class Profile; | 27 class Profile; |
26 | 28 |
27 namespace autofill { | 29 namespace autofill { |
28 class PasswordGenerationPopupObserver; | 30 class PasswordGenerationPopupObserver; |
29 class PasswordGenerationPopupControllerImpl; | 31 class PasswordGenerationPopupControllerImpl; |
30 } | 32 } |
31 | 33 |
32 namespace content { | 34 namespace content { |
33 class WebContents; | 35 class WebContents; |
34 } | 36 } |
35 | 37 |
36 // ChromePasswordManagerClient implements the PasswordManagerClient interface. | 38 // ChromePasswordManagerClient implements the PasswordManagerClient interface. |
37 class ChromePasswordManagerClient | 39 class ChromePasswordManagerClient |
38 : public password_manager::PasswordManagerClient, | 40 : public password_manager::PasswordManagerClient, |
39 public content::WebContentsObserver, | 41 public content::WebContentsObserver, |
40 public content::WebContentsUserData<ChromePasswordManagerClient>, | 42 public content::WebContentsUserData<ChromePasswordManagerClient>, |
41 public autofill::mojom::PasswordManagerClient { | 43 public autofill::mojom::PasswordManagerClient, |
44 public content::RenderWidgetHost::InputEventObserver { | |
42 public: | 45 public: |
43 ~ChromePasswordManagerClient() override; | 46 ~ChromePasswordManagerClient() override; |
44 | 47 |
45 // PasswordManagerClient implementation. | 48 // PasswordManagerClient implementation. |
46 bool IsAutomaticPasswordSavingEnabled() const override; | 49 bool IsAutomaticPasswordSavingEnabled() const override; |
47 bool IsSavingAndFillingEnabledForCurrentPage() const override; | 50 bool IsSavingAndFillingEnabledForCurrentPage() const override; |
48 bool IsFillingEnabledForCurrentPage() const override; | 51 bool IsFillingEnabledForCurrentPage() const override; |
49 bool OnCredentialManagerUsed() override; | 52 bool OnCredentialManagerUsed() override; |
50 bool PromptUserToSaveOrUpdatePassword( | 53 bool PromptUserToSaveOrUpdatePassword( |
51 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, | 54 std::unique_ptr<password_manager::PasswordFormManager> form_to_save, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 // Callable for tests. | 118 // Callable for tests. |
116 ChromePasswordManagerClient(content::WebContents* web_contents, | 119 ChromePasswordManagerClient(content::WebContents* web_contents, |
117 autofill::AutofillClient* autofill_client); | 120 autofill::AutofillClient* autofill_client); |
118 | 121 |
119 private: | 122 private: |
120 friend class content::WebContentsUserData<ChromePasswordManagerClient>; | 123 friend class content::WebContentsUserData<ChromePasswordManagerClient>; |
121 | 124 |
122 // content::WebContentsObserver overrides. | 125 // content::WebContentsObserver overrides. |
123 void DidStartNavigation( | 126 void DidStartNavigation( |
124 content::NavigationHandle* navigation_handle) override; | 127 content::NavigationHandle* navigation_handle) override; |
128 void DidNavigateMainFrame( | |
129 const content::LoadCommittedDetails& details, | |
130 const content::FrameNavigateParams& params) override; | |
131 | |
132 // content::RenderWidgetHost::InputEventObserver overrides. | |
133 void OnInputEvent(const blink::WebInputEvent&) override; | |
125 | 134 |
126 // Given |bounds| in the renderers coordinate system, return the same bounds | 135 // Given |bounds| in the renderers coordinate system, return the same bounds |
127 // in the screens coordinate system. | 136 // in the screens coordinate system. |
128 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); | 137 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); |
129 | 138 |
130 // Checks if the current page fulfils the conditions for the password manager | 139 // Checks if the current page fulfils the conditions for the password manager |
131 // to be active on it, for example Sync credentials are not saved or auto | 140 // to be active on it, for example Sync credentials are not saved or auto |
132 // filled. | 141 // filled. |
133 bool IsPasswordManagementEnabledForCurrentPage() const; | 142 bool IsPasswordManagementEnabledForCurrentPage() const; |
134 | 143 |
(...skipping 10 matching lines...) Expand all Loading... | |
145 const autofill::PasswordForm* form); | 154 const autofill::PasswordForm* form); |
146 | 155 |
147 // Returns true if this profile has metrics reporting and active sync | 156 // Returns true if this profile has metrics reporting and active sync |
148 // without custom sync passphrase. | 157 // without custom sync passphrase. |
149 static bool ShouldAnnotateNavigationEntries(Profile* profile); | 158 static bool ShouldAnnotateNavigationEntries(Profile* profile); |
150 | 159 |
151 Profile* const profile_; | 160 Profile* const profile_; |
152 | 161 |
153 password_manager::PasswordManager password_manager_; | 162 password_manager::PasswordManager password_manager_; |
154 | 163 |
164 password_manager::PasswordReuseDetectionManager | |
165 password_reuse_detection_manager_; | |
166 | |
155 password_manager::ContentPasswordManagerDriverFactory* driver_factory_; | 167 password_manager::ContentPasswordManagerDriverFactory* driver_factory_; |
156 | 168 |
157 // As a mojo service, will be registered into service registry | 169 // As a mojo service, will be registered into service registry |
158 // of the main frame host by ChromeContentBrowserClient | 170 // of the main frame host by ChromeContentBrowserClient |
159 // once main frame host was created. | 171 // once main frame host was created. |
160 password_manager::CredentialManagerImpl credential_manager_impl_; | 172 password_manager::CredentialManagerImpl credential_manager_impl_; |
161 | 173 |
162 content::WebContentsFrameBindingSet<autofill::mojom::PasswordManagerClient> | 174 content::WebContentsFrameBindingSet<autofill::mojom::PasswordManagerClient> |
163 password_manager_client_bindings_; | 175 password_manager_client_bindings_; |
164 | 176 |
165 // Observer for password generation popup. | 177 // Observer for password generation popup. |
166 autofill::PasswordGenerationPopupObserver* observer_; | 178 autofill::PasswordGenerationPopupObserver* observer_; |
167 | 179 |
168 // Controls the popup | 180 // Controls the popup |
169 base::WeakPtr< | 181 base::WeakPtr<autofill::PasswordGenerationPopupControllerImpl> |
vabr (Chromium)
2016/12/23 17:14:11
nit: Unless the tools force you to do this change,
dvadym
2016/12/23 17:45:20
Done.
| |
170 autofill::PasswordGenerationPopupControllerImpl> popup_controller_; | 182 popup_controller_; |
171 | 183 |
172 // Set to false to disable password saving (will no longer ask if you | 184 // Set to false to disable password saving (will no longer ask if you |
173 // want to save passwords and also won't fill the passwords). | 185 // want to save passwords and also won't fill the passwords). |
174 BooleanPrefMember saving_and_filling_passwords_enabled_; | 186 BooleanPrefMember saving_and_filling_passwords_enabled_; |
175 | 187 |
176 const password_manager::SyncCredentialsFilter credentials_filter_; | 188 const password_manager::SyncCredentialsFilter credentials_filter_; |
177 | 189 |
178 std::unique_ptr<password_manager::LogManager> log_manager_; | 190 std::unique_ptr<password_manager::LogManager> log_manager_; |
179 | 191 |
180 // Set during 'NotifyUserCouldBeAutoSignedIn' in order to store the | 192 // Set during 'NotifyUserCouldBeAutoSignedIn' in order to store the |
181 // form for potential use during 'NotifySuccessfulLoginWithExistingPassword'. | 193 // form for potential use during 'NotifySuccessfulLoginWithExistingPassword'. |
182 std::unique_ptr<autofill::PasswordForm> possible_auto_sign_in_; | 194 std::unique_ptr<autofill::PasswordForm> possible_auto_sign_in_; |
183 | 195 |
184 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); | 196 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); |
185 }; | 197 }; |
186 | 198 |
187 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ | 199 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ |
OLD | NEW |