| 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_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_DELEGATE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_DELEGATE_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_DELEGATE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "third_party/WebKit/public/web/WebFormElement.h" |
| 14 | 15 |
| 15 namespace gfx { | 16 namespace gfx { |
| 16 class Rect; | 17 class Rect; |
| 17 class RectF; | 18 class RectF; |
| 18 } | 19 } |
| 19 | 20 |
| 20 class GURL; | 21 class GURL; |
| 21 class InfoBarService; | 22 class InfoBarService; |
| 22 class PrefService; | 23 class PrefService; |
| 23 | 24 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 // A delegate interface that needs to be supplied to AutofillManager | 37 // A delegate interface that needs to be supplied to AutofillManager |
| 37 // by the embedder. | 38 // by the embedder. |
| 38 // | 39 // |
| 39 // Each delegate instance is associated with a given context within | 40 // Each delegate instance is associated with a given context within |
| 40 // which an AutofillManager is used (e.g. a single tab), so when we | 41 // which an AutofillManager is used (e.g. a single tab), so when we |
| 41 // say "for the delegate" below, we mean "in the execution context the | 42 // say "for the delegate" below, we mean "in the execution context the |
| 42 // delegate is associated with" (e.g. for the tab the AutofillManager is | 43 // delegate is associated with" (e.g. for the tab the AutofillManager is |
| 43 // attached to). | 44 // attached to). |
| 44 class AutofillManagerDelegate { | 45 class AutofillManagerDelegate { |
| 45 public: | 46 public: |
| 47 typedef base::Callback< |
| 48 void(blink::WebFormElement::AutocompleteResult, |
| 49 const FormStructure*)> ResultCallback; |
| 50 |
| 46 virtual ~AutofillManagerDelegate() {} | 51 virtual ~AutofillManagerDelegate() {} |
| 47 | 52 |
| 48 // Gets the PersonalDataManager instance associated with the delegate. | 53 // Gets the PersonalDataManager instance associated with the delegate. |
| 49 virtual PersonalDataManager* GetPersonalDataManager() = 0; | 54 virtual PersonalDataManager* GetPersonalDataManager() = 0; |
| 50 | 55 |
| 51 // Gets the AutofillWebDataService instance associated with the delegate. | 56 // Gets the AutofillWebDataService instance associated with the delegate. |
| 52 virtual scoped_refptr<AutofillWebDataService> GetDatabase() = 0; | 57 virtual scoped_refptr<AutofillWebDataService> GetDatabase() = 0; |
| 53 | 58 |
| 54 // Gets the preferences associated with the delegate. | 59 // Gets the preferences associated with the delegate. |
| 55 virtual PrefService* GetPrefs() = 0; | 60 virtual PrefService* GetPrefs() = 0; |
| 56 | 61 |
| 57 // Hides the associated request autocomplete dialog (if it exists). | 62 // Hides the associated request autocomplete dialog (if it exists). |
| 58 virtual void HideRequestAutocompleteDialog() = 0; | 63 virtual void HideRequestAutocompleteDialog() = 0; |
| 59 | 64 |
| 60 // Causes the Autofill settings UI to be shown. | 65 // Causes the Autofill settings UI to be shown. |
| 61 virtual void ShowAutofillSettings() = 0; | 66 virtual void ShowAutofillSettings() = 0; |
| 62 | 67 |
| 63 // Run |save_card_callback| if the credit card should be imported as personal | 68 // Run |save_card_callback| if the credit card should be imported as personal |
| 64 // data. |metric_logger| can be used to log user actions. | 69 // data. |metric_logger| can be used to log user actions. |
| 65 virtual void ConfirmSaveCreditCard( | 70 virtual void ConfirmSaveCreditCard( |
| 66 const AutofillMetrics& metric_logger, | 71 const AutofillMetrics& metric_logger, |
| 67 const base::Closure& save_card_callback) = 0; | 72 const base::Closure& save_card_callback) = 0; |
| 68 | 73 |
| 69 // Causes the dialog for request autocomplete feature to be shown. | 74 // Causes the dialog for request autocomplete feature to be shown. |
| 70 virtual void ShowRequestAutocompleteDialog( | 75 virtual void ShowRequestAutocompleteDialog( |
| 71 const FormData& form, | 76 const FormData& form, |
| 72 const GURL& source_url, | 77 const GURL& source_url, |
| 73 const base::Callback<void(const FormStructure*)>& callback) = 0; | 78 const ResultCallback& callback) = 0; |
| 74 | 79 |
| 75 // Shows an Autofill popup with the given |values|, |labels|, |icons|, and | 80 // Shows an Autofill popup with the given |values|, |labels|, |icons|, and |
| 76 // |identifiers| for the element at |element_bounds|. |delegate| will be | 81 // |identifiers| for the element at |element_bounds|. |delegate| will be |
| 77 // notified of popup events. | 82 // notified of popup events. |
| 78 virtual void ShowAutofillPopup( | 83 virtual void ShowAutofillPopup( |
| 79 const gfx::RectF& element_bounds, | 84 const gfx::RectF& element_bounds, |
| 80 base::i18n::TextDirection text_direction, | 85 base::i18n::TextDirection text_direction, |
| 81 const std::vector<base::string16>& values, | 86 const std::vector<base::string16>& values, |
| 82 const std::vector<base::string16>& labels, | 87 const std::vector<base::string16>& labels, |
| 83 const std::vector<base::string16>& icons, | 88 const std::vector<base::string16>& icons, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 103 // Inform the delegate that the field has been filled. | 108 // Inform the delegate that the field has been filled. |
| 104 virtual void DidFillOrPreviewField( | 109 virtual void DidFillOrPreviewField( |
| 105 const base::string16& autofilled_value, | 110 const base::string16& autofilled_value, |
| 106 const base::string16& profile_full_name) = 0; | 111 const base::string16& profile_full_name) = 0; |
| 107 | 112 |
| 108 }; | 113 }; |
| 109 | 114 |
| 110 } // namespace autofill | 115 } // namespace autofill |
| 111 | 116 |
| 112 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_DELEGATE_H_ | 117 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_DELEGATE_H_ |
| OLD | NEW |