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 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 @synthesize target = target_; | 29 @synthesize target = target_; |
30 @synthesize url = url_; | 30 @synthesize url = url_; |
31 | 31 |
32 namespace TabControllerInternal { | 32 namespace TabControllerInternal { |
33 | 33 |
34 // A C++ delegate that handles enabling/disabling menu items and handling when | 34 // A C++ delegate that handles enabling/disabling menu items and handling when |
35 // a menu command is chosen. Also fixes up the menu item label for "pin/unpin | 35 // a menu command is chosen. Also fixes up the menu item label for "pin/unpin |
36 // tab". | 36 // tab". |
37 class MenuDelegate : public ui::SimpleMenuModel::Delegate { | 37 class MenuDelegate : public ui::SimpleMenuModel::Delegate { |
38 public: | 38 public: |
39 explicit MenuDelegate(id<TabControllerTarget> target, TabController* owner) | 39 MenuDelegate(id<TabControllerTarget> target, TabController* owner) |
40 : target_(target), | 40 : target_(target), |
41 owner_(owner) {} | 41 owner_(owner) {} |
42 | 42 |
43 // Overridden from ui::SimpleMenuModel::Delegate | 43 // Overridden from ui::SimpleMenuModel::Delegate |
44 virtual bool IsCommandIdChecked(int command_id) const { return false; } | 44 virtual bool IsCommandIdChecked(int command_id) const { return false; } |
45 virtual bool IsCommandIdEnabled(int command_id) const { | 45 virtual bool IsCommandIdEnabled(int command_id) const { |
46 TabStripModel::ContextMenuCommand command = | 46 TabStripModel::ContextMenuCommand command = |
47 static_cast<TabStripModel::ContextMenuCommand>(command_id); | 47 static_cast<TabStripModel::ContextMenuCommand>(command_id); |
48 return [target_ isCommandEnabled:command forController:owner_]; | 48 return [target_ isCommandEnabled:command forController:owner_]; |
49 } | 49 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 // TabStripDragController. | 383 // TabStripDragController. |
384 - (BOOL)tabCanBeDragged:(TabController*)controller { | 384 - (BOOL)tabCanBeDragged:(TabController*)controller { |
385 return [[target_ dragController] tabCanBeDragged:controller]; | 385 return [[target_ dragController] tabCanBeDragged:controller]; |
386 } | 386 } |
387 | 387 |
388 - (void)maybeStartDrag:(NSEvent*)event forTab:(TabController*)tab { | 388 - (void)maybeStartDrag:(NSEvent*)event forTab:(TabController*)tab { |
389 [[target_ dragController] maybeStartDrag:event forTab:tab]; | 389 [[target_ dragController] maybeStartDrag:event forTab:tab]; |
390 } | 390 } |
391 | 391 |
392 @end | 392 @end |
OLD | NEW |