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

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: Just rebased 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 PromptUserToSaveOrUpdatePassword( 53 bool PromptUserToSaveOrUpdatePassword(
54 scoped_ptr<password_manager::PasswordFormManager> form_to_save, 54 scoped_ptr<password_manager::PasswordFormManager> form_to_save,
55 password_manager::CredentialSourceType type, 55 password_manager::CredentialSourceType type,
56 bool update_password) override; 56 bool update_password) override;
57 bool PromptUserToChooseCredentials( 57 bool PromptUserToChooseCredentials(
58 ScopedVector<autofill::PasswordForm> local_forms, 58 ScopedVector<autofill::PasswordForm> local_forms,
59 ScopedVector<autofill::PasswordForm> federated_forms, 59 ScopedVector<autofill::PasswordForm> federated_forms,
60 const GURL& origin, 60 const GURL& origin,
61 base::Callback<void(const password_manager::CredentialInfo&)> callback) 61 base::Callback<void(const password_manager::CredentialInfo&)> callback)
62 override; 62 override;
(...skipping 12 matching lines...) Expand all
75 void OnLogRouterAvailabilityChanged(bool router_can_be_used) override; 75 void OnLogRouterAvailabilityChanged(bool router_can_be_used) override;
76 void LogSavePasswordProgress(const std::string& text) const override; 76 void LogSavePasswordProgress(const std::string& text) const override;
77 bool IsLoggingActive() const override; 77 bool IsLoggingActive() const override;
78 bool WasLastNavigationHTTPError() const override; 78 bool WasLastNavigationHTTPError() const override;
79 bool DidLastPageLoadEncounterSSLErrors() const override; 79 bool DidLastPageLoadEncounterSSLErrors() const override;
80 bool IsOffTheRecord() const override; 80 bool IsOffTheRecord() const override;
81 password_manager::PasswordManager* GetPasswordManager() override; 81 password_manager::PasswordManager* GetPasswordManager() override;
82 autofill::AutofillManager* GetAutofillManagerForMainFrame() override; 82 autofill::AutofillManager* GetAutofillManagerForMainFrame() override;
83 const GURL& GetMainFrameURL() const override; 83 const GURL& GetMainFrameURL() const override;
84 bool IsUpdatePasswordUIEnabled() const override; 84 bool IsUpdatePasswordUIEnabled() const override;
85 const GURL& GetLastCommittedEntryURL() const override;
86 scoped_ptr<password_manager::StoreResultFilter> CreateStoreResultFilter()
87 const override;
85 88
86 // Hides any visible generation UI. 89 // Hides any visible generation UI.
87 void HidePasswordGenerationPopup(); 90 void HidePasswordGenerationPopup();
88 91
89 static void CreateForWebContentsWithAutofillClient( 92 static void CreateForWebContentsWithAutofillClient(
90 content::WebContents* contents, 93 content::WebContents* contents,
91 autofill::AutofillClient* autofill_client); 94 autofill::AutofillClient* autofill_client);
92 95
93 // Observer for PasswordGenerationPopup events. Used for testing. 96 // Observer for PasswordGenerationPopup events. Used for testing.
94 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer); 97 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer);
95 98
96 // Returns true if the bubble UI is enabled, and false if we're still using 99 // Returns true if the bubble UI is enabled, and false if we're still using
97 // the sad old Infobar UI. 100 // the sad old Infobar UI.
98 static bool IsTheHotNewBubbleUIEnabled(); 101 static bool IsTheHotNewBubbleUIEnabled();
99 102
100 // Returns true if the password manager should be enabled during sync signin. 103 // Returns true if the password manager should be enabled during sync signin.
101 static bool EnabledForSyncSignin(); 104 static bool EnabledForSyncSignin();
102 105
103 protected: 106 protected:
104 // Callable for tests. 107 // Callable for tests.
105 ChromePasswordManagerClient(content::WebContents* web_contents, 108 ChromePasswordManagerClient(content::WebContents* web_contents,
106 autofill::AutofillClient* autofill_client); 109 autofill::AutofillClient* autofill_client);
107 110
108 private: 111 private:
109 enum AutofillForSyncCredentialsState {
110 ALLOW_SYNC_CREDENTIALS,
111 DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH,
112 DISALLOW_SYNC_CREDENTIALS,
113 };
114
115 friend class content::WebContentsUserData<ChromePasswordManagerClient>; 112 friend class content::WebContentsUserData<ChromePasswordManagerClient>;
116 113
117 // content::WebContentsObserver overrides. 114 // content::WebContentsObserver overrides.
118 bool OnMessageReceived(const IPC::Message& message, 115 bool OnMessageReceived(const IPC::Message& message,
119 content::RenderFrameHost* render_frame_host) override; 116 content::RenderFrameHost* render_frame_host) override;
120 117
121 // Given |bounds| in the renderers coordinate system, return the same bounds 118 // Given |bounds| in the renderers coordinate system, return the same bounds
122 // in the screens coordinate system. 119 // in the screens coordinate system.
123 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); 120 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds);
124 121
125 // Causes the password generation UI to be shown for the specified form. 122 // Causes the password generation UI to be shown for the specified form.
126 // The popup will be anchored at |element_bounds|. The generated password 123 // The popup will be anchored at |element_bounds|. The generated password
127 // will be no longer than |max_length|. 124 // will be no longer than |max_length|.
128 void ShowPasswordGenerationPopup(content::RenderFrameHost* render_frame_host, 125 void ShowPasswordGenerationPopup(content::RenderFrameHost* render_frame_host,
129 const gfx::RectF& bounds, 126 const gfx::RectF& bounds,
130 int max_length, 127 int max_length,
131 const autofill::PasswordForm& form); 128 const autofill::PasswordForm& form);
132 129
133 // Causes the password editing UI to be shown anchored at |element_bounds|. 130 // Causes the password editing UI to be shown anchored at |element_bounds|.
134 void ShowPasswordEditingPopup(content::RenderFrameHost* render_frame_host, 131 void ShowPasswordEditingPopup(content::RenderFrameHost* render_frame_host,
135 const gfx::RectF& bounds, 132 const gfx::RectF& bounds,
136 const autofill::PasswordForm& form); 133 const autofill::PasswordForm& form);
137 134
138 // Sends a message to the renderer with the current value of 135 // Sends a message to the renderer with the current value of
139 // |can_use_log_router_|. 136 // |can_use_log_router_|.
140 void NotifyRendererOfLoggingAvailability(); 137 void NotifyRendererOfLoggingAvailability();
141 138
142 // Returns true if the last loaded page was for transactional re-auth on a
143 // Google property.
144 bool LastLoadWasTransactionalReauthPage() const;
145
146 // Returns true if |url| is the reauth page for accessing the password 139 // Returns true if |url| is the reauth page for accessing the password
147 // website. 140 // website.
148 bool IsURLPasswordWebsiteReauth(const GURL& url) const; 141 bool IsURLPasswordWebsiteReauth(const GURL& url) const;
149 142
150 // Sets |autofill_state_| based on experiment and flag values.
151 void SetUpAutofillSyncState();
152
153 Profile* const profile_; 143 Profile* const profile_;
154 144
155 password_manager::PasswordManager password_manager_; 145 password_manager::PasswordManager password_manager_;
156 146
157 password_manager::ContentPasswordManagerDriverFactory* driver_factory_; 147 password_manager::ContentPasswordManagerDriverFactory* driver_factory_;
158 148
159 password_manager::CredentialManagerDispatcher 149 password_manager::CredentialManagerDispatcher
160 credential_manager_dispatcher_; 150 credential_manager_dispatcher_;
161 151
162 // Observer for password generation popup. 152 // Observer for password generation popup.
163 autofill::PasswordGenerationPopupObserver* observer_; 153 autofill::PasswordGenerationPopupObserver* observer_;
164 154
165 // Controls the popup 155 // Controls the popup
166 base::WeakPtr< 156 base::WeakPtr<
167 autofill::PasswordGenerationPopupControllerImpl> popup_controller_; 157 autofill::PasswordGenerationPopupControllerImpl> popup_controller_;
168 158
169 // True if |this| is registered with some LogRouter which can accept logs. 159 // True if |this| is registered with some LogRouter which can accept logs.
170 bool can_use_log_router_; 160 bool can_use_log_router_;
171 161
172 // How to handle the sync credential in ShouldFilterAutofillResult().
173 AutofillForSyncCredentialsState autofill_sync_state_;
174
175 // If the sync credential was filtered during autofill. Used for statistics
176 // reporting.
177 bool sync_credential_was_filtered_;
178
179 // Set to false to disable password saving (will no longer ask if you 162 // Set to false to disable password saving (will no longer ask if you
180 // want to save passwords but will continue to fill passwords). 163 // want to save passwords but will continue to fill passwords).
181 BooleanPrefMember saving_passwords_enabled_; 164 BooleanPrefMember saving_passwords_enabled_;
182 165
183 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); 166 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient);
184 }; 167 };
185 168
186 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ 169 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/password_manager/chrome_password_manager_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698