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

Side by Side Diff: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc

Issue 148413002: Add "previewing on hover" support for single-field autocomplete input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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
OLDNEW
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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 if (selected_line_ != kNoSelection && 440 if (selected_line_ != kNoSelection &&
441 static_cast<size_t>(selected_line_) < identifiers_.size()) 441 static_cast<size_t>(selected_line_) < identifiers_.size())
442 InvalidateRow(selected_line_); 442 InvalidateRow(selected_line_);
443 443
444 if (selected_line != kNoSelection) 444 if (selected_line != kNoSelection)
445 InvalidateRow(selected_line); 445 InvalidateRow(selected_line);
446 446
447 selected_line_ = selected_line; 447 selected_line_ = selected_line;
448 448
449 if (selected_line_ != kNoSelection) 449 if (selected_line_ != kNoSelection) {
450 delegate_->DidSelectSuggestion(identifiers_[selected_line_]); 450 if ((identifiers_[selected_line_] ==
451 else 451 WebAutofillClient::MenuItemIDAutocompleteEntry) &&
452 (selected_line_ < static_cast<int>(names_.size())))
453 delegate_->DidSelectAutocompleteSuggestion(names_[selected_line_]);
454 else
455 delegate_->DidSelectSuggestion(identifiers_[selected_line_]);
456 } else {
452 delegate_->ClearPreviewedForm(); 457 delegate_->ClearPreviewedForm();
458 delegate_->ClearAutocompletePreviewedField();
459 }
453 } 460 }
454 461
455 void AutofillPopupControllerImpl::SelectNextLine() { 462 void AutofillPopupControllerImpl::SelectNextLine() {
456 int new_selected_line = selected_line_ + 1; 463 int new_selected_line = selected_line_ + 1;
457 464
458 // Skip over any lines that can't be selected. 465 // Skip over any lines that can't be selected.
459 while (static_cast<size_t>(new_selected_line) < names_.size() && 466 while (static_cast<size_t>(new_selected_line) < names_.size() &&
460 !CanAccept(identifiers()[new_selected_line])) { 467 !CanAccept(identifiers()[new_selected_line])) {
461 ++new_selected_line; 468 ++new_selected_line;
462 } 469 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 names_.erase(names_.begin() + selected_line_); 520 names_.erase(names_.begin() + selected_line_);
514 full_names_.erase(full_names_.begin() + selected_line_); 521 full_names_.erase(full_names_.begin() + selected_line_);
515 subtexts_.erase(subtexts_.begin() + selected_line_); 522 subtexts_.erase(subtexts_.begin() + selected_line_);
516 icons_.erase(icons_.begin() + selected_line_); 523 icons_.erase(icons_.begin() + selected_line_);
517 identifiers_.erase(identifiers_.begin() + selected_line_); 524 identifiers_.erase(identifiers_.begin() + selected_line_);
518 525
519 SetSelectedLine(kNoSelection); 526 SetSelectedLine(kNoSelection);
520 527
521 if (HasSuggestions()) { 528 if (HasSuggestions()) {
522 delegate_->ClearPreviewedForm(); 529 delegate_->ClearPreviewedForm();
530 delegate_->ClearAutocompletePreviewedField();
523 UpdateBoundsAndRedrawPopup(); 531 UpdateBoundsAndRedrawPopup();
524 } else { 532 } else {
525 Hide(); 533 Hide();
526 } 534 }
527 535
528 return true; 536 return true;
529 } 537 }
530 538
531 int AutofillPopupControllerImpl::LineFromY(int y) { 539 int AutofillPopupControllerImpl::LineFromY(int y) {
532 int current_height = kPopupBorderThickness; 540 int current_height = kPopupBorderThickness;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 names_.clear(); 663 names_.clear();
656 subtexts_.clear(); 664 subtexts_.clear();
657 icons_.clear(); 665 icons_.clear();
658 identifiers_.clear(); 666 identifiers_.clear();
659 full_names_.clear(); 667 full_names_.clear();
660 668
661 selected_line_ = kNoSelection; 669 selected_line_ = kNoSelection;
662 } 670 }
663 671
664 } // namespace autofill 672 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698