| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 tracker_(this), | 95 tracker_(this), |
| 95 tab_specific_icon_(NULL), | 96 tab_specific_icon_(NULL), |
| 96 default_icon_(NULL) { | 97 default_icon_(NULL) { |
| 97 button_.reset(new CustomDrawButton( | 98 button_.reset(new CustomDrawButton( |
| 98 theme_provider, | 99 theme_provider, |
| 99 IDR_BROWSER_ACTION, | 100 IDR_BROWSER_ACTION, |
| 100 IDR_BROWSER_ACTION_P, | 101 IDR_BROWSER_ACTION_P, |
| 101 IDR_BROWSER_ACTION_H, | 102 IDR_BROWSER_ACTION_H, |
| 102 0, | 103 0, |
| 103 NULL)); | 104 NULL)); |
| 105 gtk_widget_set_size_request(button(), kButtonWidth, kButtonWidth); |
| 104 alignment_.Own(gtk_alignment_new(0, 0, 1, 1)); | 106 alignment_.Own(gtk_alignment_new(0, 0, 1, 1)); |
| 105 gtk_container_add(GTK_CONTAINER(alignment_.get()), button()); | 107 gtk_container_add(GTK_CONTAINER(alignment_.get()), button()); |
| 106 gtk_widget_show(button()); | 108 gtk_widget_show(button()); |
| 107 | 109 |
| 108 DCHECK(extension_->browser_action()); | 110 DCHECK(extension_->browser_action()); |
| 109 | 111 |
| 110 UpdateState(); | 112 UpdateState(); |
| 111 | 113 |
| 112 // The Browser Action API does not allow the default icon path to be | 114 // The Browser Action API does not allow the default icon path to be |
| 113 // changed at runtime, so we can load this now and cache it. | 115 // changed at runtime, so we can load this now and cache it. |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 | 975 |
| 974 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), | 976 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), |
| 975 event->time); | 977 event->time); |
| 976 return TRUE; | 978 return TRUE; |
| 977 } | 979 } |
| 978 | 980 |
| 979 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { | 981 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { |
| 980 if (!resize_animation_.is_animating()) | 982 if (!resize_animation_.is_animating()) |
| 981 UpdateChevronVisibility(); | 983 UpdateChevronVisibility(); |
| 982 } | 984 } |
| OLD | NEW |