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), | 41 model_(this, tab->delegate()->IsTabPinned(tab), false, true) { |
42 tab->delegate()->IsAppTab(tab), | |
43 tab->delegate()->IsToolbarVisible(tab)) { | |
sky
2010/07/16 21:00:52
I'll clean up the tabmenumodel separately.
| |
44 menu_.reset(new MenuGtk(NULL, &model_)); | 42 menu_.reset(new MenuGtk(NULL, &model_)); |
45 } | 43 } |
46 | 44 |
47 virtual ~ContextMenuController() {} | 45 virtual ~ContextMenuController() {} |
48 | 46 |
49 void RunMenu() { | 47 void RunMenu() { |
50 menu_->PopupAsContext(gtk_get_current_event_time()); | 48 menu_->PopupAsContext(gtk_get_current_event_time()); |
51 } | 49 } |
52 | 50 |
53 void Cancel() { | 51 void Cancel() { |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
404 gdk_event_free(last_mouse_down_); | 402 gdk_event_free(last_mouse_down_); |
405 last_mouse_down_ = NULL; | 403 last_mouse_down_ = NULL; |
406 } | 404 } |
407 | 405 |
408 // 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. |
409 // 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. |
410 delegate_->EndDrag(canceled); | 408 delegate_->EndDrag(canceled); |
411 | 409 |
412 observer_.reset(); | 410 observer_.reset(); |
413 } | 411 } |
OLD | NEW |