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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 437 |
438 if (selected_line_ != kNoSelection && | 438 if (selected_line_ != kNoSelection && |
439 static_cast<size_t>(selected_line_) < identifiers_.size()) | 439 static_cast<size_t>(selected_line_) < identifiers_.size()) |
440 InvalidateRow(selected_line_); | 440 InvalidateRow(selected_line_); |
441 | 441 |
442 if (selected_line != kNoSelection) | 442 if (selected_line != kNoSelection) |
443 InvalidateRow(selected_line); | 443 InvalidateRow(selected_line); |
444 | 444 |
445 selected_line_ = selected_line; | 445 selected_line_ = selected_line; |
446 | 446 |
447 if (selected_line_ != kNoSelection) | 447 if (selected_line_ != kNoSelection) { |
448 delegate_->DidSelectSuggestion(identifiers_[selected_line_]); | 448 delegate_->DidSelectSuggestion(identifiers_[selected_line_], |
449 else | 449 names_[selected_line_]); |
| 450 } else { |
450 delegate_->ClearPreviewedForm(); | 451 delegate_->ClearPreviewedForm(); |
| 452 } |
451 } | 453 } |
452 | 454 |
453 void AutofillPopupControllerImpl::SelectNextLine() { | 455 void AutofillPopupControllerImpl::SelectNextLine() { |
454 int new_selected_line = selected_line_ + 1; | 456 int new_selected_line = selected_line_ + 1; |
455 | 457 |
456 // Skip over any lines that can't be selected. | 458 // Skip over any lines that can't be selected. |
457 while (static_cast<size_t>(new_selected_line) < names_.size() && | 459 while (static_cast<size_t>(new_selected_line) < names_.size() && |
458 !CanAccept(identifiers()[new_selected_line])) { | 460 !CanAccept(identifiers()[new_selected_line])) { |
459 ++new_selected_line; | 461 ++new_selected_line; |
460 } | 462 } |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 names_.clear(); | 655 names_.clear(); |
654 subtexts_.clear(); | 656 subtexts_.clear(); |
655 icons_.clear(); | 657 icons_.clear(); |
656 identifiers_.clear(); | 658 identifiers_.clear(); |
657 full_names_.clear(); | 659 full_names_.clear(); |
658 | 660 |
659 selected_line_ = kNoSelection; | 661 selected_line_ = kNoSelection; |
660 } | 662 } |
661 | 663 |
662 } // namespace autofill | 664 } // namespace autofill |
OLD | NEW |