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

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

Issue 12299003: Merge AutocompleteTextfield views::Textfield subclass into OmniboxView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove VIEW_ID_AUTOCOMPLETE in favor of VIEW_ID_OMNIBOX. Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 g_signal_connect(text_buffer_, "insert-text", 400 g_signal_connect(text_buffer_, "insert-text",
401 G_CALLBACK(&HandleInsertTextThunk), this); 401 G_CALLBACK(&HandleInsertTextThunk), this);
402 402
403 AdjustVerticalAlignmentOfInstantView(); 403 AdjustVerticalAlignmentOfInstantView();
404 404
405 registrar_.Add(this, 405 registrar_.Add(this,
406 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 406 chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
407 content::Source<ThemeService>(theme_service_)); 407 content::Source<ThemeService>(theme_service_));
408 theme_service_->InitThemesFor(this); 408 theme_service_->InitThemesFor(this);
409 409
410 ViewIDUtil::SetID(GetNativeView(), VIEW_ID_AUTOCOMPLETE); 410 ViewIDUtil::SetID(GetNativeView(), VIEW_ID_OMNIBOX);
411 } 411 }
412 412
413 void OmniboxViewGtk::HandleHierarchyChanged(GtkWidget* sender, 413 void OmniboxViewGtk::HandleHierarchyChanged(GtkWidget* sender,
414 GtkWidget* old_toplevel) { 414 GtkWidget* old_toplevel) {
415 GtkWindow* new_toplevel = platform_util::GetTopLevel(sender); 415 GtkWindow* new_toplevel = platform_util::GetTopLevel(sender);
416 if (!new_toplevel) 416 if (!new_toplevel)
417 return; 417 return;
418 418
419 // Use |signals_| to make sure we don't get called back after destruction. 419 // Use |signals_| to make sure we don't get called back after destruction.
420 signals_.Connect(new_toplevel, "set-focus", 420 signals_.Connect(new_toplevel, "set-focus",
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2139 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { 2139 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() {
2140 // By default, GtkTextView layouts an anchored child widget just above the 2140 // By default, GtkTextView layouts an anchored child widget just above the
2141 // baseline, so we need to move the |instant_view_| down to make sure it 2141 // baseline, so we need to move the |instant_view_| down to make sure it
2142 // has the same baseline as the |text_view_|. 2142 // has the same baseline as the |text_view_|.
2143 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); 2143 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_));
2144 int height; 2144 int height;
2145 pango_layout_get_size(layout, NULL, &height); 2145 pango_layout_get_size(layout, NULL, &height);
2146 int baseline = pango_layout_get_baseline(layout); 2146 int baseline = pango_layout_get_baseline(layout);
2147 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); 2147 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL);
2148 } 2148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698