Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Side by Side Diff: chrome/renderer/autofill/autofill_agent.h

Issue 6390006: Create autofill subdirectory in chrome/renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Using order Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/renderer/autofill/autofill_agent.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_RENDERER_AUTOFILL_HELPER_H_ 5 #ifndef CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_
6 #define CHROME_RENDERER_AUTOFILL_HELPER_H_ 6 #define CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/task.h" 13 #include "base/task.h"
14 #include "chrome/renderer/form_manager.h" 14 #include "chrome/renderer/autofill/form_manager.h"
15 #include "chrome/renderer/page_click_listener.h" 15 #include "chrome/renderer/page_click_listener.h"
16 #include "chrome/renderer/render_view_observer.h" 16 #include "chrome/renderer/render_view_observer.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutoFillClient.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutoFillClient.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
19 19
20 class PasswordAutocompleteManager; 20 namespace autofill {
21 21
22 // AutoFillHelper deals with AutoFill related communications between WebKit and 22 class PasswordAutoFillManager;
23 // the browser. There is one AutofillHelper per RenderView. 23
24 // AutoFillAgent deals with AutoFill related communications between WebKit and
25 // the browser. There is one AutoFillAgent per RenderView.
24 // This code was originally part of RenderView. 26 // This code was originally part of RenderView.
25 // Note that AutoFill encompasses: 27 // Note that AutoFill encompasses:
26 // - single text field suggestions, that we usually refer to as Autocomplete 28 // - single text field suggestions, that we usually refer to as Autocomplete,
29 // - password form fill, refered to as password AutoFill, and
27 // - entire form fill based on one field entry, referred to as form AutoFill. 30 // - entire form fill based on one field entry, referred to as form AutoFill.
28 31
29 class AutoFillHelper : public RenderViewObserver, 32 class AutoFillAgent : public RenderViewObserver,
30 public PageClickListener, 33 public PageClickListener,
31 public WebKit::WebAutoFillClient { 34 public WebKit::WebAutoFillClient {
32 public: 35 public:
33 // PasswordAutocompleteManager is guaranteed to outlive AutoFillHelper. 36 // PasswordAutoFillManager is guaranteed to outlive AutoFillAgent.
34 AutoFillHelper(RenderView* render_view, 37 AutoFillAgent(RenderView* render_view,
35 PasswordAutocompleteManager* password_autocomplete_manager); 38 PasswordAutoFillManager* password_autofill_manager);
36 virtual ~AutoFillHelper(); 39 virtual ~AutoFillAgent();
37 40
38 // WebKit::WebAutoFillClient implementation. Public for tests. 41 // WebKit::WebAutoFillClient implementation. Public for tests.
39 virtual void didAcceptAutoFillSuggestion(const WebKit::WebNode& node, 42 virtual void didAcceptAutoFillSuggestion(const WebKit::WebNode& node,
40 const WebKit::WebString& value, 43 const WebKit::WebString& value,
41 const WebKit::WebString& label, 44 const WebKit::WebString& label,
42 int unique_id, 45 int unique_id,
43 unsigned index); 46 unsigned index);
44 virtual void didSelectAutoFillSuggestion(const WebKit::WebNode& node, 47 virtual void didSelectAutoFillSuggestion(const WebKit::WebNode& node,
45 const WebKit::WebString& value, 48 const WebKit::WebString& value,
46 const WebKit::WebString& label, 49 const WebKit::WebString& label,
(...skipping 30 matching lines...) Expand all
77 const std::vector<string16>& values, 80 const std::vector<string16>& values,
78 const std::vector<string16>& labels, 81 const std::vector<string16>& labels,
79 const std::vector<string16>& icons, 82 const std::vector<string16>& icons,
80 const std::vector<int>& unique_ids); 83 const std::vector<int>& unique_ids);
81 void OnFormDataFilled(int query_id, const webkit_glue::FormData& form); 84 void OnFormDataFilled(int query_id, const webkit_glue::FormData& form);
82 85
83 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug 86 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug
84 // http://bugs.webkit.org/show_bug.cgi?id=16976 87 // http://bugs.webkit.org/show_bug.cgi?id=16976
85 void TextFieldDidChangeImpl(const WebKit::WebInputElement& element); 88 void TextFieldDidChangeImpl(const WebKit::WebInputElement& element);
86 89
87 // Shows the autocomplete suggestions for |element|. 90 // Shows the autofill suggestions for |element|.
88 // This call is asynchronous and may or may not lead to the showing of a 91 // This call is asynchronous and may or may not lead to the showing of a
89 // suggestion popup (no popup is shown if there are no available suggestions). 92 // suggestion popup (no popup is shown if there are no available suggestions).
90 // |autofill_on_empty_values| specifies whether suggestions should be shown 93 // |autofill_on_empty_values| specifies whether suggestions should be shown
91 // when |element| contains no text. 94 // when |element| contains no text.
92 // |requires_caret_at_end| specifies whether suggestions should be shown when 95 // |requires_caret_at_end| specifies whether suggestions should be shown when
93 // the caret is not after the last character in |element|. 96 // the caret is not after the last character in |element|.
94 // |display_warning_if_disabled| specifies whether a warning should be 97 // |display_warning_if_disabled| specifies whether a warning should be
95 // displayed to the user if AutoFill has suggestions available, but cannot 98 // displayed to the user if AutoFill has suggestions available, but cannot
96 // fill them because it is disabled (e.g. when trying to fill a credit card 99 // fill them because it is disabled (e.g. when trying to fill a credit card
97 // form on a non-secure website). 100 // form on a non-secure website).
(...skipping 20 matching lines...) Expand all
118 121
119 // Fills |form| and |field| with the FormData and FormField corresponding to 122 // Fills |form| and |field| with the FormData and FormField corresponding to
120 // |node|. Returns true if the data was found; and false otherwise. 123 // |node|. Returns true if the data was found; and false otherwise.
121 bool FindFormAndFieldForNode( 124 bool FindFormAndFieldForNode(
122 const WebKit::WebNode& node, 125 const WebKit::WebNode& node,
123 webkit_glue::FormData* form, 126 webkit_glue::FormData* form,
124 webkit_glue::FormField* field) WARN_UNUSED_RESULT; 127 webkit_glue::FormField* field) WARN_UNUSED_RESULT;
125 128
126 FormManager form_manager_; 129 FormManager form_manager_;
127 130
128 PasswordAutocompleteManager* password_autocomplete_manager_; 131 PasswordAutoFillManager* password_autofill_manager_;
129 132
130 // The ID of the last request sent for form field AutoFill. Used to ignore 133 // The ID of the last request sent for form field AutoFill. Used to ignore
131 // out of date responses. 134 // out of date responses.
132 int autofill_query_id_; 135 int autofill_query_id_;
133 136
134 // The node corresponding to the last request sent for form field AutoFill. 137 // The node corresponding to the last request sent for form field AutoFill.
135 WebKit::WebNode autofill_query_node_; 138 WebKit::WebNode autofill_query_node_;
136 139
137 // The action to take when receiving AutoFill data from the AutoFillManager. 140 // The action to take when receiving AutoFill data from the AutoFillManager.
138 AutoFillAction autofill_action_; 141 AutoFillAction autofill_action_;
139 142
140 // Should we display a warning if autofill is disabled? 143 // Should we display a warning if autofill is disabled?
141 bool display_warning_if_disabled_; 144 bool display_warning_if_disabled_;
142 145
143 // Was the query node autofilled prior to previewing the form? 146 // Was the query node autofilled prior to previewing the form?
144 bool was_query_node_autofilled_; 147 bool was_query_node_autofilled_;
145 148
146 // The menu index of the "Clear" menu item. 149 // The menu index of the "Clear" menu item.
147 int suggestions_clear_index_; 150 int suggestions_clear_index_;
148 151
149 // The menu index of the "AutoFill options..." menu item. 152 // The menu index of the "AutoFill options..." menu item.
150 int suggestions_options_index_; 153 int suggestions_options_index_;
151 154
152 ScopedRunnableMethodFactory<AutoFillHelper> method_factory_; 155 ScopedRunnableMethodFactory<AutoFillAgent> method_factory_;
153 156
154 DISALLOW_COPY_AND_ASSIGN(AutoFillHelper); 157 DISALLOW_COPY_AND_ASSIGN(AutoFillAgent);
155 }; 158 };
156 159
157 #endif // CHROME_RENDERER_AUTOFILL_HELPER_H_ 160 } // namespace autofill
161
162 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/renderer/autofill/autofill_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698