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

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client.h

Issue 2947413002: Restrict CM API interface request and message dispatch. (Closed)
Patch Set: Addressed comments, and used an associated interface. Created 3 years, 5 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_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
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 static void CreateForWebContentsWithAutofillClient( 122 static void CreateForWebContentsWithAutofillClient(
123 content::WebContents* contents, 123 content::WebContents* contents,
124 autofill::AutofillClient* autofill_client); 124 autofill::AutofillClient* autofill_client);
125 125
126 // Observer for PasswordGenerationPopup events. Used for testing. 126 // Observer for PasswordGenerationPopup events. Used for testing.
127 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer); 127 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer);
128 128
129 static void BindCredentialManager( 129 static void BindCredentialManager(
130 const service_manager::BindSourceInfo& source_info, 130 const service_manager::BindSourceInfo& source_info,
131 password_manager::mojom::CredentialManagerRequest request, 131 password_manager::mojom::CredentialManagerAssociatedRequest request,
132 content::RenderFrameHost* render_frame_host); 132 content::RenderFrameHost* render_frame_host);
133 133
134 // A helper method to determine whether a save/update bubble can be shown 134 // A helper method to determine whether a save/update bubble can be shown
135 // on this |url|. 135 // on this |url|.
136 static bool CanShowBubbleOnURL(const GURL& url); 136 static bool CanShowBubbleOnURL(const GURL& url);
137 137
138 #if defined(UNIT_TEST)
139 bool was_store_ever_called() const { return was_store_ever_called_; }
140 bool has_binding_for_credential_manager() const {
141 return credential_manager_impl_.HasBinding();
142 }
143 #endif
144
138 protected: 145 protected:
139 // Callable for tests. 146 // Callable for tests.
140 ChromePasswordManagerClient(content::WebContents* web_contents, 147 ChromePasswordManagerClient(content::WebContents* web_contents,
141 autofill::AutofillClient* autofill_client); 148 autofill::AutofillClient* autofill_client);
142 149
143 private: 150 private:
144 friend class content::WebContentsUserData<ChromePasswordManagerClient>; 151 friend class content::WebContentsUserData<ChromePasswordManagerClient>;
145 152
146 // content::WebContentsObserver overrides. 153 // content::WebContentsObserver overrides.
147 void DidStartNavigation( 154 void DidStartNavigation(
148 content::NavigationHandle* navigation_handle) override; 155 content::NavigationHandle* navigation_handle) override;
149 // TODO(crbug.com/706392): Fix password reuse detection for Android.
150 #if !defined(OS_ANDROID)
151 void DidFinishNavigation( 156 void DidFinishNavigation(
152 content::NavigationHandle* navigation_handle) override; 157 content::NavigationHandle* navigation_handle) override;
153 158
159 // TODO(crbug.com/706392): Fix password reuse detection for Android.
160 #if !defined(OS_ANDROID)
154 // content::RenderWidgetHost::InputEventObserver overrides. 161 // content::RenderWidgetHost::InputEventObserver overrides.
155 void OnInputEvent(const blink::WebInputEvent&) override; 162 void OnInputEvent(const blink::WebInputEvent&) override;
156 #endif 163 #endif
157 164
158 // Given |bounds| in the renderers coordinate system, return the same bounds 165 // Given |bounds| in the renderers coordinate system, return the same bounds
159 // in the screens coordinate system. 166 // in the screens coordinate system.
160 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); 167 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds);
161 168
162 // Checks if the current page fulfils the conditions for the password manager 169 // Checks if the current page fulfils the conditions for the password manager
163 // to be active on it, for example Sync credentials are not saved or auto 170 // to be active on it, for example Sync credentials are not saved or auto
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 std::unique_ptr<password_manager::LogManager> log_manager_; 223 std::unique_ptr<password_manager::LogManager> log_manager_;
217 224
218 // Set during 'NotifyUserCouldBeAutoSignedIn' in order to store the 225 // Set during 'NotifyUserCouldBeAutoSignedIn' in order to store the
219 // form for potential use during 'NotifySuccessfulLoginWithExistingPassword'. 226 // form for potential use during 'NotifySuccessfulLoginWithExistingPassword'.
220 std::unique_ptr<autofill::PasswordForm> possible_auto_sign_in_; 227 std::unique_ptr<autofill::PasswordForm> possible_auto_sign_in_;
221 228
222 // If set, this stores a ukm::SourceId that is bound to the last committed 229 // If set, this stores a ukm::SourceId that is bound to the last committed
223 // navigation of the tab owning this ChromePasswordManagerClient. 230 // navigation of the tab owning this ChromePasswordManagerClient.
224 base::Optional<ukm::SourceId> ukm_source_id_; 231 base::Optional<ukm::SourceId> ukm_source_id_;
225 232
233 // Whether navigator.credentials.store() was ever called from this
234 // WebContents. Used for testing.
235 bool was_store_ever_called_ = false;
236
226 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); 237 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient);
227 }; 238 };
228 239
229 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ 240 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698