| 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 "base/optional.h" | 13 #include "base/optional.h" |
| 14 #include "build/build_config.h" |
| 14 #include "components/autofill/content/common/autofill_driver.mojom.h" | 15 #include "components/autofill/content/common/autofill_driver.mojom.h" |
| 15 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" | 16 #include "components/password_manager/content/browser/content_password_manager_d
river_factory.h" |
| 16 #include "components/password_manager/content/browser/credential_manager_impl.h" | 17 #include "components/password_manager/content/browser/credential_manager_impl.h" |
| 17 #include "components/password_manager/core/browser/password_manager.h" | 18 #include "components/password_manager/core/browser/password_manager.h" |
| 18 #include "components/password_manager/core/browser/password_manager_client.h" | 19 #include "components/password_manager/core/browser/password_manager_client.h" |
| 19 #include "components/password_manager/core/browser/password_manager_metrics_reco
rder.h" | 20 #include "components/password_manager/core/browser/password_manager_metrics_reco
rder.h" |
| 20 #include "components/password_manager/core/browser/password_reuse_detection_mana
ger.h" | 21 #include "components/password_manager/core/browser/password_reuse_detection_mana
ger.h" |
| 21 #include "components/password_manager/sync/browser/sync_credentials_filter.h" | 22 #include "components/password_manager/sync/browser/sync_credentials_filter.h" |
| 22 #include "components/prefs/pref_member.h" | 23 #include "components/prefs/pref_member.h" |
| 23 #include "content/public/browser/render_widget_host.h" | 24 #include "content/public/browser/render_widget_host.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 override; | 124 override; |
| 124 | 125 |
| 125 static void CreateForWebContentsWithAutofillClient( | 126 static void CreateForWebContentsWithAutofillClient( |
| 126 content::WebContents* contents, | 127 content::WebContents* contents, |
| 127 autofill::AutofillClient* autofill_client); | 128 autofill::AutofillClient* autofill_client); |
| 128 | 129 |
| 129 // Observer for PasswordGenerationPopup events. Used for testing. | 130 // Observer for PasswordGenerationPopup events. Used for testing. |
| 130 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer); | 131 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer); |
| 131 | 132 |
| 132 static void BindCredentialManager( | 133 static void BindCredentialManager( |
| 133 const service_manager::BindSourceInfo& source_info, | 134 password_manager::mojom::CredentialManagerAssociatedRequest request, |
| 134 password_manager::mojom::CredentialManagerRequest request, | |
| 135 content::RenderFrameHost* render_frame_host); | 135 content::RenderFrameHost* render_frame_host); |
| 136 | 136 |
| 137 // A helper method to determine whether a save/update bubble can be shown | 137 // A helper method to determine whether a save/update bubble can be shown |
| 138 // on this |url|. | 138 // on this |url|. |
| 139 static bool CanShowBubbleOnURL(const GURL& url); | 139 static bool CanShowBubbleOnURL(const GURL& url); |
| 140 | 140 |
| 141 #if defined(UNIT_TEST) |
| 142 bool was_store_ever_called() const { return was_store_ever_called_; } |
| 143 bool has_binding_for_credential_manager() const { |
| 144 return credential_manager_impl_.HasBinding(); |
| 145 } |
| 146 #endif |
| 147 |
| 141 protected: | 148 protected: |
| 142 // Callable for tests. | 149 // Callable for tests. |
| 143 ChromePasswordManagerClient(content::WebContents* web_contents, | 150 ChromePasswordManagerClient(content::WebContents* web_contents, |
| 144 autofill::AutofillClient* autofill_client); | 151 autofill::AutofillClient* autofill_client); |
| 145 | 152 |
| 146 private: | 153 private: |
| 147 friend class content::WebContentsUserData<ChromePasswordManagerClient>; | 154 friend class content::WebContentsUserData<ChromePasswordManagerClient>; |
| 148 | 155 |
| 149 // content::WebContentsObserver overrides. | 156 // content::WebContentsObserver overrides. |
| 150 void DidStartNavigation( | 157 void DidStartNavigation( |
| 151 content::NavigationHandle* navigation_handle) override; | 158 content::NavigationHandle* navigation_handle) override; |
| 152 // TODO(crbug.com/706392): Fix password reuse detection for Android. | |
| 153 #if !defined(OS_ANDROID) | |
| 154 void DidFinishNavigation( | 159 void DidFinishNavigation( |
| 155 content::NavigationHandle* navigation_handle) override; | 160 content::NavigationHandle* navigation_handle) override; |
| 156 | 161 |
| 162 // TODO(crbug.com/706392): Fix password reuse detection for Android. |
| 163 #if !defined(OS_ANDROID) |
| 157 // content::RenderWidgetHost::InputEventObserver overrides. | 164 // content::RenderWidgetHost::InputEventObserver overrides. |
| 158 void OnInputEvent(const blink::WebInputEvent&) override; | 165 void OnInputEvent(const blink::WebInputEvent&) override; |
| 159 #endif | 166 #endif |
| 160 | 167 |
| 161 // Given |bounds| in the renderers coordinate system, return the same bounds | 168 // Given |bounds| in the renderers coordinate system, return the same bounds |
| 162 // in the screens coordinate system. | 169 // in the screens coordinate system. |
| 163 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); | 170 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); |
| 164 | 171 |
| 165 // Checks if the current page fulfils the conditions for the password manager | 172 // Checks if the current page fulfils the conditions for the password manager |
| 166 // to be active on it, for example Sync credentials are not saved or auto | 173 // to be active on it, for example Sync credentials are not saved or auto |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // If set, this stores a ukm::SourceId that is bound to the last committed | 232 // If set, this stores a ukm::SourceId that is bound to the last committed |
| 226 // navigation of the tab owning this ChromePasswordManagerClient. | 233 // navigation of the tab owning this ChromePasswordManagerClient. |
| 227 base::Optional<ukm::SourceId> ukm_source_id_; | 234 base::Optional<ukm::SourceId> ukm_source_id_; |
| 228 | 235 |
| 229 // Recorder of metrics that is associated with the last committed navigation | 236 // Recorder of metrics that is associated with the last committed navigation |
| 230 // of the WebContents owning this ChromePasswordManagerClient. May be unset at | 237 // of the WebContents owning this ChromePasswordManagerClient. May be unset at |
| 231 // times. Sends statistics on destruction. | 238 // times. Sends statistics on destruction. |
| 232 base::Optional<password_manager::PasswordManagerMetricsRecorder> | 239 base::Optional<password_manager::PasswordManagerMetricsRecorder> |
| 233 metrics_recorder_; | 240 metrics_recorder_; |
| 234 | 241 |
| 242 // Whether navigator.credentials.store() was ever called from this |
| 243 // WebContents. Used for testing. |
| 244 bool was_store_ever_called_ = false; |
| 245 |
| 235 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); | 246 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); |
| 236 }; | 247 }; |
| 237 | 248 |
| 238 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ | 249 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ |
| OLD | NEW |