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

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

Issue 707173004: Refactor Autofill for out of process iframes (OOPIF). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 "components/password_manager/content/browser/content_credential_manager _dispatcher.h" 10 #include "components/password_manager/content/browser/content_credential_manager _dispatcher.h"
11 #include "components/password_manager/content/browser/content_password_manager_d river.h" 11 #include "components/password_manager/content/browser/content_password_manager_d river_factory.h"
12 #include "components/password_manager/core/browser/password_manager_client.h" 12 #include "components/password_manager/core/browser/password_manager_client.h"
13 #include "content/public/browser/web_contents_observer.h" 13 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/browser/web_contents_user_data.h" 14 #include "content/public/browser/web_contents_user_data.h"
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 16
17 class Profile; 17 class Profile;
18 18
19 namespace autofill { 19 namespace autofill {
20 class PasswordGenerationPopupObserver; 20 class PasswordGenerationPopupObserver;
21 class PasswordGenerationPopupControllerImpl; 21 class PasswordGenerationPopupControllerImpl;
22 } 22 }
23 23
24 namespace content { 24 namespace content {
25 class WebContents; 25 class WebContents;
26 } 26 }
27 27
28 namespace password_manager { 28 namespace password_manager {
29 struct CredentialInfo; 29 struct CredentialInfo;
30 class PasswordGenerationManager; 30 class PasswordGenerationManager;
31 class PasswordManager; 31 class PasswordManager;
32 class PasswordManagerDriver;
32 } 33 }
33 34
34 // ChromePasswordManagerClient implements the PasswordManagerClient interface. 35 // ChromePasswordManagerClient implements the PasswordManagerClient interface.
35 class ChromePasswordManagerClient 36 class ChromePasswordManagerClient
36 : public password_manager::PasswordManagerClient, 37 : public password_manager::PasswordManagerClient,
37 public content::WebContentsObserver, 38 public content::WebContentsObserver,
38 public content::WebContentsUserData<ChromePasswordManagerClient> { 39 public content::WebContentsUserData<ChromePasswordManagerClient> {
39 public: 40 public:
40 ~ChromePasswordManagerClient() override; 41 ~ChromePasswordManagerClient() override;
41 42
42 // PasswordManagerClient implementation. 43 // PasswordManagerClient implementation.
43 bool IsAutomaticPasswordSavingEnabled() const override; 44 bool IsAutomaticPasswordSavingEnabled() const override;
44 bool IsPasswordManagerEnabledForCurrentPage() const override; 45 bool IsPasswordManagerEnabledForCurrentPage() const override;
45 bool ShouldFilterAutofillResult(const autofill::PasswordForm& form) override; 46 bool ShouldFilterAutofillResult(const autofill::PasswordForm& form) override;
46 std::string GetSyncUsername() const override; 47 std::string GetSyncUsername() const override;
47 bool IsSyncAccountCredential(const std::string& username, 48 bool IsSyncAccountCredential(const std::string& username,
48 const std::string& origin) const override; 49 const std::string& origin) const override;
49 void AutofillResultsComputed() override; 50 void AutofillResultsComputed() override;
50 bool PromptUserToSavePassword( 51 bool PromptUserToSavePassword(
51 scoped_ptr<password_manager::PasswordFormManager> form_to_save) override; 52 scoped_ptr<password_manager::PasswordFormManager> form_to_save) override;
52 void AutomaticPasswordSave(scoped_ptr<password_manager::PasswordFormManager> 53 void AutomaticPasswordSave(scoped_ptr<password_manager::PasswordFormManager>
53 saved_form_manager) override; 54 saved_form_manager) override;
54 void PasswordWasAutofilled( 55 void PasswordWasAutofilled(
55 const autofill::PasswordFormMap& best_matches) const override; 56 const autofill::PasswordFormMap& best_matches) const override;
56 void PasswordAutofillWasBlocked( 57 void PasswordAutofillWasBlocked(
57 const autofill::PasswordFormMap& best_matches) const override; 58 const autofill::PasswordFormMap& best_matches) const override;
58 PrefService* GetPrefs() override; 59 PrefService* GetPrefs() override;
59 password_manager::PasswordStore* GetPasswordStore() override; 60 password_manager::PasswordStore* GetPasswordStore() override;
60 password_manager::PasswordManagerDriver* GetDriver() override;
61 base::FieldTrial::Probability GetProbabilityForExperiment( 61 base::FieldTrial::Probability GetProbabilityForExperiment(
62 const std::string& experiment_name) override; 62 const std::string& experiment_name) override;
63 bool IsPasswordSyncEnabled( 63 bool IsPasswordSyncEnabled(
64 password_manager::CustomPassphraseState state) override; 64 password_manager::CustomPassphraseState state) override;
65 void OnLogRouterAvailabilityChanged(bool router_can_be_used) override; 65 void OnLogRouterAvailabilityChanged(bool router_can_be_used) override;
66 void LogSavePasswordProgress(const std::string& text) override; 66 void LogSavePasswordProgress(const std::string& text) override;
67 bool IsLoggingActive() const override; 67 bool IsLoggingActive() const override;
68 // DEPRECATED
vabr (Chromium) 2014/11/10 14:34:38 nit: Further helpful information to put here: * A
Evan Stade 2014/11/14 23:25:49 Done.
69 password_manager::PasswordManagerDriver* GetDriver() override;
68 70
69 // Hides any visible generation UI. 71 // Hides any visible generation UI.
70 void HidePasswordGenerationPopup(); 72 void HidePasswordGenerationPopup();
71 73
72 static void CreateForWebContentsWithAutofillClient( 74 static void CreateForWebContentsWithAutofillClient(
73 content::WebContents* contents, 75 content::WebContents* contents,
74 autofill::AutofillClient* autofill_client); 76 autofill::AutofillClient* autofill_client);
75 77
76 // Convenience method to allow //chrome code easy access to a PasswordManager
77 // from a WebContents instance.
78 static password_manager::PasswordManager* GetManagerFromWebContents(
79 content::WebContents* contents);
80
81 // Convenience method to allow //chrome code easy access to a
82 // PasswordGenerationManager from a WebContents instance.
83 static password_manager::PasswordGenerationManager*
84 GetGenerationManagerFromWebContents(content::WebContents* contents);
85
86 // Observer for PasswordGenerationPopup events. Used for testing. 78 // Observer for PasswordGenerationPopup events. Used for testing.
87 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer); 79 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer);
88 80
89 // Returns true if the bubble UI is enabled, and false if we're still using 81 // Returns true if the bubble UI is enabled, and false if we're still using
90 // the sad old Infobar UI. 82 // the sad old Infobar UI.
91 static bool IsTheHotNewBubbleUIEnabled(); 83 static bool IsTheHotNewBubbleUIEnabled();
92 84
93 // Returns true if the password manager should be enabled during sync signin. 85 // Returns true if the password manager should be enabled during sync signin.
94 static bool EnabledForSyncSignin(); 86 static bool EnabledForSyncSignin();
95 87
96 protected: 88 protected:
97 // Callable for tests. 89 // Callable for tests.
98 ChromePasswordManagerClient(content::WebContents* web_contents, 90 ChromePasswordManagerClient(content::WebContents* web_contents,
99 autofill::AutofillClient* autofill_client); 91 autofill::AutofillClient* autofill_client);
100 92
101 private: 93 private:
102 enum AutofillForSyncCredentialsState { 94 enum AutofillForSyncCredentialsState {
103 ALLOW_SYNC_CREDENTIALS, 95 ALLOW_SYNC_CREDENTIALS,
104 DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH, 96 DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH,
105 DISALLOW_SYNC_CREDENTIALS, 97 DISALLOW_SYNC_CREDENTIALS,
106 }; 98 };
107 99
108 friend class content::WebContentsUserData<ChromePasswordManagerClient>; 100 friend class content::WebContentsUserData<ChromePasswordManagerClient>;
109 101
110 // content::WebContentsObserver overrides. 102 // content::WebContentsObserver overrides.
111 bool OnMessageReceived(const IPC::Message& message) override; 103 bool OnMessageReceived(const IPC::Message& message,
104 content::RenderFrameHost* render_frame_host) override;
112 105
113 // Given |bounds| in the renderers coordinate system, return the same bounds 106 // Given |bounds| in the renderers coordinate system, return the same bounds
114 // in the screens coordinate system. 107 // in the screens coordinate system.
115 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); 108 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds);
116 109
117 // Causes the password generation UI to be shown for the specified form. 110 // Causes the password generation UI to be shown for the specified form.
118 // The popup will be anchored at |element_bounds|. The generated password 111 // The popup will be anchored at |element_bounds|. The generated password
119 // will be no longer than |max_length|. 112 // will be no longer than |max_length|.
120 void ShowPasswordGenerationPopup(const gfx::RectF& bounds, 113 void ShowPasswordGenerationPopup(const gfx::RectF& bounds,
121 int max_length, 114 int max_length,
(...skipping 13 matching lines...) Expand all
135 128
136 // Returns true if |url| is the reauth page for accessing the password 129 // Returns true if |url| is the reauth page for accessing the password
137 // website. 130 // website.
138 bool IsURLPasswordWebsiteReauth(const GURL& url) const; 131 bool IsURLPasswordWebsiteReauth(const GURL& url) const;
139 132
140 // Sets |autofill_state_| based on experiment and flag values. 133 // Sets |autofill_state_| based on experiment and flag values.
141 void SetUpAutofillSyncState(); 134 void SetUpAutofillSyncState();
142 135
143 Profile* const profile_; 136 Profile* const profile_;
144 137
145 password_manager::ContentPasswordManagerDriver driver_; 138 password_manager::ContentPasswordManagerDriverFactory driver_;
146 139
147 password_manager::ContentCredentialManagerDispatcher 140 password_manager::ContentCredentialManagerDispatcher
148 credential_manager_dispatcher_; 141 credential_manager_dispatcher_;
149 142
150 // Observer for password generation popup. 143 // Observer for password generation popup.
151 autofill::PasswordGenerationPopupObserver* observer_; 144 autofill::PasswordGenerationPopupObserver* observer_;
152 145
153 // Controls the popup 146 // Controls the popup
154 base::WeakPtr< 147 base::WeakPtr<
155 autofill::PasswordGenerationPopupControllerImpl> popup_controller_; 148 autofill::PasswordGenerationPopupControllerImpl> popup_controller_;
156 149
157 // True if |this| is registered with some LogRouter which can accept logs. 150 // True if |this| is registered with some LogRouter which can accept logs.
158 bool can_use_log_router_; 151 bool can_use_log_router_;
159 152
160 // How to handle the sync credential in ShouldFilterAutofillResult(). 153 // How to handle the sync credential in ShouldFilterAutofillResult().
161 AutofillForSyncCredentialsState autofill_sync_state_; 154 AutofillForSyncCredentialsState autofill_sync_state_;
162 155
163 // If the sync credential was filtered during autofill. Used for statistics 156 // If the sync credential was filtered during autofill. Used for statistics
164 // reporting. 157 // reporting.
165 bool sync_credential_was_filtered_; 158 bool sync_credential_was_filtered_;
166 159
160 // When non-NULL, the source of the current IPC message.
vabr (Chromium) 2014/11/10 14:34:38 nit: Maybe explicitly add that this is only non-NU
Evan Stade 2014/11/14 23:25:49 I think that's implied by "current IPC message"
161 content::RenderFrameHost* render_frame_host_source_;
162
167 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); 163 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient);
168 }; 164 };
169 165
170 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ 166 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698