OLD | NEW |
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/ui/gtk/tabs/tab_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/tab_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" |
10 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
12 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/ui/gtk/accelerators_gtk.h" | 14 #include "chrome/browser/ui/gtk/accelerators_gtk.h" |
14 #include "chrome/browser/ui/gtk/gtk_input_event_box.h" | 15 #include "chrome/browser/ui/gtk/gtk_input_event_box.h" |
15 #include "chrome/browser/ui/gtk/menu_gtk.h" | 16 #include "chrome/browser/ui/gtk/menu_gtk.h" |
16 #include "chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h" | 17 #include "chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h" |
17 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 18 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
18 #include "chrome/browser/ui/tabs/tab_resources.h" | 19 #include "chrome/browser/ui/tabs/tab_resources.h" |
19 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 if (menu_controller_.get()) { | 95 if (menu_controller_.get()) { |
95 // The menu is showing. Close the menu. | 96 // The menu is showing. Close the menu. |
96 menu_controller_->Cancel(); | 97 menu_controller_->Cancel(); |
97 | 98 |
98 // Invoke this so that we hide the highlight. | 99 // Invoke this so that we hide the highlight. |
99 ContextMenuClosed(); | 100 ContextMenuClosed(); |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 void TabGtk::Raise() const { | 104 void TabGtk::Raise() const { |
| 105 UNSHIPPED_TRACE_EVENT0("ui::gtk", "TabGtk::Raise"); |
| 106 |
104 GdkWindow* window = gtk_input_event_box_get_window( | 107 GdkWindow* window = gtk_input_event_box_get_window( |
105 GTK_INPUT_EVENT_BOX(event_box_)); | 108 GTK_INPUT_EVENT_BOX(event_box_)); |
106 gdk_window_raise(window); | 109 gdk_window_raise(window); |
107 TabRendererGtk::Raise(); | 110 TabRendererGtk::Raise(); |
108 } | 111 } |
109 | 112 |
110 gboolean TabGtk::OnButtonPressEvent(GtkWidget* widget, GdkEventButton* event) { | 113 gboolean TabGtk::OnButtonPressEvent(GtkWidget* widget, GdkEventButton* event) { |
111 // Every button press ensures either a button-release-event or a drag-fail | 114 // Every button press ensures either a button-release-event or a drag-fail |
112 // signal for |widget|. | 115 // signal for |widget|. |
113 if (event->button == 1 && event->type == GDK_BUTTON_PRESS) { | 116 if (event->button == 1 && event->type == GDK_BUTTON_PRESS) { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 gdk_event_free(last_mouse_down_); | 348 gdk_event_free(last_mouse_down_); |
346 last_mouse_down_ = NULL; | 349 last_mouse_down_ = NULL; |
347 } | 350 } |
348 | 351 |
349 // Notify the drag helper that we're done with any potential drag operations. | 352 // Notify the drag helper that we're done with any potential drag operations. |
350 // Clean up the drag helper, which is re-created on the next mouse press. | 353 // Clean up the drag helper, which is re-created on the next mouse press. |
351 delegate_->EndDrag(canceled); | 354 delegate_->EndDrag(canceled); |
352 | 355 |
353 observer_.reset(); | 356 observer_.reset(); |
354 } | 357 } |
OLD | NEW |