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

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

Issue 1260263002: Move ShouldFilterAutofillResult from ChromePasswordManagerClient to PasswordManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac fix Created 5 years, 4 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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h"
10 #include "base/prefs/pref_member.h" 12 #include "base/prefs/pref_member.h"
11 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h" 13 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h"
12 #include "components/password_manager/content/browser/credential_manager_dispatc her.h" 14 #include "components/password_manager/content/browser/credential_manager_dispatc her.h"
13 #include "components/password_manager/core/browser/password_manager.h" 15 #include "components/password_manager/core/browser/password_manager.h"
14 #include "components/password_manager/core/browser/password_manager_client.h" 16 #include "components/password_manager/core/browser/password_manager_client.h"
15 #include "content/public/browser/web_contents_observer.h" 17 #include "content/public/browser/web_contents_observer.h"
16 #include "content/public/browser/web_contents_user_data.h" 18 #include "content/public/browser/web_contents_user_data.h"
17 #include "ui/gfx/geometry/rect.h" 19 #include "ui/gfx/geometry/rect.h"
18 20
19 class Profile; 21 class Profile;
(...skipping 18 matching lines...) Expand all
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: 43 public:
42 ~ChromePasswordManagerClient() override; 44 ~ChromePasswordManagerClient() override;
43 45
44 // PasswordManagerClient implementation. 46 // PasswordManagerClient implementation.
45 bool IsAutomaticPasswordSavingEnabled() const override; 47 bool IsAutomaticPasswordSavingEnabled() const override;
46 bool IsPasswordManagementEnabledForCurrentPage() const override; 48 bool IsPasswordManagementEnabledForCurrentPage() const override;
47 bool IsSavingEnabledForCurrentPage() const override; 49 bool IsSavingEnabledForCurrentPage() const override;
48 bool ShouldFilterAutofillResult(const autofill::PasswordForm& form) override;
49 std::string GetSyncUsername() const override; 50 std::string GetSyncUsername() const override;
50 bool IsSyncAccountCredential(const std::string& username, 51 bool IsSyncAccountCredential(const std::string& username,
51 const std::string& realm) const override; 52 const std::string& realm) const override;
52 void AutofillResultsComputed() override;
53 bool PromptUserToSavePassword( 53 bool PromptUserToSavePassword(
54 scoped_ptr<password_manager::PasswordFormManager> form_to_save, 54 scoped_ptr<password_manager::PasswordFormManager> form_to_save,
55 password_manager::CredentialSourceType type) override; 55 password_manager::CredentialSourceType type) override;
56 bool PromptUserToChooseCredentials( 56 bool PromptUserToChooseCredentials(
57 ScopedVector<autofill::PasswordForm> local_forms, 57 ScopedVector<autofill::PasswordForm> local_forms,
58 ScopedVector<autofill::PasswordForm> federated_forms, 58 ScopedVector<autofill::PasswordForm> federated_forms,
59 const GURL& origin, 59 const GURL& origin,
60 base::Callback<void(const password_manager::CredentialInfo&)> callback) 60 base::Callback<void(const password_manager::CredentialInfo&)> callback)
61 override; 61 override;
62 void ForceSavePassword() override; 62 void ForceSavePassword() override;
(...skipping 10 matching lines...) Expand all
73 password_manager::PasswordSyncState GetPasswordSyncState() const override; 73 password_manager::PasswordSyncState GetPasswordSyncState() const override;
74 void OnLogRouterAvailabilityChanged(bool router_can_be_used) override; 74 void OnLogRouterAvailabilityChanged(bool router_can_be_used) override;
75 void LogSavePasswordProgress(const std::string& text) const override; 75 void LogSavePasswordProgress(const std::string& text) const override;
76 bool IsLoggingActive() const override; 76 bool IsLoggingActive() const override;
77 bool WasLastNavigationHTTPError() const override; 77 bool WasLastNavigationHTTPError() const override;
78 bool DidLastPageLoadEncounterSSLErrors() const override; 78 bool DidLastPageLoadEncounterSSLErrors() const override;
79 bool IsOffTheRecord() const override; 79 bool IsOffTheRecord() const override;
80 password_manager::PasswordManager* GetPasswordManager() override; 80 password_manager::PasswordManager* GetPasswordManager() override;
81 autofill::AutofillManager* GetAutofillManagerForMainFrame() override; 81 autofill::AutofillManager* GetAutofillManagerForMainFrame() override;
82 const GURL& GetMainFrameURL() const override; 82 const GURL& GetMainFrameURL() const override;
83 const GURL& GetLastCommittedEntryURL() const override;
84 scoped_ptr<password_manager::StoreResultFilter> CreateStoreResultFilter()
85 const override;
83 86
84 // Hides any visible generation UI. 87 // Hides any visible generation UI.
85 void HidePasswordGenerationPopup(); 88 void HidePasswordGenerationPopup();
86 89
87 static void CreateForWebContentsWithAutofillClient( 90 static void CreateForWebContentsWithAutofillClient(
88 content::WebContents* contents, 91 content::WebContents* contents,
89 autofill::AutofillClient* autofill_client); 92 autofill::AutofillClient* autofill_client);
90 93
91 // Observer for PasswordGenerationPopup events. Used for testing. 94 // Observer for PasswordGenerationPopup events. Used for testing.
92 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer); 95 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer);
93 96
94 // Returns true if the bubble UI is enabled, and false if we're still using 97 // Returns true if the bubble UI is enabled, and false if we're still using
95 // the sad old Infobar UI. 98 // the sad old Infobar UI.
96 static bool IsTheHotNewBubbleUIEnabled(); 99 static bool IsTheHotNewBubbleUIEnabled();
97 100
98 // Returns true if the password manager should be enabled during sync signin. 101 // Returns true if the password manager should be enabled during sync signin.
99 static bool EnabledForSyncSignin(); 102 static bool EnabledForSyncSignin();
100 103
101 protected: 104 protected:
102 // Callable for tests. 105 // Callable for tests.
103 ChromePasswordManagerClient(content::WebContents* web_contents, 106 ChromePasswordManagerClient(content::WebContents* web_contents,
104 autofill::AutofillClient* autofill_client); 107 autofill::AutofillClient* autofill_client);
105 108
106 private: 109 private:
107 enum AutofillForSyncCredentialsState {
108 ALLOW_SYNC_CREDENTIALS,
109 DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH,
110 DISALLOW_SYNC_CREDENTIALS,
111 };
112
113 friend class content::WebContentsUserData<ChromePasswordManagerClient>; 110 friend class content::WebContentsUserData<ChromePasswordManagerClient>;
114 111
115 // content::WebContentsObserver overrides. 112 // content::WebContentsObserver overrides.
116 bool OnMessageReceived(const IPC::Message& message, 113 bool OnMessageReceived(const IPC::Message& message,
117 content::RenderFrameHost* render_frame_host) override; 114 content::RenderFrameHost* render_frame_host) override;
118 115
119 // Given |bounds| in the renderers coordinate system, return the same bounds 116 // Given |bounds| in the renderers coordinate system, return the same bounds
120 // in the screens coordinate system. 117 // in the screens coordinate system.
121 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); 118 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds);
122 119
123 // Causes the password generation UI to be shown for the specified form. 120 // Causes the password generation UI to be shown for the specified form.
124 // The popup will be anchored at |element_bounds|. The generated password 121 // The popup will be anchored at |element_bounds|. The generated password
125 // will be no longer than |max_length|. 122 // will be no longer than |max_length|.
126 void ShowPasswordGenerationPopup(content::RenderFrameHost* render_frame_host, 123 void ShowPasswordGenerationPopup(content::RenderFrameHost* render_frame_host,
127 const gfx::RectF& bounds, 124 const gfx::RectF& bounds,
128 int max_length, 125 int max_length,
129 const autofill::PasswordForm& form); 126 const autofill::PasswordForm& form);
130 127
131 // Causes the password editing UI to be shown anchored at |element_bounds|. 128 // Causes the password editing UI to be shown anchored at |element_bounds|.
132 void ShowPasswordEditingPopup(content::RenderFrameHost* render_frame_host, 129 void ShowPasswordEditingPopup(content::RenderFrameHost* render_frame_host,
133 const gfx::RectF& bounds, 130 const gfx::RectF& bounds,
134 const autofill::PasswordForm& form); 131 const autofill::PasswordForm& form);
135 132
136 // Sends a message to the renderer with the current value of 133 // Sends a message to the renderer with the current value of
137 // |can_use_log_router_|. 134 // |can_use_log_router_|.
138 void NotifyRendererOfLoggingAvailability(); 135 void NotifyRendererOfLoggingAvailability();
139 136
140 // Returns true if the last loaded page was for transactional re-auth on a
141 // Google property.
142 bool LastLoadWasTransactionalReauthPage() const;
143
144 // Returns true if |url| is the reauth page for accessing the password 137 // Returns true if |url| is the reauth page for accessing the password
145 // website. 138 // website.
146 bool IsURLPasswordWebsiteReauth(const GURL& url) const; 139 bool IsURLPasswordWebsiteReauth(const GURL& url) const;
147 140
148 // Sets |autofill_state_| based on experiment and flag values.
149 void SetUpAutofillSyncState();
150
151 Profile* const profile_; 141 Profile* const profile_;
152 142
153 password_manager::PasswordManager password_manager_; 143 password_manager::PasswordManager password_manager_;
154 144
155 password_manager::ContentPasswordManagerDriverFactory* driver_factory_; 145 password_manager::ContentPasswordManagerDriverFactory* driver_factory_;
156 146
157 password_manager::CredentialManagerDispatcher 147 password_manager::CredentialManagerDispatcher
158 credential_manager_dispatcher_; 148 credential_manager_dispatcher_;
159 149
160 // Observer for password generation popup. 150 // Observer for password generation popup.
161 autofill::PasswordGenerationPopupObserver* observer_; 151 autofill::PasswordGenerationPopupObserver* observer_;
162 152
163 // Controls the popup 153 // Controls the popup
164 base::WeakPtr< 154 base::WeakPtr<
165 autofill::PasswordGenerationPopupControllerImpl> popup_controller_; 155 autofill::PasswordGenerationPopupControllerImpl> popup_controller_;
166 156
167 // True if |this| is registered with some LogRouter which can accept logs. 157 // True if |this| is registered with some LogRouter which can accept logs.
168 bool can_use_log_router_; 158 bool can_use_log_router_;
169 159
170 // How to handle the sync credential in ShouldFilterAutofillResult().
171 AutofillForSyncCredentialsState autofill_sync_state_;
172
173 // If the sync credential was filtered during autofill. Used for statistics
174 // reporting.
175 bool sync_credential_was_filtered_;
176
177 // Set to false to disable password saving (will no longer ask if you 160 // Set to false to disable password saving (will no longer ask if you
178 // want to save passwords but will continue to fill passwords). 161 // want to save passwords but will continue to fill passwords).
179 BooleanPrefMember saving_passwords_enabled_; 162 BooleanPrefMember saving_passwords_enabled_;
180 163
181 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); 164 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient);
182 }; 165 };
183 166
184 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ 167 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698