OLD | NEW |
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 "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 431 |
432 if (selected_line_ != kNoSelection && | 432 if (selected_line_ != kNoSelection && |
433 static_cast<size_t>(selected_line_) < identifiers_.size()) | 433 static_cast<size_t>(selected_line_) < identifiers_.size()) |
434 InvalidateRow(selected_line_); | 434 InvalidateRow(selected_line_); |
435 | 435 |
436 if (selected_line != kNoSelection) | 436 if (selected_line != kNoSelection) |
437 InvalidateRow(selected_line); | 437 InvalidateRow(selected_line); |
438 | 438 |
439 selected_line_ = selected_line; | 439 selected_line_ = selected_line; |
440 | 440 |
441 if (selected_line_ != kNoSelection) | 441 if (selected_line_ != kNoSelection) { |
442 delegate_->DidSelectSuggestion(identifiers_[selected_line_]); | 442 delegate_->DidSelectSuggestion(names_[selected_line_], |
443 else | 443 identifiers_[selected_line_]); |
| 444 } else { |
444 delegate_->ClearPreviewedForm(); | 445 delegate_->ClearPreviewedForm(); |
| 446 } |
445 } | 447 } |
446 | 448 |
447 void AutofillPopupControllerImpl::SelectNextLine() { | 449 void AutofillPopupControllerImpl::SelectNextLine() { |
448 int new_selected_line = selected_line_ + 1; | 450 int new_selected_line = selected_line_ + 1; |
449 | 451 |
450 // Skip over any lines that can't be selected. | 452 // Skip over any lines that can't be selected. |
451 while (static_cast<size_t>(new_selected_line) < names_.size() && | 453 while (static_cast<size_t>(new_selected_line) < names_.size() && |
452 !CanAccept(identifiers()[new_selected_line])) { | 454 !CanAccept(identifiers()[new_selected_line])) { |
453 ++new_selected_line; | 455 ++new_selected_line; |
454 } | 456 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 names_.clear(); | 647 names_.clear(); |
646 subtexts_.clear(); | 648 subtexts_.clear(); |
647 icons_.clear(); | 649 icons_.clear(); |
648 identifiers_.clear(); | 650 identifiers_.clear(); |
649 full_names_.clear(); | 651 full_names_.clear(); |
650 | 652 |
651 selected_line_ = kNoSelection; | 653 selected_line_ = kNoSelection; |
652 } | 654 } |
653 | 655 |
654 } // namespace autofill | 656 } // namespace autofill |
OLD | NEW |