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/browser_actions_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
31 #include "chrome/common/extensions/extension.h" | 31 #include "chrome/common/extensions/extension.h" |
32 #include "chrome/common/extensions/extension_action.h" | 32 #include "chrome/common/extensions/extension_action.h" |
33 #include "chrome/common/extensions/extension_resource.h" | 33 #include "chrome/common/extensions/extension_resource.h" |
34 #include "content/browser/tab_contents/tab_contents.h" | 34 #include "content/browser/tab_contents/tab_contents.h" |
35 #include "content/public/browser/notification_details.h" | 35 #include "content/public/browser/notification_details.h" |
36 #include "content/public/browser/notification_source.h" | 36 #include "content/public/browser/notification_source.h" |
37 #include "grit/theme_resources.h" | 37 #include "grit/theme_resources.h" |
38 #include "grit/theme_resources_standard.h" | 38 #include "grit/theme_resources_standard.h" |
39 #include "grit/ui_resources.h" | 39 #include "grit/ui_resources.h" |
| 40 #include "ui/base/gtk/gtk_compat.h" |
40 #include "ui/gfx/canvas_skia_paint.h" | 41 #include "ui/gfx/canvas_skia_paint.h" |
41 #include "ui/gfx/gtk_util.h" | 42 #include "ui/gfx/gtk_util.h" |
42 | 43 |
43 namespace { | 44 namespace { |
44 | 45 |
45 // The width of the browser action buttons. | 46 // The width of the browser action buttons. |
46 const int kButtonWidth = 27; | 47 const int kButtonWidth = 27; |
47 | 48 |
48 // The padding between browser action buttons. | 49 // The padding between browser action buttons. |
49 const int kButtonPadding = 4; | 50 const int kButtonPadding = 4; |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 // We connect to this signal and return TRUE so that the default failure | 796 // We connect to this signal and return TRUE so that the default failure |
796 // animation (wherein the drag widget floats back to the start of the drag) | 797 // animation (wherein the drag widget floats back to the start of the drag) |
797 // does not show, and the drag-end signal is emitted immediately instead of | 798 // does not show, and the drag-end signal is emitted immediately instead of |
798 // several seconds later. | 799 // several seconds later. |
799 return TRUE; | 800 return TRUE; |
800 } | 801 } |
801 | 802 |
802 void BrowserActionsToolbarGtk::OnHierarchyChanged( | 803 void BrowserActionsToolbarGtk::OnHierarchyChanged( |
803 GtkWidget* widget, GtkWidget* previous_toplevel) { | 804 GtkWidget* widget, GtkWidget* previous_toplevel) { |
804 GtkWidget* toplevel = gtk_widget_get_toplevel(widget); | 805 GtkWidget* toplevel = gtk_widget_get_toplevel(widget); |
805 if (!GTK_WIDGET_TOPLEVEL(toplevel)) | 806 if (!gtk_widget_is_toplevel(toplevel)) |
806 return; | 807 return; |
807 | 808 |
808 signals_.Connect(toplevel, "set-focus", G_CALLBACK(OnSetFocusThunk), this); | 809 signals_.Connect(toplevel, "set-focus", G_CALLBACK(OnSetFocusThunk), this); |
809 } | 810 } |
810 | 811 |
811 void BrowserActionsToolbarGtk::OnSetFocus(GtkWidget* widget, | 812 void BrowserActionsToolbarGtk::OnSetFocus(GtkWidget* widget, |
812 GtkWidget* focus_widget) { | 813 GtkWidget* focus_widget) { |
813 ExtensionPopupGtk* popup = ExtensionPopupGtk::get_current_extension_popup(); | 814 ExtensionPopupGtk* popup = ExtensionPopupGtk::get_current_extension_popup(); |
814 // The focus of the parent window has changed. Close the popup. Delay the hide | 815 // The focus of the parent window has changed. Close the popup. Delay the hide |
815 // because it will destroy the RenderViewHost, which may still be on the | 816 // because it will destroy the RenderViewHost, which may still be on the |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 | 955 |
955 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), | 956 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), |
956 event->time); | 957 event->time); |
957 return TRUE; | 958 return TRUE; |
958 } | 959 } |
959 | 960 |
960 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { | 961 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { |
961 if (!resize_animation_.is_animating()) | 962 if (!resize_animation_.is_animating()) |
962 UpdateChevronVisibility(); | 963 UpdateChevronVisibility(); |
963 } | 964 } |
OLD | NEW |