| 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); |
| 65 GtkTargetEntry drag_target; | 66 GtkTargetEntry drag_target; |
| 66 drag_target.target = const_cast<char*>(kDragTarget); | 67 drag_target.target = const_cast<char*>(drag_target_string.c_str()); |
| 67 drag_target.flags = GTK_TARGET_SAME_APP; | 68 drag_target.flags = GTK_TARGET_SAME_APP; |
| 68 drag_target.info = 0; | 69 drag_target.info = 0; |
| 69 return drag_target; | 70 return drag_target; |
| 70 } | 71 } |
| 71 | 72 |
| 72 // The minimum width in pixels of the button hbox if |icon_count| icons are | 73 // The minimum width in pixels of the button hbox if |icon_count| icons are |
| 73 // showing. | 74 // showing. |
| 74 gint WidthForIconCount(gint icon_count) { | 75 gint WidthForIconCount(gint icon_count) { |
| 75 return std::max((kButtonWidth + kButtonPadding) * icon_count - kButtonPadding, | 76 return std::max((kButtonWidth + kButtonPadding) * icon_count - kButtonPadding, |
| 76 0); | 77 0); |
| (...skipping 877 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 |