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 "app/l10n_util_mac.h" | 5 #include "app/l10n_util_mac.h" |
6 #include "base/mac_util.h" | 6 #include "base/mac_util.h" |
7 #import "chrome/browser/browser_theme_provider.h" | 7 #import "chrome/browser/browser_theme_provider.h" |
8 #import "chrome/browser/cocoa/menu_controller.h" | 8 #import "chrome/browser/cocoa/menu_controller.h" |
9 #import "chrome/browser/cocoa/tab_controller.h" | 9 #import "chrome/browser/cocoa/tab_controller.h" |
10 #import "chrome/browser/cocoa/tab_controller_target.h" | 10 #import "chrome/browser/cocoa/tab_controller_target.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 [self internalSetSelected:selected_]; | 123 [self internalSetSelected:selected_]; |
124 } | 124 } |
125 | 125 |
126 // Called when Cocoa wants to display the context menu. Lazily instantiate | 126 // Called when Cocoa wants to display the context menu. Lazily instantiate |
127 // the menu based off of the cross-platform model. Re-create the menu and | 127 // the menu based off of the cross-platform model. Re-create the menu and |
128 // model every time to get the correct labels and enabling. | 128 // model every time to get the correct labels and enabling. |
129 - (NSMenu*)menu { | 129 - (NSMenu*)menu { |
130 contextMenuDelegate_.reset( | 130 contextMenuDelegate_.reset( |
131 new TabControllerInternal::MenuDelegate(target_, self)); | 131 new TabControllerInternal::MenuDelegate(target_, self)); |
132 contextMenuModel_.reset(new TabMenuModel(contextMenuDelegate_.get(), | 132 contextMenuModel_.reset(new TabMenuModel(contextMenuDelegate_.get(), |
133 [self pinned], | 133 [self pinned])); |
134 false, // allow_toolbar_toggle | |
135 true)); // is_toolbar_visible | |
136 | |
137 contextMenuController_.reset( | 134 contextMenuController_.reset( |
138 [[MenuController alloc] initWithModel:contextMenuModel_.get() | 135 [[MenuController alloc] initWithModel:contextMenuModel_.get() |
139 useWithPopUpButtonCell:NO]); | 136 useWithPopUpButtonCell:NO]); |
140 return [contextMenuController_ menu]; | 137 return [contextMenuController_ menu]; |
141 } | 138 } |
142 | 139 |
143 - (IBAction)closeTab:(id)sender { | 140 - (IBAction)closeTab:(id)sender { |
144 if ([[self target] respondsToSelector:@selector(closeTab:)]) { | 141 if ([[self target] respondsToSelector:@selector(closeTab:)]) { |
145 [[self target] performSelector:@selector(closeTab:) | 142 [[self target] performSelector:@selector(closeTab:) |
146 withObject:[self view]]; | 143 withObject:[self view]]; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 // Called by the tabs to determine whether we are in rapid (tab) closure mode. | 305 // Called by the tabs to determine whether we are in rapid (tab) closure mode. |
309 - (BOOL)inRapidClosureMode { | 306 - (BOOL)inRapidClosureMode { |
310 if ([[self target] respondsToSelector:@selector(inRapidClosureMode)]) { | 307 if ([[self target] respondsToSelector:@selector(inRapidClosureMode)]) { |
311 return [[self target] performSelector:@selector(inRapidClosureMode)] ? | 308 return [[self target] performSelector:@selector(inRapidClosureMode)] ? |
312 YES : NO; | 309 YES : NO; |
313 } | 310 } |
314 return NO; | 311 return NO; |
315 } | 312 } |
316 | 313 |
317 @end | 314 @end |
OLD | NEW |