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

Side by Side Diff: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc

Issue 6731036: Enabled pressing TAB to cycle through the Omnibox results. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 8 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) 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/gtk/omnibox/omnibox_view_gtk.h" 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 548
549 void OmniboxViewGtk::SetUserText(const string16& text) { 549 void OmniboxViewGtk::SetUserText(const string16& text) {
550 SetUserText(text, text, true); 550 SetUserText(text, text, true);
551 } 551 }
552 552
553 void OmniboxViewGtk::SetUserText(const string16& text, 553 void OmniboxViewGtk::SetUserText(const string16& text,
554 const string16& display_text, 554 const string16& display_text,
555 bool update_popup) { 555 bool update_popup) {
556 model_->SetUserText(text); 556 model_->SetUserText(text);
557 // TODO(deanm): something about selection / focus change here. 557 // TODO(deanm): something about selection / focus change here.
558 SetWindowTextAndCaretPos(display_text, display_text.length()); 558 SetWindowTextAndCaretPos(display_text, display_text.length(), update_popup,
559 if (update_popup) 559 true);
560 UpdatePopup();
561 TextChanged();
562 } 560 }
563 561
564 void OmniboxViewGtk::SetWindowTextAndCaretPos(const string16& text, 562 void OmniboxViewGtk::SetWindowTextAndCaretPos(const string16& text,
565 size_t caret_pos) { 563 size_t caret_pos,
564 bool update_popup,
565 bool notify_text_changed) {
566 CharRange range(static_cast<int>(caret_pos), static_cast<int>(caret_pos)); 566 CharRange range(static_cast<int>(caret_pos), static_cast<int>(caret_pos));
567 SetTextAndSelectedRange(text, range); 567 SetTextAndSelectedRange(text, range);
568
569 if (update_popup)
570 UpdatePopup();
571
572 if (notify_text_changed)
573 TextChanged();
568 } 574 }
569 575
570 void OmniboxViewGtk::SetForcedQuery() { 576 void OmniboxViewGtk::SetForcedQuery() {
571 const string16 current_text(GetText()); 577 const string16 current_text(GetText());
572 const size_t start = current_text.find_first_not_of(kWhitespaceUTF16); 578 const size_t start = current_text.find_first_not_of(kWhitespaceUTF16);
573 if (start == string16::npos || (current_text[start] != '?')) { 579 if (start == string16::npos || (current_text[start] != '?')) {
574 SetUserText(ASCIIToUTF16("?")); 580 SetUserText(ASCIIToUTF16("?"));
575 } else { 581 } else {
576 StartUpdatingHighlightedText(); 582 StartUpdatingHighlightedText();
577 SetSelectedRange(CharRange(current_text.size(), start + 1)); 583 SetSelectedRange(CharRange(current_text.size(), start + 1));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 model_->StopAutocomplete(); 638 model_->StopAutocomplete();
633 } 639 }
634 640
635 void OmniboxViewGtk::OnTemporaryTextMaybeChanged( 641 void OmniboxViewGtk::OnTemporaryTextMaybeChanged(
636 const string16& display_text, 642 const string16& display_text,
637 bool save_original_selection) { 643 bool save_original_selection) {
638 if (save_original_selection) 644 if (save_original_selection)
639 saved_temporary_selection_ = GetSelection(); 645 saved_temporary_selection_ = GetSelection();
640 646
641 StartUpdatingHighlightedText(); 647 StartUpdatingHighlightedText();
642 SetWindowTextAndCaretPos(display_text, display_text.length()); 648 SetWindowTextAndCaretPos(display_text, display_text.length(), false, false);
643 FinishUpdatingHighlightedText(); 649 FinishUpdatingHighlightedText();
644 TextChanged(); 650 TextChanged();
aaron.randolph 2012/01/14 04:25:34 It looks like this could probably be removed and t
Peter Kasting 2012/01/18 18:41:31 I looked at this with one of the GTK guys and neit
645 } 651 }
646 652
647 bool OmniboxViewGtk::OnInlineAutocompleteTextMaybeChanged( 653 bool OmniboxViewGtk::OnInlineAutocompleteTextMaybeChanged(
648 const string16& display_text, 654 const string16& display_text,
649 size_t user_text_length) { 655 size_t user_text_length) {
650 if (display_text == GetText()) 656 if (display_text == GetText())
651 return false; 657 return false;
652 658
653 StartUpdatingHighlightedText(); 659 StartUpdatingHighlightedText();
654 CharRange range(display_text.size(), user_text_length); 660 CharRange range(display_text.size(), user_text_length);
(...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 2398
2393 // Make all the children of the widget visible. NOTE: this won't display 2399 // Make all the children of the widget visible. NOTE: this won't display
2394 // anything, it just toggles the visible flag. 2400 // anything, it just toggles the visible flag.
2395 gtk_widget_show_all(omnibox_view->GetNativeView()); 2401 gtk_widget_show_all(omnibox_view->GetNativeView());
2396 // Hide the widget. NativeViewHostGtk will make it visible again as necessary. 2402 // Hide the widget. NativeViewHostGtk will make it visible again as necessary.
2397 gtk_widget_hide(omnibox_view->GetNativeView()); 2403 gtk_widget_hide(omnibox_view->GetNativeView());
2398 2404
2399 return omnibox_view; 2405 return omnibox_view;
2400 } 2406 }
2401 #endif 2407 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h ('k') | chrome/browser/ui/omnibox/omnibox_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698