| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "components/autofill/browser/autofill_popup_delegate.h" | 13 #include "components/autofill/browser/autofill_popup_delegate.h" |
| 14 #include "components/autofill/browser/password_autofill_manager.h" | 14 #include "components/autofill/browser/password_autofill_manager.h" |
| 15 #include "components/autofill/common/autofill_export.h" |
| 15 #include "components/autofill/common/form_data.h" | 16 #include "components/autofill/common/form_data.h" |
| 16 #include "components/autofill/common/form_field_data.h" | 17 #include "components/autofill/common/form_field_data.h" |
| 17 #include "components/autofill/common/password_form_fill_data.h" | 18 #include "components/autofill/common/password_form_fill_data.h" |
| 18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 21 |
| 22 #define EXPORT_WEB_CONTENT_USER_DATA |
| 20 #include "content/public/browser/web_contents_user_data.h" | 23 #include "content/public/browser/web_contents_user_data.h" |
| 24 #undef EXPORT_WEB_CONTENT_USER_DATA |
| 25 |
| 21 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
| 22 | 27 |
| 23 namespace gfx { | 28 namespace gfx { |
| 24 class Rect; | 29 class Rect; |
| 25 } | 30 } |
| 26 | 31 |
| 27 namespace content { | 32 namespace content { |
| 28 class WebContents; | 33 class WebContents; |
| 29 } | 34 } |
| 30 | 35 |
| 31 namespace autofill { | 36 namespace autofill { |
| 32 | 37 |
| 33 class AutofillManager; | 38 class AutofillManager; |
| 34 | 39 |
| 35 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. | 40 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. |
| 36 // Once Autofill is moved out of WebKit this class should be the only home for | 41 // Once Autofill is moved out of WebKit this class should be the only home for |
| 37 // this logic. See http://crbug.com/51644 | 42 // this logic. See http://crbug.com/51644 |
| 38 | 43 |
| 39 // Delegate for in-browser Autocomplete and Autofill display and selection. | 44 // Delegate for in-browser Autocomplete and Autofill display and selection. |
| 40 class AutofillExternalDelegate | 45 class AUTOFILL_EXPORT AutofillExternalDelegate |
| 41 : public content::WebContentsUserData<AutofillExternalDelegate>, | 46 : public content::WebContentsUserData<AutofillExternalDelegate>, |
| 42 public content::NotificationObserver, | 47 public content::NotificationObserver, |
| 43 public AutofillPopupDelegate { | 48 public AutofillPopupDelegate { |
| 44 public: | 49 public: |
| 45 // Creates an AutofillExternalDelegate and attaches it to the specified | 50 // Creates an AutofillExternalDelegate and attaches it to the specified |
| 46 // contents; the second argument is an AutofillManager managing Autofill for | 51 // contents; the second argument is an AutofillManager managing Autofill for |
| 47 // that WebContents. | 52 // that WebContents. |
| 48 static void CreateForWebContentsAndManager(content::WebContents* web_contents, | 53 static void CreateForWebContentsAndManager(content::WebContents* web_contents, |
| 49 AutofillManager* autofill_manager); | 54 AutofillManager* autofill_manager); |
| 50 | 55 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 107 |
| 103 // Inform the Password Manager of a filled form. | 108 // Inform the Password Manager of a filled form. |
| 104 void AddPasswordFormMapping( | 109 void AddPasswordFormMapping( |
| 105 const FormFieldData& form, | 110 const FormFieldData& form, |
| 106 const PasswordFormFillData& fill_data); | 111 const PasswordFormFillData& fill_data); |
| 107 | 112 |
| 108 protected: | 113 protected: |
| 109 friend class content::WebContentsUserData<AutofillExternalDelegate>; | 114 friend class content::WebContentsUserData<AutofillExternalDelegate>; |
| 110 AutofillExternalDelegate(content::WebContents* web_contents, | 115 AutofillExternalDelegate(content::WebContents* web_contents, |
| 111 AutofillManager* autofill_manager); | 116 AutofillManager* autofill_manager); |
| 117 |
| 118 // Never use this constructor. It's only for preventing compiling errors ( |
| 119 // WebContentsUserData requires a constructor with a single WebContents |
| 120 // parameter). |
| 121 explicit AutofillExternalDelegate(content::WebContents* web_contents); |
| 122 |
| 112 virtual ~AutofillExternalDelegate(); | 123 virtual ~AutofillExternalDelegate(); |
| 113 | 124 |
| 114 content::WebContents* web_contents() { return web_contents_; } | 125 content::WebContents* web_contents() { return web_contents_; } |
| 115 | 126 |
| 116 private: | 127 private: |
| 117 // Fills the form with the Autofill data corresponding to |unique_id|. | 128 // Fills the form with the Autofill data corresponding to |unique_id|. |
| 118 // If |is_preview| is true then this is just a preview to show the user what | 129 // If |is_preview| is true then this is just a preview to show the user what |
| 119 // would be selected and if |is_preview| is false then the user has selected | 130 // would be selected and if |is_preview| is false then the user has selected |
| 120 // this data. | 131 // this data. |
| 121 void FillAutofillFormData(int unique_id, bool is_preview); | 132 void FillAutofillFormData(int unique_id, bool is_preview); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 std::vector<base::string16> data_list_labels_; | 197 std::vector<base::string16> data_list_labels_; |
| 187 std::vector<base::string16> data_list_icons_; | 198 std::vector<base::string16> data_list_icons_; |
| 188 std::vector<int> data_list_unique_ids_; | 199 std::vector<int> data_list_unique_ids_; |
| 189 | 200 |
| 190 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 201 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
| 191 }; | 202 }; |
| 192 | 203 |
| 193 } // namespace autofill | 204 } // namespace autofill |
| 194 | 205 |
| 195 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 206 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| OLD | NEW |