| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class PasswordAutofillManager : public autofill::AutofillPopupDelegate { | 25 class PasswordAutofillManager : public autofill::AutofillPopupDelegate { |
| 26 public: | 26 public: |
| 27 PasswordAutofillManager(PasswordManagerDriver* password_manager_driver, | 27 PasswordAutofillManager(PasswordManagerDriver* password_manager_driver, |
| 28 autofill::AutofillClient* autofill_client); | 28 autofill::AutofillClient* autofill_client); |
| 29 virtual ~PasswordAutofillManager(); | 29 virtual ~PasswordAutofillManager(); |
| 30 | 30 |
| 31 // AutofillPopupDelegate implementation. | 31 // AutofillPopupDelegate implementation. |
| 32 void OnPopupShown() override; | 32 void OnPopupShown() override; |
| 33 void OnPopupHidden() override; | 33 void OnPopupHidden() override; |
| 34 void DidSelectSuggestion(const base::string16& value, | 34 void DidSelectSuggestion(const base::string16& value, |
| 35 int identifier) override; | 35 int identifier, |
| 36 size_t match_start) override; |
| 36 void DidAcceptSuggestion(const base::string16& value, | 37 void DidAcceptSuggestion(const base::string16& value, |
| 37 int identifier, | 38 int identifier, |
| 38 int position) override; | 39 int position) override; |
| 39 bool GetDeletionConfirmationText(const base::string16& value, | 40 bool GetDeletionConfirmationText(const base::string16& value, |
| 40 int identifier, | 41 int identifier, |
| 41 base::string16* title, | 42 base::string16* title, |
| 42 base::string16* body) override; | 43 base::string16* body) override; |
| 43 bool RemoveSuggestion(const base::string16& value, int identifier) override; | 44 bool RemoveSuggestion(const base::string16& value, int identifier) override; |
| 44 void ClearPreviewedForm() override; | 45 void ClearPreviewedForm() override; |
| 45 | 46 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 57 int options, | 58 int options, |
| 58 const gfx::RectF& bounds); | 59 const gfx::RectF& bounds); |
| 59 | 60 |
| 60 // Called when main frame navigates. Not called for in-page navigations. | 61 // Called when main frame navigates. Not called for in-page navigations. |
| 61 void DidNavigateMainFrame(); | 62 void DidNavigateMainFrame(); |
| 62 | 63 |
| 63 // A public version of FillSuggestion(), only for use in tests. | 64 // A public version of FillSuggestion(), only for use in tests. |
| 64 bool FillSuggestionForTest(int key, const base::string16& username); | 65 bool FillSuggestionForTest(int key, const base::string16& username); |
| 65 | 66 |
| 66 // A public version of PreviewSuggestion(), only for use in tests. | 67 // A public version of PreviewSuggestion(), only for use in tests. |
| 67 bool PreviewSuggestionForTest(int key, const base::string16& username); | 68 bool PreviewSuggestionForTest(int key, |
| 69 const base::string16& username, |
| 70 size_t match_start); |
| 68 | 71 |
| 69 private: | 72 private: |
| 70 typedef std::map<int, autofill::PasswordFormFillData> LoginToPasswordInfoMap; | 73 typedef std::map<int, autofill::PasswordFormFillData> LoginToPasswordInfoMap; |
| 71 | 74 |
| 72 // Attempts to fill the password associated with user name |username|, and | 75 // Attempts to fill the password associated with user name |username|, and |
| 73 // returns true if it was successful. | 76 // returns true if it was successful. |
| 74 bool FillSuggestion(int key, const base::string16& username); | 77 bool FillSuggestion(int key, const base::string16& username); |
| 75 | 78 |
| 76 // Attempts to preview the password associated with user name |username|, and | 79 // Attempts to preview the password associated with user name |username|, and |
| 77 // returns true if it was successful. | 80 // returns true if it was successful. |
| 78 bool PreviewSuggestion(int key, const base::string16& username); | 81 bool PreviewSuggestion(int key, |
| 82 const base::string16& username, |
| 83 size_t match_start); |
| 79 | 84 |
| 80 // If |current_username| matches a username for one of the login mappings in | 85 // If |current_username| matches a username for one of the login mappings in |
| 81 // |fill_data|, returns true and assigns the password and the original signon | 86 // |fill_data|, returns true and assigns the password and the original signon |
| 82 // realm to |password_and_realm|. Note that if the credential comes from the | 87 // realm to |password_and_realm|. Note that if the credential comes from the |
| 83 // same realm as the one we're filling to, the |realm| field will be left | 88 // same realm as the one we're filling to, the |realm| field will be left |
| 84 // empty, as this is the behavior of |PasswordFormFillData|. | 89 // empty, as this is the behavior of |PasswordFormFillData|. |
| 85 // Otherwise, returns false and leaves |password_and_realm| untouched. | 90 // Otherwise, returns false and leaves |password_and_realm| untouched. |
| 86 bool GetPasswordAndRealmForUsername( | 91 bool GetPasswordAndRealmForUsername( |
| 87 const base::string16& current_username, | 92 const base::string16& current_username, |
| 88 const autofill::PasswordFormFillData& fill_data, | 93 const autofill::PasswordFormFillData& fill_data, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 104 autofill::AutofillClient* const autofill_client_; // weak | 109 autofill::AutofillClient* const autofill_client_; // weak |
| 105 | 110 |
| 106 base::WeakPtrFactory<PasswordAutofillManager> weak_ptr_factory_; | 111 base::WeakPtrFactory<PasswordAutofillManager> weak_ptr_factory_; |
| 107 | 112 |
| 108 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager); | 113 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager); |
| 109 }; | 114 }; |
| 110 | 115 |
| 111 } // namespace password_manager | 116 } // namespace password_manager |
| 112 | 117 |
| 113 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ | 118 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ |
| OLD | NEW |