| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/browser_actions_toolbar_gtk.h" | 5 #include "chrome/browser/gtk/browser_actions_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "app/gfx/canvas_paint.h" | 9 #include "app/gfx/canvas_paint.h" |
| 10 #include "app/gfx/gtk_util.h" | 10 #include "app/gfx/gtk_util.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 319 |
| 320 void BrowserActionsToolbarGtk::BrowserActionAdded(Extension* extension, | 320 void BrowserActionsToolbarGtk::BrowserActionAdded(Extension* extension, |
| 321 int index) { | 321 int index) { |
| 322 CreateButtonForExtension(extension, index); | 322 CreateButtonForExtension(extension, index); |
| 323 } | 323 } |
| 324 | 324 |
| 325 void BrowserActionsToolbarGtk::BrowserActionRemoved(Extension* extension) { | 325 void BrowserActionsToolbarGtk::BrowserActionRemoved(Extension* extension) { |
| 326 if (drag_button_ != NULL) { | 326 if (drag_button_ != NULL) { |
| 327 // Break the current drag. | 327 // Break the current drag. |
| 328 gtk_grab_remove(widget()); | 328 gtk_grab_remove(widget()); |
| 329 | |
| 330 // Re-generate the toolbar to clean up unfinished drag business (i.e., we | |
| 331 // may have re-ordered some buttons; this will put them back where they | |
| 332 // belong). | |
| 333 CreateAllButtons(); | |
| 334 } | 329 } |
| 335 | 330 |
| 336 RemoveButtonForExtension(extension); | 331 RemoveButtonForExtension(extension); |
| 337 } | 332 } |
| 338 | 333 |
| 339 void BrowserActionsToolbarGtk::BrowserActionMoved(Extension* extension, | 334 void BrowserActionsToolbarGtk::BrowserActionMoved(Extension* extension, |
| 340 int index) { | 335 int index) { |
| 341 // We initiated this move action, and have already moved the button. | 336 // We initiated this move action, and have already moved the button. |
| 342 if (drag_button_ != NULL) | 337 if (drag_button_ != NULL) |
| 343 return; | 338 return; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 } | 372 } |
| 378 | 373 |
| 379 void BrowserActionsToolbarGtk::OnDragEnd(GtkWidget* button, | 374 void BrowserActionsToolbarGtk::OnDragEnd(GtkWidget* button, |
| 380 GdkDragContext* drag_context) { | 375 GdkDragContext* drag_context) { |
| 381 if (drop_index_ != -1) | 376 if (drop_index_ != -1) |
| 382 model_->MoveBrowserAction(drag_button_->extension(), drop_index_); | 377 model_->MoveBrowserAction(drag_button_->extension(), drop_index_); |
| 383 | 378 |
| 384 drag_button_ = NULL; | 379 drag_button_ = NULL; |
| 385 drop_index_ = -1; | 380 drop_index_ = -1; |
| 386 } | 381 } |
| OLD | NEW |