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

Side by Side Diff: chrome/renderer/password_autocomplete_manager.cc

Issue 6246001: Move app/key* to ui/base/keycodes/* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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
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 #include "chrome/renderer/password_autocomplete_manager.h" 5 #include "chrome/renderer/password_autocomplete_manager.h"
6 6
7 #include "app/keyboard_codes.h"
8 #include "base/message_loop.h" 7 #include "base/message_loop.h"
9 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
10 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
11 #include "chrome/renderer/render_view.h" 10 #include "chrome/renderer/render_view.h"
12 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" 11 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h"
13 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" 12 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h"
14 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h" 13 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h"
15 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 14 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
16 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" 15 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
17 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" 16 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h"
18 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" 17 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
19 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" 18 #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
19 #include "ui/base/keycodes/keyboard_codes.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 #include "webkit/glue/password_form_dom_manager.h" 22 #include "webkit/glue/password_form_dom_manager.h"
23 23
24 namespace { 24 namespace {
25 25
26 // The size above which we stop triggering autocomplete. 26 // The size above which we stop triggering autocomplete.
27 static const size_t kMaximumTextSizeForAutocomplete = 1000; 27 static const size_t kMaximumTextSizeForAutocomplete = 1000;
28 28
29 // Maps element names to the actual elements to simplify form filling. 29 // Maps element names to the actual elements to simplify form filling.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 void PasswordAutocompleteManager::TextFieldHandlingKeyDown( 296 void PasswordAutocompleteManager::TextFieldHandlingKeyDown(
297 const WebKit::WebInputElement& element, 297 const WebKit::WebInputElement& element,
298 const WebKit::WebKeyboardEvent& event) { 298 const WebKit::WebKeyboardEvent& event) {
299 299
300 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(element); 300 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(element);
301 if (iter == login_to_password_info_.end()) 301 if (iter == login_to_password_info_.end())
302 return; 302 return;
303 303
304 int win_key_code = event.windowsKeyCode; 304 int win_key_code = event.windowsKeyCode;
305 iter->second.backspace_pressed_last = 305 iter->second.backspace_pressed_last =
306 (win_key_code == app::VKEY_BACK || win_key_code == app::VKEY_DELETE); 306 (win_key_code == ui::VKEY_BACK || win_key_code == ui::VKEY_DELETE);
307 } 307 }
308 308
309 bool PasswordAutocompleteManager::FillPassword( 309 bool PasswordAutocompleteManager::FillPassword(
310 const WebKit::WebInputElement& user_input) { 310 const WebKit::WebInputElement& user_input) {
311 LoginToPasswordInfoMap::iterator iter = 311 LoginToPasswordInfoMap::iterator iter =
312 login_to_password_info_.find(user_input); 312 login_to_password_info_.find(user_input);
313 if (iter == login_to_password_info_.end()) 313 if (iter == login_to_password_info_.end())
314 return false; 314 return false;
315 const webkit_glue::PasswordFormFillData& fill_data = 315 const webkit_glue::PasswordFormFillData& fill_data =
316 iter->second.fill_data; 316 iter->second.fill_data;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 SetElementAutofilled(username_element, true); 470 SetElementAutofilled(username_element, true);
471 if (IsElementEditable(*password_element)) 471 if (IsElementEditable(*password_element))
472 password_element->setValue(password); 472 password_element->setValue(password);
473 SetElementAutofilled(password_element, true); 473 SetElementAutofilled(password_element, true);
474 return true; 474 return true;
475 } 475 }
476 476
477 int PasswordAutocompleteManager::GetRoutingID() const { 477 int PasswordAutocompleteManager::GetRoutingID() const {
478 return render_view_->routing_id(); 478 return render_view_->routing_id();
479 } 479 }
OLDNEW
« no previous file with comments | « chrome/renderer/autofill_helper.cc ('k') | chrome/renderer/password_autocomplete_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698