| OLD | NEW |
| 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 #include "chrome/renderer/autofill_helper.h" | 5 #include "chrome/renderer/autofill_helper.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" | |
| 8 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 9 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/common/chrome_constants.h" | 9 #include "chrome/common/chrome_constants.h" |
| 11 #include "chrome/renderer/form_manager.h" | 10 #include "chrome/renderer/form_manager.h" |
| 12 #include "chrome/renderer/render_view.h" | 11 #include "chrome/renderer/render_view.h" |
| 13 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 14 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" |
| 15 #include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h" |
| 16 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 15 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 17 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" |
| 18 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 17 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 18 #include "ui/base/keycodes/keyboard_codes.h" |
| 19 #include "webkit/glue/form_data.h" | 19 #include "webkit/glue/form_data.h" |
| 20 #include "webkit/glue/form_field.h" | 20 #include "webkit/glue/form_field.h" |
| 21 #include "webkit/glue/password_form.h" | 21 #include "webkit/glue/password_form.h" |
| 22 | 22 |
| 23 using WebKit::WebFormControlElement; | 23 using WebKit::WebFormControlElement; |
| 24 using WebKit::WebFormElement; | 24 using WebKit::WebFormElement; |
| 25 using WebKit::WebFrame; | 25 using WebKit::WebFrame; |
| 26 using WebKit::WebInputElement; | 26 using WebKit::WebInputElement; |
| 27 using WebKit::WebKeyboardEvent; | 27 using WebKit::WebKeyboardEvent; |
| 28 using WebKit::WebNode; | 28 using WebKit::WebNode; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 void AutoFillHelper::FrameDetached(WebFrame* frame) { | 212 void AutoFillHelper::FrameDetached(WebFrame* frame) { |
| 213 form_manager_.ResetFrame(frame); | 213 form_manager_.ResetFrame(frame); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void AutoFillHelper::TextDidChangeInTextField(const WebInputElement& element) { | 216 void AutoFillHelper::TextDidChangeInTextField(const WebInputElement& element) { |
| 217 ShowSuggestions(element, false, true, false); | 217 ShowSuggestions(element, false, true, false); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void AutoFillHelper::KeyDownInTextField(const WebInputElement& element, | 220 void AutoFillHelper::KeyDownInTextField(const WebInputElement& element, |
| 221 const WebKeyboardEvent& event) { | 221 const WebKeyboardEvent& event) { |
| 222 if (event.windowsKeyCode == app::VKEY_DOWN || | 222 if (event.windowsKeyCode == ui::VKEY_DOWN || |
| 223 event.windowsKeyCode == app::VKEY_UP) | 223 event.windowsKeyCode == ui::VKEY_UP) |
| 224 ShowSuggestions(element, true, true, true); | 224 ShowSuggestions(element, true, true, true); |
| 225 } | 225 } |
| 226 | 226 |
| 227 bool AutoFillHelper::InputElementClicked(const WebInputElement& element, | 227 bool AutoFillHelper::InputElementClicked(const WebInputElement& element, |
| 228 bool was_focused, | 228 bool was_focused, |
| 229 bool is_focused) { | 229 bool is_focused) { |
| 230 if (was_focused) | 230 if (was_focused) |
| 231 ShowSuggestions(element, true, false, true); | 231 ShowSuggestions(element, true, false, true); |
| 232 return false; | 232 return false; |
| 233 } | 233 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 field); | 332 field); |
| 333 | 333 |
| 334 // WebFormControlElementToFormField does not scrape the DOM for the field | 334 // WebFormControlElementToFormField does not scrape the DOM for the field |
| 335 // label, so find the label here. | 335 // label, so find the label here. |
| 336 // TODO(jhawkins): Add form and field identities so we can use the cached form | 336 // TODO(jhawkins): Add form and field identities so we can use the cached form |
| 337 // data in FormManager. | 337 // data in FormManager. |
| 338 field->set_label(FormManager::LabelForElement(element)); | 338 field->set_label(FormManager::LabelForElement(element)); |
| 339 | 339 |
| 340 return true; | 340 return true; |
| 341 } | 341 } |
| OLD | NEW |