Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: chrome/browser/ui/cocoa/menu_controller.mm

Issue 6142013: Allow printing/saving a plugin through right click menu, even if it's in a fr... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/menu_controller.h ('k') | chrome/browser/ui/gtk/menu_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import "chrome/browser/ui/cocoa/menu_controller.h" 5 #import "chrome/browser/ui/cocoa/menu_controller.h"
6 6
7 #include "app/l10n_util_mac.h" 7 #include "app/l10n_util_mac.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "skia/ext/skia_utils_mac.h" 10 #include "skia/ext/skia_utils_mac.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 static_cast<ui::MenuModel*>( 168 static_cast<ui::MenuModel*>(
169 [[sender representedObject] pointerValue]); 169 [[sender representedObject] pointerValue]);
170 DCHECK(model); 170 DCHECK(model);
171 if (model) 171 if (model)
172 model->ActivatedAt(modelIndex); 172 model->ActivatedAt(modelIndex);
173 } 173 }
174 174
175 - (NSMenu*)menu { 175 - (NSMenu*)menu {
176 if (!menu_ && model_) { 176 if (!menu_ && model_) {
177 menu_.reset([[self menuFromModel:model_] retain]); 177 menu_.reset([[self menuFromModel:model_] retain]);
178 [menu_ setDelegate:self];
178 // If this is to be used with a NSPopUpButtonCell, add an item at the 0th 179 // If this is to be used with a NSPopUpButtonCell, add an item at the 0th
179 // position that's empty. Doing it after the menu has been constructed won't 180 // position that's empty. Doing it after the menu has been constructed won't
180 // complicate creation logic, and since the tags are model indexes, they 181 // complicate creation logic, and since the tags are model indexes, they
181 // are unaffected by the extra item. 182 // are unaffected by the extra item.
182 if (useWithPopUpButtonCell_) { 183 if (useWithPopUpButtonCell_) {
183 scoped_nsobject<NSMenuItem> blankItem( 184 scoped_nsobject<NSMenuItem> blankItem(
184 [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]); 185 [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]);
185 [menu_ insertItem:blankItem atIndex:0]; 186 [menu_ insertItem:blankItem atIndex:0];
186 } 187 }
187 } 188 }
188 return menu_.get(); 189 return menu_.get();
189 } 190 }
190 191
192 - (void)menuDidClose:(NSMenu*)menu {
193 model_->MenuClosed();
194 }
195
191 @end 196 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/menu_controller.h ('k') | chrome/browser/ui/gtk/menu_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698