| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 BrowserActionButton* button) { | 301 BrowserActionButton* button) { |
| 302 int tab_id = button->toolbar_->GetCurrentTabId(); | 302 int tab_id = button->toolbar_->GetCurrentTabId(); |
| 303 if (tab_id < 0) | 303 if (tab_id < 0) |
| 304 return FALSE; | 304 return FALSE; |
| 305 | 305 |
| 306 ExtensionAction* action = button->extension_->browser_action(); | 306 ExtensionAction* action = button->extension_->browser_action(); |
| 307 if (action->GetBadgeText(tab_id).empty()) | 307 if (action->GetBadgeText(tab_id).empty()) |
| 308 return FALSE; | 308 return FALSE; |
| 309 | 309 |
| 310 gfx::CanvasSkiaPaint canvas(event, false); | 310 gfx::CanvasSkiaPaint canvas(event, false); |
| 311 gfx::Rect bounding_rect(widget->allocation); | 311 GtkAllocation allocation; |
| 312 action->PaintBadge(&canvas, bounding_rect, tab_id); | 312 gtk_widget_get_allocation(widget, &allocation); |
| 313 action->PaintBadge(&canvas, gfx::Rect(allocation), tab_id); |
| 313 return FALSE; | 314 return FALSE; |
| 314 } | 315 } |
| 315 | 316 |
| 316 static void OnDragBegin(GtkWidget* widget, | 317 static void OnDragBegin(GtkWidget* widget, |
| 317 GdkDragContext* drag_context, | 318 GdkDragContext* drag_context, |
| 318 BrowserActionButton* button) { | 319 BrowserActionButton* button) { |
| 319 // Simply pass along the notification to the toolbar. The point of this | 320 // Simply pass along the notification to the toolbar. The point of this |
| 320 // function is to tell the toolbar which BrowserActionButton initiated the | 321 // function is to tell the toolbar which BrowserActionButton initiated the |
| 321 // drag. | 322 // drag. |
| 322 button->toolbar_->DragStarted(button, drag_context); | 323 button->toolbar_->DragStarted(button, drag_context); |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 | 973 |
| 973 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), | 974 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), |
| 974 event->time); | 975 event->time); |
| 975 return TRUE; | 976 return TRUE; |
| 976 } | 977 } |
| 977 | 978 |
| 978 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { | 979 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { |
| 979 if (!resize_animation_.is_animating()) | 980 if (!resize_animation_.is_animating()) |
| 980 UpdateChevronVisibility(); | 981 UpdateChevronVisibility(); |
| 981 } | 982 } |
| OLD | NEW |