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

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.mm

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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
OLDNEW
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 #include "chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.h" 5 #include "chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #import "base/mac/scoped_sending_event.h" 8 #import "base/mac/scoped_sending_event.h"
9 #include "base/memory/scoped_nsobject.h" 9 #include "base/memory/scoped_nsobject.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 modifierFlags:NSRightMouseDownMask 81 modifierFlags:NSRightMouseDownMask
82 timestamp:eventTime 82 timestamp:eventTime
83 windowNumber:[window windowNumber] 83 windowNumber:[window windowNumber]
84 context:nil 84 context:nil
85 eventNumber:0 85 eventNumber:0
86 clickCount:1 86 clickCount:1
87 pressure:1.0]; 87 pressure:1.0];
88 88
89 { 89 {
90 // Make sure events can be pumped while the menu is up. 90 // Make sure events can be pumped while the menu is up.
91 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 91 base::MessageLoop::ScopedNestableTaskAllower allow(
92 base::MessageLoop::current());
92 93
93 // One of the events that could be pumped is |window.close()|. 94 // One of the events that could be pumped is |window.close()|.
94 // User-initiated event-tracking loops protect against this by 95 // User-initiated event-tracking loops protect against this by
95 // setting flags in -[CrApplication sendEvent:], but since 96 // setting flags in -[CrApplication sendEvent:], but since
96 // web-content menus are initiated by IPC message the setup has to 97 // web-content menus are initiated by IPC message the setup has to
97 // be done manually. 98 // be done manually.
98 base::mac::ScopedSendingEvent sendingEventScoper; 99 base::mac::ScopedSendingEvent sendingEventScoper;
99 100
100 // Show the menu. 101 // Show the menu.
101 [NSMenu popUpContextMenu:[menu_controller_ menu] 102 [NSMenu popUpContextMenu:[menu_controller_ menu]
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 command_id); 279 command_id);
279 if (!item) 280 if (!item)
280 return; 281 return;
281 282
282 // Update the returned NSMenuItem directly so we can update it immediately. 283 // Update the returned NSMenuItem directly so we can update it immediately.
283 [item setEnabled:enabled]; 284 [item setEnabled:enabled];
284 [item setTitle:SysUTF16ToNSString(title)]; 285 [item setTitle:SysUTF16ToNSString(title)];
285 [item setHidden:hidden]; 286 [item setHidden:hidden];
286 [[item menu] itemChanged:item]; 287 [[item menu] itemChanged:item];
287 } 288 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698