| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tabs/tab_gtk.h" | 5 #include "chrome/browser/gtk/tabs/tab_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include "app/gtk_dnd_util.h" | 9 #include "app/gtk_dnd_util.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 return font->GetStringWidth(title); | 32 return font->GetStringWidth(title); |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 class TabGtk::ContextMenuController : public menus::SimpleMenuModel::Delegate { | 37 class TabGtk::ContextMenuController : public menus::SimpleMenuModel::Delegate { |
| 38 public: | 38 public: |
| 39 explicit ContextMenuController(TabGtk* tab) | 39 explicit ContextMenuController(TabGtk* tab) |
| 40 : tab_(tab), | 40 : tab_(tab), |
| 41 model_(this, tab->delegate()->IsTabPinned(tab), false, true) { | 41 model_(this, tab->delegate()->IsTabPinned(tab)) { |
| 42 menu_.reset(new MenuGtk(NULL, &model_)); | 42 menu_.reset(new MenuGtk(NULL, &model_)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual ~ContextMenuController() {} | 45 virtual ~ContextMenuController() {} |
| 46 | 46 |
| 47 void RunMenu() { | 47 void RunMenu() { |
| 48 menu_->PopupAsContext(gtk_get_current_event_time()); | 48 menu_->PopupAsContext(gtk_get_current_event_time()); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void Cancel() { | 51 void Cancel() { |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 gdk_event_free(last_mouse_down_); | 402 gdk_event_free(last_mouse_down_); |
| 403 last_mouse_down_ = NULL; | 403 last_mouse_down_ = NULL; |
| 404 } | 404 } |
| 405 | 405 |
| 406 // Notify the drag helper that we're done with any potential drag operations. | 406 // Notify the drag helper that we're done with any potential drag operations. |
| 407 // Clean up the drag helper, which is re-created on the next mouse press. | 407 // Clean up the drag helper, which is re-created on the next mouse press. |
| 408 delegate_->EndDrag(canceled); | 408 delegate_->EndDrag(canceled); |
| 409 | 409 |
| 410 observer_.reset(); | 410 observer_.reset(); |
| 411 } | 411 } |
| OLD | NEW |