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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // and chevron if they are both showing). | 52 // and chevron if they are both showing). |
53 const int kButtonChevronPadding = 2; | 53 const int kButtonChevronPadding = 2; |
54 | 54 |
55 // The padding to the left, top and bottom of the browser actions toolbar | 55 // The padding to the left, top and bottom of the browser actions toolbar |
56 // separator. | 56 // separator. |
57 const int kSeparatorPadding = 2; | 57 const int kSeparatorPadding = 2; |
58 | 58 |
59 // Width of the invisible gripper for resizing the toolbar. | 59 // Width of the invisible gripper for resizing the toolbar. |
60 const int kResizeGripperWidth = 4; | 60 const int kResizeGripperWidth = 4; |
61 | 61 |
62 const char* kDragTarget = "application/x-chrome-browseraction"; | 62 const char kDragTarget[] = "application/x-chrome-browseraction"; |
63 | 63 |
64 GtkTargetEntry GetDragTargetEntry() { | 64 GtkTargetEntry GetDragTargetEntry() { |
65 static std::string drag_target_string(kDragTarget); | |
66 GtkTargetEntry drag_target; | 65 GtkTargetEntry drag_target; |
67 drag_target.target = const_cast<char*>(drag_target_string.c_str()); | 66 drag_target.target = const_cast<char*>(kDragTarget); |
68 drag_target.flags = GTK_TARGET_SAME_APP; | 67 drag_target.flags = GTK_TARGET_SAME_APP; |
69 drag_target.info = 0; | 68 drag_target.info = 0; |
70 return drag_target; | 69 return drag_target; |
71 } | 70 } |
72 | 71 |
73 // The minimum width in pixels of the button hbox if |icon_count| icons are | 72 // The minimum width in pixels of the button hbox if |icon_count| icons are |
74 // showing. | 73 // showing. |
75 gint WidthForIconCount(gint icon_count) { | 74 gint WidthForIconCount(gint icon_count) { |
76 return std::max((kButtonWidth + kButtonPadding) * icon_count - kButtonPadding, | 75 return std::max((kButtonWidth + kButtonPadding) * icon_count - kButtonPadding, |
77 0); | 76 0); |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 | 954 |
956 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), | 955 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), |
957 event->time); | 956 event->time); |
958 return TRUE; | 957 return TRUE; |
959 } | 958 } |
960 | 959 |
961 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { | 960 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { |
962 if (!resize_animation_.is_animating()) | 961 if (!resize_animation_.is_animating()) |
963 UpdateChevronVisibility(); | 962 UpdateChevronVisibility(); |
964 } | 963 } |
OLD | NEW |