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

Side by Side Diff: content/browser/renderer_host/popup_menu_helper_mac.mm

Issue 14335017: content: Use base::MessageLoop. (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 #import <Carbon/Carbon.h> 5 #import <Carbon/Carbon.h>
6 6
7 #include "content/browser/renderer_host/popup_menu_helper_mac.h" 7 #include "content/browser/renderer_host/popup_menu_helper_mac.h"
8 8
9 #import "base/mac/scoped_sending_event.h" 9 #import "base/mac/scoped_sending_event.h"
10 #include "base/memory/scoped_nsobject.h" 10 #include "base/memory/scoped_nsobject.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 ([rwhvm->cocoa_view() retain]); 46 ([rwhvm->cocoa_view() retain]);
47 47
48 // Display the menu. 48 // Display the menu.
49 scoped_nsobject<WebMenuRunner> menu_runner; 49 scoped_nsobject<WebMenuRunner> menu_runner;
50 menu_runner.reset([[WebMenuRunner alloc] initWithItems:items 50 menu_runner.reset([[WebMenuRunner alloc] initWithItems:items
51 fontSize:item_font_size 51 fontSize:item_font_size
52 rightAligned:right_aligned]); 52 rightAligned:right_aligned]);
53 53
54 { 54 {
55 // Make sure events can be pumped while the menu is up. 55 // Make sure events can be pumped while the menu is up.
56 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 56 base::MessageLoop::ScopedNestableTaskAllower allow(
57 base::MessageLoop::current());
57 58
58 // One of the events that could be pumped is |window.close()|. 59 // One of the events that could be pumped is |window.close()|.
59 // User-initiated event-tracking loops protect against this by 60 // User-initiated event-tracking loops protect against this by
60 // setting flags in -[CrApplication sendEvent:], but since 61 // setting flags in -[CrApplication sendEvent:], but since
61 // web-content menus are initiated by IPC message the setup has to 62 // web-content menus are initiated by IPC message the setup has to
62 // be done manually. 63 // be done manually.
63 base::mac::ScopedSendingEvent sending_event_scoper; 64 base::mac::ScopedSendingEvent sending_event_scoper;
64 65
65 // Now run a SYNCHRONOUS NESTED EVENT LOOP until the pop-up is finished. 66 // Now run a SYNCHRONOUS NESTED EVENT LOOP until the pop-up is finished.
66 [menu_runner runMenuInView:cocoa_view 67 [menu_runner runMenuInView:cocoa_view
(...skipping 21 matching lines...) Expand all
88 89
89 void PopupMenuHelper::Observe(int type, 90 void PopupMenuHelper::Observe(int type,
90 const NotificationSource& source, 91 const NotificationSource& source,
91 const NotificationDetails& details) { 92 const NotificationDetails& details) {
92 DCHECK(type == NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED); 93 DCHECK(type == NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED);
93 DCHECK(Source<RenderWidgetHost>(source).ptr() == render_view_host_); 94 DCHECK(Source<RenderWidgetHost>(source).ptr() == render_view_host_);
94 render_view_host_ = NULL; 95 render_view_host_ = NULL;
95 } 96 }
96 97
97 } // namespace content 98 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698