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 "components/password_manager/content/browser/content_credential_manager
_dispatcher.h" | 10 #include "components/password_manager/content/browser/content_credential_manager
_dispatcher.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 class PasswordGenerationManager; | 30 class PasswordGenerationManager; |
31 class PasswordManager; | 31 class PasswordManager; |
32 } | 32 } |
33 | 33 |
34 // ChromePasswordManagerClient implements the PasswordManagerClient interface. | 34 // ChromePasswordManagerClient implements the PasswordManagerClient interface. |
35 class ChromePasswordManagerClient | 35 class ChromePasswordManagerClient |
36 : public password_manager::PasswordManagerClient, | 36 : public password_manager::PasswordManagerClient, |
37 public content::WebContentsObserver, | 37 public content::WebContentsObserver, |
38 public content::WebContentsUserData<ChromePasswordManagerClient> { | 38 public content::WebContentsUserData<ChromePasswordManagerClient> { |
39 public: | 39 public: |
40 virtual ~ChromePasswordManagerClient(); | 40 ~ChromePasswordManagerClient() override; |
41 | 41 |
42 // PasswordManagerClient implementation. | 42 // PasswordManagerClient implementation. |
43 virtual bool IsAutomaticPasswordSavingEnabled() const override; | 43 bool IsAutomaticPasswordSavingEnabled() const override; |
44 virtual bool IsPasswordManagerEnabledForCurrentPage() const override; | 44 bool IsPasswordManagerEnabledForCurrentPage() const override; |
45 virtual bool ShouldFilterAutofillResult( | 45 bool ShouldFilterAutofillResult(const autofill::PasswordForm& form) override; |
46 const autofill::PasswordForm& form) override; | 46 bool IsSyncAccountCredential(const std::string& username, |
47 virtual bool IsSyncAccountCredential( | 47 const std::string& origin) const override; |
48 const std::string& username, const std::string& origin) const override; | 48 void AutofillResultsComputed() override; |
49 virtual void AutofillResultsComputed() override; | 49 bool PromptUserToSavePassword( |
50 virtual bool PromptUserToSavePassword( | |
51 scoped_ptr<password_manager::PasswordFormManager> form_to_save) override; | 50 scoped_ptr<password_manager::PasswordFormManager> form_to_save) override; |
52 virtual void AutomaticPasswordSave( | 51 void AutomaticPasswordSave(scoped_ptr<password_manager::PasswordFormManager> |
53 scoped_ptr<password_manager::PasswordFormManager> saved_form_manager) | 52 saved_form_manager) override; |
54 override; | 53 void PasswordWasAutofilled( |
55 virtual void PasswordWasAutofilled( | |
56 const autofill::PasswordFormMap& best_matches) const override; | 54 const autofill::PasswordFormMap& best_matches) const override; |
57 virtual void PasswordAutofillWasBlocked( | 55 void PasswordAutofillWasBlocked( |
58 const autofill::PasswordFormMap& best_matches) const override; | 56 const autofill::PasswordFormMap& best_matches) const override; |
59 virtual PrefService* GetPrefs() override; | 57 PrefService* GetPrefs() override; |
60 virtual password_manager::PasswordStore* GetPasswordStore() override; | 58 password_manager::PasswordStore* GetPasswordStore() override; |
61 virtual password_manager::PasswordManagerDriver* GetDriver() override; | 59 password_manager::PasswordManagerDriver* GetDriver() override; |
62 virtual base::FieldTrial::Probability GetProbabilityForExperiment( | 60 base::FieldTrial::Probability GetProbabilityForExperiment( |
63 const std::string& experiment_name) override; | 61 const std::string& experiment_name) override; |
64 virtual bool IsPasswordSyncEnabled() override; | 62 bool IsPasswordSyncEnabled() override; |
65 virtual void OnLogRouterAvailabilityChanged(bool router_can_be_used) override; | 63 void OnLogRouterAvailabilityChanged(bool router_can_be_used) override; |
66 virtual void LogSavePasswordProgress(const std::string& text) override; | 64 void LogSavePasswordProgress(const std::string& text) override; |
67 virtual bool IsLoggingActive() const override; | 65 bool IsLoggingActive() const override; |
68 | 66 |
69 // Hides any visible generation UI. | 67 // Hides any visible generation UI. |
70 void HidePasswordGenerationPopup(); | 68 void HidePasswordGenerationPopup(); |
71 | 69 |
72 static void CreateForWebContentsWithAutofillClient( | 70 static void CreateForWebContentsWithAutofillClient( |
73 content::WebContents* contents, | 71 content::WebContents* contents, |
74 autofill::AutofillClient* autofill_client); | 72 autofill::AutofillClient* autofill_client); |
75 | 73 |
76 // Convenience method to allow //chrome code easy access to a PasswordManager | 74 // Convenience method to allow //chrome code easy access to a PasswordManager |
77 // from a WebContents instance. | 75 // from a WebContents instance. |
(...skipping 23 matching lines...) Expand all Loading... |
101 private: | 99 private: |
102 enum AutofillForSyncCredentialsState { | 100 enum AutofillForSyncCredentialsState { |
103 ALLOW_SYNC_CREDENTIALS, | 101 ALLOW_SYNC_CREDENTIALS, |
104 DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH, | 102 DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH, |
105 DISALLOW_SYNC_CREDENTIALS, | 103 DISALLOW_SYNC_CREDENTIALS, |
106 }; | 104 }; |
107 | 105 |
108 friend class content::WebContentsUserData<ChromePasswordManagerClient>; | 106 friend class content::WebContentsUserData<ChromePasswordManagerClient>; |
109 | 107 |
110 // content::WebContentsObserver overrides. | 108 // content::WebContentsObserver overrides. |
111 virtual bool OnMessageReceived(const IPC::Message& message) override; | 109 bool OnMessageReceived(const IPC::Message& message) override; |
112 | 110 |
113 // Given |bounds| in the renderers coordinate system, return the same bounds | 111 // Given |bounds| in the renderers coordinate system, return the same bounds |
114 // in the screens coordinate system. | 112 // in the screens coordinate system. |
115 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); | 113 gfx::RectF GetBoundsInScreenSpace(const gfx::RectF& bounds); |
116 | 114 |
117 // Causes the password generation UI to be shown for the specified form. | 115 // Causes the password generation UI to be shown for the specified form. |
118 // The popup will be anchored at |element_bounds|. The generated password | 116 // The popup will be anchored at |element_bounds|. The generated password |
119 // will be no longer than |max_length|. | 117 // will be no longer than |max_length|. |
120 void ShowPasswordGenerationPopup(const gfx::RectF& bounds, | 118 void ShowPasswordGenerationPopup(const gfx::RectF& bounds, |
121 int max_length, | 119 int max_length, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 AutofillForSyncCredentialsState autofill_sync_state_; | 159 AutofillForSyncCredentialsState autofill_sync_state_; |
162 | 160 |
163 // If the sync credential was filtered during autofill. Used for statistics | 161 // If the sync credential was filtered during autofill. Used for statistics |
164 // reporting. | 162 // reporting. |
165 bool sync_credential_was_filtered_; | 163 bool sync_credential_was_filtered_; |
166 | 164 |
167 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); | 165 DISALLOW_COPY_AND_ASSIGN(ChromePasswordManagerClient); |
168 }; | 166 }; |
169 | 167 |
170 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ | 168 #endif // CHROME_BROWSER_PASSWORD_MANAGER_CHROME_PASSWORD_MANAGER_CLIENT_H_ |
OLD | NEW |