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 "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" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 void ForceSavePassword() override; | 61 void ForceSavePassword() override; |
62 void NotifyUserAutoSignin( | 62 void NotifyUserAutoSignin( |
63 ScopedVector<autofill::PasswordForm> local_forms) override; | 63 ScopedVector<autofill::PasswordForm> local_forms) override; |
64 void AutomaticPasswordSave(scoped_ptr<password_manager::PasswordFormManager> | 64 void AutomaticPasswordSave(scoped_ptr<password_manager::PasswordFormManager> |
65 saved_form_manager) override; | 65 saved_form_manager) override; |
66 void PasswordWasAutofilled(const autofill::PasswordFormMap& best_matches, | 66 void PasswordWasAutofilled(const autofill::PasswordFormMap& best_matches, |
67 const GURL& origin) const override; | 67 const GURL& origin) const override; |
68 PrefService* GetPrefs() override; | 68 PrefService* GetPrefs() override; |
69 password_manager::PasswordStore* GetPasswordStore() const override; | 69 password_manager::PasswordStore* GetPasswordStore() const override; |
70 password_manager::PasswordSyncState GetPasswordSyncState() const override; | 70 password_manager::PasswordSyncState GetPasswordSyncState() const override; |
71 void OnLogRouterAvailabilityChanged(bool router_can_be_used) override; | |
72 void LogSavePasswordProgress(const std::string& text) const override; | |
73 bool IsLoggingActive() const override; | |
74 bool WasLastNavigationHTTPError() const override; | 71 bool WasLastNavigationHTTPError() const override; |
75 bool DidLastPageLoadEncounterSSLErrors() const override; | 72 bool DidLastPageLoadEncounterSSLErrors() const override; |
76 bool IsOffTheRecord() const override; | 73 bool IsOffTheRecord() const override; |
77 const password_manager::PasswordManager* GetPasswordManager() const override; | 74 const password_manager::PasswordManager* GetPasswordManager() const override; |
78 autofill::AutofillManager* GetAutofillManagerForMainFrame() override; | 75 autofill::AutofillManager* GetAutofillManagerForMainFrame() override; |
79 const GURL& GetMainFrameURL() const override; | 76 const GURL& GetMainFrameURL() const override; |
80 bool IsUpdatePasswordUIEnabled() const override; | 77 bool IsUpdatePasswordUIEnabled() const override; |
81 const GURL& GetLastCommittedEntryURL() const override; | 78 const GURL& GetLastCommittedEntryURL() const override; |
82 const password_manager::CredentialsFilter* GetStoreResultFilter() | 79 const password_manager::CredentialsFilter* GetStoreResultFilter() |
83 const override; | 80 const override; |
| 81 const password_manager::LogManager* GetLogManager() const override; |
84 | 82 |
85 // Hides any visible generation UI. | 83 // Hides any visible generation UI. |
86 void HidePasswordGenerationPopup(); | 84 void HidePasswordGenerationPopup(); |
87 | 85 |
88 static void CreateForWebContentsWithAutofillClient( | 86 static void CreateForWebContentsWithAutofillClient( |
89 content::WebContents* contents, | 87 content::WebContents* contents, |
90 autofill::AutofillClient* autofill_client); | 88 autofill::AutofillClient* autofill_client); |
91 | 89 |
92 // Observer for PasswordGenerationPopup events. Used for testing. | 90 // Observer for PasswordGenerationPopup events. Used for testing. |
93 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer); | 91 void SetTestObserver(autofill::PasswordGenerationPopupObserver* observer); |
94 | 92 |
95 // Returns true if the bubble UI is enabled, and false if we're still using | 93 // Returns true if the bubble UI is enabled, and false if we're still using |
96 // the sad old Infobar UI. | 94 // the sad old Infobar UI. |
97 static bool IsTheHotNewBubbleUIEnabled(); | 95 static bool IsTheHotNewBubbleUIEnabled(); |
98 | 96 |
99 // Returns true if the password manager should be enabled during sync signin. | 97 // Returns true if the password manager should be enabled during sync signin. |
100 static bool EnabledForSyncSignin(); | 98 static bool EnabledForSyncSignin(); |
101 | 99 |
102 protected: | 100 protected: |
103 // Callable for tests. | 101 // Callable for tests. |
104 ChromePasswordManagerClient(content::WebContents* web_contents, | 102 ChromePasswordManagerClient(content::WebContents* web_contents, |
105 autofill::AutofillClient* autofill_client); | 103 autofill::AutofillClient* autofill_client); |
106 | 104 |
107 private: | 105 private: |
108 friend class content::WebContentsUserData<ChromePasswordManagerClient>; | 106 friend class content::WebContentsUserData<ChromePasswordManagerClient>; |
109 | 107 |
110 // content::WebContentsObserver overrides. | 108 // content::WebContentsObserver overrides. |
111 bool OnMessageReceived(const IPC::Message& message, | 109 bool OnMessageReceived(const IPC::Message& message, |
112 content::RenderFrameHost* render_frame_host) override; | 110 content::RenderFrameHost* render_frame_host) override; |
| 111 void DidStartNavigation( |
| 112 content::NavigationHandle* navigation_handle) override; |
113 | 113 |
114 // Given |bounds| in the renderers coordinate system, return the same bounds | 114 // Given |bounds| in the renderers coordinate system, return the same bounds |
115 // in the screens coordinate system. | 115 // in the screens coordinate system. |
116 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); | 116 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); |
117 | 117 |
118 // Checks if the current page fulfils the conditions for the password manager | 118 // Checks if the current page fulfils the conditions for the password manager |
119 // to be active on it, for example Sync credentials are not saved or auto | 119 // to be active on it, for example Sync credentials are not saved or auto |
120 // filled. | 120 // filled. |
121 bool IsPasswordManagementEnabledForCurrentPage() const; | 121 bool IsPasswordManagementEnabledForCurrentPage() const; |
122 | 122 |
123 // Causes the password generation UI to be shown for the specified form. | 123 // Causes the password generation UI to be shown for the specified form. |
124 // The popup will be anchored at |element_bounds|. The generated password | 124 // The popup will be anchored at |element_bounds|. The generated password |
125 // will be no longer than |max_length|. | 125 // will be no longer than |max_length|. |
126 void ShowPasswordGenerationPopup(content::RenderFrameHost* render_frame_host, | 126 void ShowPasswordGenerationPopup(content::RenderFrameHost* render_frame_host, |
127 const gfx::RectF& bounds, | 127 const gfx::RectF& bounds, |
128 int max_length, | 128 int max_length, |
129 const autofill::PasswordForm& form); | 129 const autofill::PasswordForm& form); |
130 | 130 |
131 // Causes the password editing UI to be shown anchored at |element_bounds|. | 131 // Causes the password editing UI to be shown anchored at |element_bounds|. |
132 void ShowPasswordEditingPopup(content::RenderFrameHost* render_frame_host, | 132 void ShowPasswordEditingPopup(content::RenderFrameHost* render_frame_host, |
133 const gfx::RectF& bounds, | 133 const gfx::RectF& bounds, |
134 const autofill::PasswordForm& form); | 134 const autofill::PasswordForm& form); |
135 | 135 |
136 // Notify the PasswordManager that generation is available for |form|. Used | 136 // Notify the PasswordManager that generation is available for |form|. Used |
137 // for UMA stats. | 137 // for UMA stats. |
138 void GenerationAvailableForForm(const autofill::PasswordForm& form); | 138 void GenerationAvailableForForm(const autofill::PasswordForm& form); |
139 | 139 |
140 // Sends a message to the renderer with the current value of | |
141 // |can_use_log_router_|. | |
142 void NotifyRendererOfLoggingAvailability(); | |
143 | |
144 Profile* const profile_; | 140 Profile* const profile_; |
145 | 141 |
146 password_manager::PasswordManager password_manager_; | 142 password_manager::PasswordManager password_manager_; |
147 | 143 |
148 password_manager::ContentPasswordManagerDriverFactory* driver_factory_; | 144 password_manager::ContentPasswordManagerDriverFactory* driver_factory_; |
149 | 145 |
150 password_manager::CredentialManagerDispatcher | 146 password_manager::CredentialManagerDispatcher |
151 credential_manager_dispatcher_; | 147 credential_manager_dispatcher_; |
152 | 148 |
153 // Observer for password generation popup. | 149 // Observer for password generation popup. |
154 autofill::PasswordGenerationPopupObserver* observer_; | 150 autofill::PasswordGenerationPopupObserver* observer_; |
155 | 151 |
156 // Controls the popup | 152 // Controls the popup |
157 base::WeakPtr< | 153 base::WeakPtr< |
158 autofill::PasswordGenerationPopupControllerImpl> popup_controller_; | 154 autofill::PasswordGenerationPopupControllerImpl> popup_controller_; |
159 | 155 |
160 // True if |this| is registered with some LogRouter which can accept logs. | |
161 bool can_use_log_router_; | |
162 | |
163 // Set to false to disable password saving (will no longer ask if you | 156 // Set to false to disable password saving (will no longer ask if you |
164 // want to save passwords and also won't fill the passwords). | 157 // want to save passwords and also won't fill the passwords). |
165 BooleanPrefMember saving_and_filling_passwords_enabled_; | 158 BooleanPrefMember saving_and_filling_passwords_enabled_; |
166 | 159 |
167 const password_manager::SyncStoreResultFilter credentials_filter_; | 160 const password_manager::SyncStoreResultFilter credentials_filter_; |
168 | 161 |
| 162 scoped_ptr<password_manager::LogManager> log_manager_; |
| 163 |
169 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); | 164 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); |
170 }; | 165 }; |
171 | 166 |
172 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ | 167 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ |
OLD | NEW |