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 #import "chrome/browser/ui/cocoa/app_menu/app_menu_controller.h" | 5 #import "chrome/browser/ui/cocoa/app_menu/app_menu_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 - (RecentTabsSubMenuModel*)recentTabsMenuModel; | 72 - (RecentTabsSubMenuModel*)recentTabsMenuModel; |
73 - (int)maxWidthForMenuModel:(ui::MenuModel*)model | 73 - (int)maxWidthForMenuModel:(ui::MenuModel*)model |
74 modelIndex:(int)modelIndex; | 74 modelIndex:(int)modelIndex; |
75 @end | 75 @end |
76 | 76 |
77 namespace AppMenuControllerInternal { | 77 namespace AppMenuControllerInternal { |
78 | 78 |
79 // A C++ delegate that handles the accelerators in the app menu. | 79 // A C++ delegate that handles the accelerators in the app menu. |
80 class AcceleratorDelegate : public ui::AcceleratorProvider { | 80 class AcceleratorDelegate : public ui::AcceleratorProvider { |
81 public: | 81 public: |
82 bool GetAcceleratorForCommandId(int command_id, | 82 bool GetAcceleratorForCommandId( |
83 ui::Accelerator* out_accelerator) override { | 83 int command_id, |
| 84 ui::Accelerator* out_accelerator) const override { |
84 AcceleratorsCocoa* keymap = AcceleratorsCocoa::GetInstance(); | 85 AcceleratorsCocoa* keymap = AcceleratorsCocoa::GetInstance(); |
85 const ui::Accelerator* accelerator = | 86 const ui::Accelerator* accelerator = |
86 keymap->GetAcceleratorForCommand(command_id); | 87 keymap->GetAcceleratorForCommand(command_id); |
87 if (!accelerator) | 88 if (!accelerator) |
88 return false; | 89 return false; |
89 *out_accelerator = *accelerator; | 90 *out_accelerator = *accelerator; |
90 return true; | 91 return true; |
91 } | 92 } |
92 }; | 93 }; |
93 | 94 |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 // (and thus, after all our ability to adjust it normally). Throw in the | 631 // (and thus, after all our ability to adjust it normally). Throw in the |
631 // towel, and simply don't let the frame move from where it's supposed to be. | 632 // towel, and simply don't let the frame move from where it's supposed to be. |
632 // TODO(devlin): Yet another Cocoa hack. It'd be good to find a workaround, | 633 // TODO(devlin): Yet another Cocoa hack. It'd be good to find a workaround, |
633 // but unlikely unless we replace the Cocoa menu implementation. | 634 // but unlikely unless we replace the Cocoa menu implementation. |
634 NSView* containerSuperview = [overflowActionsContainerView_ superview]; | 635 NSView* containerSuperview = [overflowActionsContainerView_ superview]; |
635 if (NSMinX([containerSuperview frame]) != 0) | 636 if (NSMinX([containerSuperview frame]) != 0) |
636 [containerSuperview setFrameOrigin:NSZeroPoint]; | 637 [containerSuperview setFrameOrigin:NSZeroPoint]; |
637 } | 638 } |
638 | 639 |
639 @end // @implementation AppMenuButtonViewController | 640 @end // @implementation AppMenuButtonViewController |
OLD | NEW |