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

Side by Side Diff: chrome/browser/autofill/autofill_external_delegate.cc

Issue 9432029: GTK Keyboard Support for New Autofill (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 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
OLDNEW
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 #include "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/autofill/autofill_external_delegate.h" 6 #include "chrome/browser/autofill/autofill_external_delegate.h"
7 #include "chrome/browser/autofill/autofill_manager.h" 7 #include "chrome/browser/autofill/autofill_manager.h"
8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
9 #include "chrome/common/autofill_messages.h" 9 #include "chrome/common/autofill_messages.h"
10 #include "chrome/common/chrome_constants.h" 10 #include "chrome/common/chrome_constants.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 tab_contents_wrapper_->autofill_manager()->OnDidShowAutofillSuggestions( 134 tab_contents_wrapper_->autofill_manager()->OnDidShowAutofillSuggestions(
135 has_autofill_item && !has_shown_autofill_popup_for_current_edit_); 135 has_autofill_item && !has_shown_autofill_popup_for_current_edit_);
136 has_shown_autofill_popup_for_current_edit_ |= has_autofill_item; 136 has_shown_autofill_popup_for_current_edit_ |= has_autofill_item;
137 } 137 }
138 138
139 void AutofillExternalDelegate::DidEndTextFieldEditing() { 139 void AutofillExternalDelegate::DidEndTextFieldEditing() {
140 has_shown_autofill_popup_for_current_edit_ = false; 140 has_shown_autofill_popup_for_current_edit_ = false;
141 } 141 }
142 142
143 void AutofillExternalDelegate::DidAcceptAutofillSuggestions( 143 bool AutofillExternalDelegate::DidAcceptAutofillSuggestions(
144 const string16& value, 144 const string16& value,
145 int unique_id, 145 int unique_id,
146 unsigned index) { 146 unsigned index) {
147 // If the selected element is a warning we don't want to do anything. 147 // If the selected element is a warning we don't want to do anything.
148 if (unique_id < 0) 148 if (unique_id < 0)
149 return; 149 return false;
150 150
151 // TODO(csharp): Add the password autofill manager. 151 // TODO(csharp): Add the password autofill manager.
152 // if (password_autofill_manager_->DidAcceptAutofillSuggestion(node, value)) 152 // if (password_autofill_manager_->DidAcceptAutofillSuggestion(node, value))
153 // return; 153 // return;
154 154
155 if (suggestions_options_index_ != -1 && 155 if (suggestions_options_index_ != -1 &&
156 index == static_cast<unsigned>(suggestions_options_index_)) { 156 index == static_cast<unsigned>(suggestions_options_index_)) {
157 // User selected 'Autofill Options'. 157 // User selected 'Autofill Options'.
158 autofill_manager_->OnShowAutofillDialog(); 158 autofill_manager_->OnShowAutofillDialog();
159 } else if (suggestions_clear_index_ != -1 && 159 } else if (suggestions_clear_index_ != -1 &&
160 index == static_cast<unsigned>(suggestions_clear_index_)) { 160 index == static_cast<unsigned>(suggestions_clear_index_)) {
161 // User selected 'Clear form'. 161 // User selected 'Clear form'.
162 RenderViewHost* host = 162 RenderViewHost* host =
163 tab_contents_wrapper_->web_contents()->GetRenderViewHost(); 163 tab_contents_wrapper_->web_contents()->GetRenderViewHost();
164 host->Send(new AutofillMsg_ClearForm(host->GetRoutingID())); 164 host->Send(new AutofillMsg_ClearForm(host->GetRoutingID()));
165 } else if (!unique_id) { 165 } else if (!unique_id) {
166 // User selected an Autocomplete entry, so we fill directly. 166 // User selected an Autocomplete entry, so we fill directly.
167 RenderViewHost* host = 167 RenderViewHost* host =
168 tab_contents_wrapper_->web_contents()->GetRenderViewHost(); 168 tab_contents_wrapper_->web_contents()->GetRenderViewHost();
169 host->Send(new AutofillMsg_SetNodeText( 169 host->Send(new AutofillMsg_SetNodeText(
170 host->GetRoutingID(), 170 host->GetRoutingID(),
171 value)); 171 value));
172 } else { 172 } else {
173 FillAutofillFormData(unique_id, false); 173 FillAutofillFormData(unique_id, false);
174 } 174 }
175 175
176 HideAutofillPopup(); 176 HideAutofillPopup();
177
178 return true;
177 } 179 }
178 180
179 void AutofillExternalDelegate::ClearPreviewedForm() { 181 void AutofillExternalDelegate::ClearPreviewedForm() {
180 RenderViewHost* host = 182 RenderViewHost* host =
181 tab_contents_wrapper_->web_contents()->GetRenderViewHost(); 183 tab_contents_wrapper_->web_contents()->GetRenderViewHost();
182 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID())); 184 host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID()));
183 } 185 }
184 186
185 void AutofillExternalDelegate::HideAutofillPopup() { 187 void AutofillExternalDelegate::HideAutofillPopup() {
186 suggestions_clear_index_ = -1; 188 suggestions_clear_index_ = -1;
(...skipping 27 matching lines...) Expand all
214 // none, so all platforms use the default. 216 // none, so all platforms use the default.
215 217
216 #if !defined(OS_ANDROID) && !defined(TOOLKIT_GTK) 218 #if !defined(OS_ANDROID) && !defined(TOOLKIT_GTK)
217 219
218 AutofillExternalDelegate* AutofillExternalDelegate::Create( 220 AutofillExternalDelegate* AutofillExternalDelegate::Create(
219 TabContentsWrapper*, AutofillManager*) { 221 TabContentsWrapper*, AutofillManager*) {
220 return NULL; 222 return NULL;
221 } 223 }
222 224
223 #endif 225 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698