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

Side by Side Diff: base/mac/scoped_sending_event.h

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « base/mac/scoped_objc_class_swizzler_unittest.mm ('k') | base/mac/scoped_sending_event.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_MAC_SCOPED_SENDING_EVENT_H_
6 #define BASE_MAC_SCOPED_SENDING_EVENT_H_
7
8 #include "base/base_export.h"
9 #include "base/basictypes.h"
10 #include "base/message_loop/message_pump_mac.h"
11
12 // Nested event loops can pump IPC messages, including
13 // script-initiated tab closes, which could release objects that the
14 // nested event loop might message. CrAppProtocol defines how to ask
15 // the embedding NSApplication subclass if an event is currently being
16 // handled, in which case such closes are deferred to the top-level
17 // event loop.
18 //
19 // ScopedSendingEvent allows script-initiated event loops to work like
20 // a nested event loop, as such events do not arrive via -sendEvent:.
21 // CrAppControlProtocol lets ScopedSendingEvent tell the embedding
22 // NSApplication what to return from -handlingSendEvent.
23
24 @protocol CrAppControlProtocol<CrAppProtocol>
25 - (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
26 @end
27
28 namespace base {
29 namespace mac {
30
31 class BASE_EXPORT ScopedSendingEvent {
32 public:
33 ScopedSendingEvent();
34 ~ScopedSendingEvent();
35
36 private:
37 // The NSApp in control at the time the constructor was run, to be
38 // sure the |handling_| setting is restored appropriately.
39 NSObject<CrAppControlProtocol>* app_;
40 BOOL handling_; // Value of -[app_ handlingSendEvent] at construction.
41
42 DISALLOW_COPY_AND_ASSIGN(ScopedSendingEvent);
43 };
44
45 } // namespace mac
46 } // namespace base
47
48 #endif // BASE_MAC_SCOPED_SENDING_EVENT_H_
OLDNEW
« no previous file with comments | « base/mac/scoped_objc_class_swizzler_unittest.mm ('k') | base/mac/scoped_sending_event.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698