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

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

Issue 9359052: GTK: Closing in on being completely GSEALed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 (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 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 1289
1290 return TRUE; // Don't continue, we called the default handler already. 1290 return TRUE; // Don't continue, we called the default handler already.
1291 } 1291 }
1292 1292
1293 gboolean OmniboxViewGtk::HandleViewFocusIn(GtkWidget* sender, 1293 gboolean OmniboxViewGtk::HandleViewFocusIn(GtkWidget* sender,
1294 GdkEventFocus* event) { 1294 GdkEventFocus* event) {
1295 DCHECK(text_view_); 1295 DCHECK(text_view_);
1296 update_popup_without_focus_ = false; 1296 update_popup_without_focus_ = false;
1297 1297
1298 GdkModifierType modifiers; 1298 GdkModifierType modifiers;
1299 gdk_window_get_pointer(text_view_->window, NULL, NULL, &modifiers); 1299 GdkWindow* gdk_window = gtk_widget_get_window(text_view_);
1300 gdk_window_get_pointer(gdk_window, NULL, NULL, &modifiers);
1300 model_->OnSetFocus((modifiers & GDK_CONTROL_MASK) != 0); 1301 model_->OnSetFocus((modifiers & GDK_CONTROL_MASK) != 0);
1301 controller_->OnSetFocus(); 1302 controller_->OnSetFocus();
1302 // TODO(deanm): Some keyword hit business, etc here. 1303 // TODO(deanm): Some keyword hit business, etc here.
1303 1304
1304 g_signal_connect( 1305 g_signal_connect(
1305 gdk_keymap_get_for_display(gtk_widget_get_display(text_view_)), 1306 gdk_keymap_get_for_display(gtk_widget_get_display(text_view_)),
1306 "direction-changed", 1307 "direction-changed",
1307 G_CALLBACK(&HandleKeymapDirectionChangedThunk), this); 1308 G_CALLBACK(&HandleKeymapDirectionChangedThunk), this);
1308 1309
1309 AdjustTextJustification(); 1310 AdjustTextJustification();
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 guint target_type, 1545 guint target_type,
1545 guint time) { 1546 guint time) {
1546 DCHECK(text_view_); 1547 DCHECK(text_view_);
1547 1548
1548 // Reset |paste_clipboard_requested_| to make sure we won't misinterpret this 1549 // Reset |paste_clipboard_requested_| to make sure we won't misinterpret this
1549 // drop action as a paste action. 1550 // drop action as a paste action.
1550 paste_clipboard_requested_ = false; 1551 paste_clipboard_requested_ = false;
1551 1552
1552 // Don't try to PasteAndGo on drops originating from this omnibox. However, do 1553 // Don't try to PasteAndGo on drops originating from this omnibox. However, do
1553 // allow default behavior for such drags. 1554 // allow default behavior for such drags.
1554 if (context->source_window == text_view_->window) 1555 if (gdk_drag_context_get_source_window(context) ==
1556 gtk_widget_get_window(text_view_))
1555 return; 1557 return;
1556 1558
1557 guchar* text = gtk_selection_data_get_text(selection_data); 1559 guchar* text = gtk_selection_data_get_text(selection_data);
1558 if (!text) 1560 if (!text)
1559 return; 1561 return;
1560 1562
1561 string16 possible_url = UTF8ToUTF16(reinterpret_cast<char*>(text)); 1563 string16 possible_url = UTF8ToUTF16(reinterpret_cast<char*>(text));
1562 g_free(text); 1564 g_free(text);
1563 if (OnPerformDropImpl(possible_url)) { 1565 if (OnPerformDropImpl(possible_url)) {
1564 gtk_drag_finish(context, TRUE, FALSE, time); 1566 gtk_drag_finish(context, TRUE, FALSE, time);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 #if defined(TOOLKIT_VIEWS) 1810 #if defined(TOOLKIT_VIEWS)
1809 bool use_gtk = false; 1811 bool use_gtk = false;
1810 #else 1812 #else
1811 bool use_gtk = theme_service_->UsingNativeTheme(); 1813 bool use_gtk = theme_service_->UsingNativeTheme();
1812 #endif 1814 #endif
1813 1815
1814 if (use_gtk) { 1816 if (use_gtk) {
1815 // If we haven't initialized the text view yet, just create a temporary one 1817 // If we haven't initialized the text view yet, just create a temporary one
1816 // whose style we can grab. 1818 // whose style we can grab.
1817 GtkWidget* widget = text_view_ ? text_view_ : gtk_text_view_new(); 1819 GtkWidget* widget = text_view_ ? text_view_ : gtk_text_view_new();
1820 GtkStyle* gtk_style = gtk_widget_get_style(widget);
1818 GtkRcStyle* rc_style = gtk_widget_get_modifier_style(widget); 1821 GtkRcStyle* rc_style = gtk_widget_get_modifier_style(widget);
1819 gfx::Font font((rc_style && rc_style->font_desc) ? 1822 gfx::Font font((rc_style && rc_style->font_desc) ?
1820 rc_style->font_desc : 1823 rc_style->font_desc :
1821 widget->style->font_desc); 1824 gtk_style->font_desc);
1822 if (!text_view_) 1825 if (!text_view_)
1823 g_object_unref(g_object_ref_sink(widget)); 1826 g_object_unref(g_object_ref_sink(widget));
1824 1827
1825 // Scaling the font down for popup windows doesn't help here, since we just 1828 // Scaling the font down for popup windows doesn't help here, since we just
1826 // use the normal unforced font size when using the GTK theme. 1829 // use the normal unforced font size when using the GTK theme.
1827 return font; 1830 return font;
1828 } else { 1831 } else {
1829 return gfx::Font( 1832 return gfx::Font(
1830 ui::ResourceBundle::GetSharedInstance().GetFont( 1833 ui::ResourceBundle::GetSharedInstance().GetFont(
1831 ui::ResourceBundle::BaseFont).GetFontName(), 1834 ui::ResourceBundle::BaseFont).GetFontName(),
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 2395
2393 // Make all the children of the widget visible. NOTE: this won't display 2396 // Make all the children of the widget visible. NOTE: this won't display
2394 // anything, it just toggles the visible flag. 2397 // anything, it just toggles the visible flag.
2395 gtk_widget_show_all(omnibox_view->GetNativeView()); 2398 gtk_widget_show_all(omnibox_view->GetNativeView());
2396 // Hide the widget. NativeViewHostGtk will make it visible again as necessary. 2399 // Hide the widget. NativeViewHostGtk will make it visible again as necessary.
2397 gtk_widget_hide(omnibox_view->GetNativeView()); 2400 gtk_widget_hide(omnibox_view->GetNativeView());
2398 2401
2399 return omnibox_view; 2402 return omnibox_view;
2400 } 2403 }
2401 #endif 2404 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc ('k') | chrome/browser/ui/gtk/tab_contents_container_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698