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 <algorithm> | 7 #include <algorithm> |
| 8 #include <gtk/gtk.h> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
12 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/extensions/extension_browser_event_router.h" | 15 #include "chrome/browser/extensions/extension_browser_event_router.h" |
15 #include "chrome/browser/extensions/extension_context_menu_model.h" | 16 #include "chrome/browser/extensions/extension_context_menu_model.h" |
16 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/extensions/image_loading_tracker.h" | 18 #include "chrome/browser/extensions/image_loading_tracker.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 tracker_(this), | 96 tracker_(this), |
96 tab_specific_icon_(NULL), | 97 tab_specific_icon_(NULL), |
97 default_icon_(NULL) { | 98 default_icon_(NULL) { |
98 button_.reset(new CustomDrawButton( | 99 button_.reset(new CustomDrawButton( |
99 theme_provider, | 100 theme_provider, |
100 IDR_BROWSER_ACTION, | 101 IDR_BROWSER_ACTION, |
101 IDR_BROWSER_ACTION_P, | 102 IDR_BROWSER_ACTION_P, |
102 IDR_BROWSER_ACTION_H, | 103 IDR_BROWSER_ACTION_H, |
103 0, | 104 0, |
104 NULL)); | 105 NULL)); |
| 106 gtk_widget_set_size_request(button(), kButtonWidth, kButtonWidth); |
105 alignment_.Own(gtk_alignment_new(0, 0, 1, 1)); | 107 alignment_.Own(gtk_alignment_new(0, 0, 1, 1)); |
106 gtk_container_add(GTK_CONTAINER(alignment_.get()), button()); | 108 gtk_container_add(GTK_CONTAINER(alignment_.get()), button()); |
107 gtk_widget_show(button()); | 109 gtk_widget_show(button()); |
108 | 110 |
109 DCHECK(extension_->browser_action()); | 111 DCHECK(extension_->browser_action()); |
110 | 112 |
111 UpdateState(); | 113 UpdateState(); |
112 | 114 |
113 // The Browser Action API does not allow the default icon path to be | 115 // The Browser Action API does not allow the default icon path to be |
114 // changed at runtime, so we can load this now and cache it. | 116 // changed at runtime, so we can load this now and cache it. |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 | 978 |
977 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), | 979 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), |
978 event->time); | 980 event->time); |
979 return TRUE; | 981 return TRUE; |
980 } | 982 } |
981 | 983 |
982 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { | 984 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { |
983 if (!resize_animation_.is_animating()) | 985 if (!resize_animation_.is_animating()) |
984 UpdateChevronVisibility(); | 986 UpdateChevronVisibility(); |
985 } | 987 } |
OLD | NEW |