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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_popup_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 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/autocomplete/autocomplete_popup_view_gtk.h" 5 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 size_t line = std::max(y - kBorderThickness, 0) / kHeightPerResult; 469 size_t line = std::max(y - kBorderThickness, 0) / kHeightPerResult;
470 return std::min(line, model_->result().size() - 1); 470 return std::min(line, model_->result().size() - 1);
471 } 471 }
472 472
473 void AutocompletePopupViewGtk::AcceptLine(size_t line, 473 void AutocompletePopupViewGtk::AcceptLine(size_t line,
474 WindowOpenDisposition disposition) { 474 WindowOpenDisposition disposition) {
475 const AutocompleteMatch& match = model_->result().match_at(line); 475 const AutocompleteMatch& match = model_->result().match_at(line);
476 // OpenURL() may close the popup, which will clear the result set and, by 476 // OpenURL() may close the popup, which will clear the result set and, by
477 // extension, |match| and its contents. So copy the relevant strings out to 477 // extension, |match| and its contents. So copy the relevant strings out to
478 // make sure they stay alive until the call completes. 478 // make sure they stay alive until the call completes.
479 string16 keyword;
480 bool is_keyword_hint = false;
481
482 if (match.keyword.get()) {
483 keyword = match.keyword->text;
484 is_keyword_hint = match.keyword->is_keyword_hint;
485 }
479 const GURL url(match.destination_url); 486 const GURL url(match.destination_url);
480 string16 keyword;
481 const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword);
482 edit_view_->OpenURL(url, disposition, match.transition, GURL(), line, 487 edit_view_->OpenURL(url, disposition, match.transition, GURL(), line,
483 is_keyword_hint ? string16() : keyword); 488 is_keyword_hint ? string16() : keyword);
484 } 489 }
485 490
486 GdkPixbuf* AutocompletePopupViewGtk::IconForMatch( 491 GdkPixbuf* AutocompletePopupViewGtk::IconForMatch(
487 const AutocompleteMatch& match, bool selected) { 492 const AutocompleteMatch& match, bool selected) {
488 const SkBitmap* bitmap = model_->GetSpecialIconForMatch(match); 493 const SkBitmap* bitmap = model_->GetSpecialIconForMatch(match);
489 if (bitmap) { 494 if (bitmap) {
490 if (!ContainsKey(pixbufs_, bitmap)) 495 if (!ContainsKey(pixbufs_, bitmap))
491 pixbufs_[bitmap] = gfx::GdkPixbufFromSkBitmap(bitmap); 496 pixbufs_[bitmap] = gfx::GdkPixbufFromSkBitmap(bitmap);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 (text_width - actual_content_width - 674 (text_width - actual_content_width -
670 (actual_description_width / PANGO_SCALE)), 675 (actual_description_width / PANGO_SCALE)),
671 content_y, layout_); 676 content_y, layout_);
672 } 677 }
673 } 678 }
674 679
675 g_object_unref(gc); 680 g_object_unref(gc);
676 681
677 return TRUE; 682 return TRUE;
678 } 683 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698