| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This file provides the implementaiton of the password manager's autocomplete | 5 // This file provides the implementaiton of the password manager's autocomplete |
| 6 // component. | 6 // component. |
| 7 | 7 |
| 8 #include "webkit/glue/webpasswordautocompletelistener_impl.h" | 8 #include "webkit/glue/webpasswordautocompletelistener_impl.h" |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 void WebInputElementDelegate::SetSelectionRange(size_t start, size_t end) { | 52 void WebInputElementDelegate::SetSelectionRange(size_t start, size_t end) { |
| 53 element_.setSelectionRange(start, end); | 53 element_.setSelectionRange(start, end); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void WebInputElementDelegate::RefreshAutofillPopup( | 56 void WebInputElementDelegate::RefreshAutofillPopup( |
| 57 const std::vector<string16>& suggestions) { | 57 const std::vector<string16>& suggestions) { |
| 58 WebView* webview = element_.document().frame()->view(); | 58 WebView* webview = element_.document().frame()->view(); |
| 59 if (webview) { | 59 if (webview) { |
| 60 std::vector<string16> names; | 60 std::vector<string16> names; |
| 61 std::vector<string16> labels; | 61 std::vector<string16> labels; |
| 62 std::vector<string16> icons; |
| 62 std::vector<int> unique_ids; | 63 std::vector<int> unique_ids; |
| 63 | 64 |
| 64 for (size_t i = 0; i < suggestions.size(); ++i) { | 65 for (size_t i = 0; i < suggestions.size(); ++i) { |
| 65 names.push_back(suggestions[i]); | 66 names.push_back(suggestions[i]); |
| 66 labels.push_back(string16()); | 67 labels.push_back(string16()); |
| 68 icons.push_back(string16()); |
| 67 unique_ids.push_back(0); | 69 unique_ids.push_back(0); |
| 68 } | 70 } |
| 69 | 71 |
| 70 webview->applyAutoFillSuggestions(element_, names, labels, unique_ids, -1); | 72 webview->applyAutoFillSuggestions( |
| 73 element_, names, labels, icons, unique_ids, -1); |
| 71 } | 74 } |
| 72 } | 75 } |
| 73 | 76 |
| 74 WebPasswordAutocompleteListenerImpl::WebPasswordAutocompleteListenerImpl( | 77 WebPasswordAutocompleteListenerImpl::WebPasswordAutocompleteListenerImpl( |
| 75 WebInputElementDelegate* username_delegate, | 78 WebInputElementDelegate* username_delegate, |
| 76 WebInputElementDelegate* password_delegate, | 79 WebInputElementDelegate* password_delegate, |
| 77 const PasswordFormFillData& data) | 80 const PasswordFormFillData& data) |
| 78 : password_delegate_(password_delegate), | 81 : password_delegate_(password_delegate), |
| 79 username_delegate_(username_delegate), | 82 username_delegate_(username_delegate), |
| 80 data_(data) { | 83 data_(data) { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 for (PasswordFormFillData::LoginCollection::iterator it = | 191 for (PasswordFormFillData::LoginCollection::iterator it = |
| 189 data_.additional_logins.begin(); | 192 data_.additional_logins.begin(); |
| 190 it != data_.additional_logins.end(); | 193 it != data_.additional_logins.end(); |
| 191 ++it) { | 194 ++it) { |
| 192 if (StartsWith(it->first, input, false)) | 195 if (StartsWith(it->first, input, false)) |
| 193 suggestions->push_back(it->first); | 196 suggestions->push_back(it->first); |
| 194 } | 197 } |
| 195 } | 198 } |
| 196 | 199 |
| 197 } // namespace webkit_glue | 200 } // namespace webkit_glue |
| OLD | NEW |