OLD | NEW |
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/browser_actions_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
43 #include "grit/theme_resources_standard.h" | 43 #include "grit/theme_resources_standard.h" |
44 #include "grit/ui_resources.h" | 44 #include "grit/ui_resources.h" |
45 #include "ui/base/accelerators/accelerator_gtk.h" | 45 #include "ui/base/accelerators/accelerator_gtk.h" |
46 #include "ui/base/gtk/gtk_compat.h" | 46 #include "ui/base/gtk/gtk_compat.h" |
47 #include "ui/base/resource/resource_bundle.h" | 47 #include "ui/base/resource/resource_bundle.h" |
48 #include "ui/gfx/canvas_skia_paint.h" | 48 #include "ui/gfx/canvas_skia_paint.h" |
49 #include "ui/gfx/gtk_util.h" | 49 #include "ui/gfx/gtk_util.h" |
50 #include "ui/gfx/image/image.h" | 50 #include "ui/gfx/image/image.h" |
51 | 51 |
| 52 using extensions::Extension; |
| 53 |
52 namespace { | 54 namespace { |
53 | 55 |
54 // The width of the browser action buttons. | 56 // The width of the browser action buttons. |
55 const int kButtonWidth = 27; | 57 const int kButtonWidth = 27; |
56 | 58 |
57 // The padding between browser action buttons. | 59 // The padding between browser action buttons. |
58 const int kButtonPadding = 4; | 60 const int kButtonPadding = 4; |
59 | 61 |
60 // The padding to the right of the browser action buttons (between the buttons | 62 // The padding to the right of the browser action buttons (between the buttons |
61 // and chevron if they are both showing). | 63 // and chevron if they are both showing). |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 GDK_ACTION_MOVE); | 604 GDK_ACTION_MOVE); |
603 | 605 |
604 signals_.Connect(button_hbox_.get(), "drag-motion", | 606 signals_.Connect(button_hbox_.get(), "drag-motion", |
605 G_CALLBACK(OnDragMotionThunk), this); | 607 G_CALLBACK(OnDragMotionThunk), this); |
606 } | 608 } |
607 | 609 |
608 void BrowserActionsToolbarGtk::CreateAllButtons() { | 610 void BrowserActionsToolbarGtk::CreateAllButtons() { |
609 extension_button_map_.clear(); | 611 extension_button_map_.clear(); |
610 | 612 |
611 int i = 0; | 613 int i = 0; |
612 for (ExtensionList::iterator iter = model_->begin(); | 614 for (extensions::ExtensionList::iterator iter = model_->begin(); |
613 iter != model_->end(); ++iter) { | 615 iter != model_->end(); ++iter) { |
614 CreateButtonForExtension(*iter, i++); | 616 CreateButtonForExtension(*iter, i++); |
615 } | 617 } |
616 } | 618 } |
617 | 619 |
618 void BrowserActionsToolbarGtk::SetContainerWidth() { | 620 void BrowserActionsToolbarGtk::SetContainerWidth() { |
619 int showing_actions = model_->GetVisibleIconCount(); | 621 int showing_actions = model_->GetVisibleIconCount(); |
620 if (showing_actions >= 0) | 622 if (showing_actions >= 0) |
621 SetButtonHBoxWidth(WidthForIconCount(showing_actions)); | 623 SetButtonHBoxWidth(WidthForIconCount(showing_actions)); |
622 } | 624 } |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 | 1081 |
1080 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), | 1082 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), |
1081 event->time); | 1083 event->time); |
1082 return TRUE; | 1084 return TRUE; |
1083 } | 1085 } |
1084 | 1086 |
1085 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { | 1087 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { |
1086 if (!resize_animation_.is_animating()) | 1088 if (!resize_animation_.is_animating()) |
1087 UpdateChevronVisibility(); | 1089 UpdateChevronVisibility(); |
1088 } | 1090 } |
OLD | NEW |