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

Side by Side Diff: base/message_pump_mac.h

Issue 8771028: [Mac] Remove content/ CrApplication. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // The basis for all native run loops on the Mac is the CFRunLoop. It can be 5 // The basis for all native run loops on the Mac is the CFRunLoop. It can be
6 // used directly, it can be used as the driving force behind the similar 6 // used directly, it can be used as the driving force behind the similar
7 // Foundation NSRunLoop, and it can be used to implement higher-level event 7 // Foundation NSRunLoop, and it can be used to implement higher-level event
8 // loops such as the NSApplication event loop. 8 // loops such as the NSApplication event loop.
9 // 9 //
10 // This file introduces a basic CFRunLoop-based implementation of the 10 // This file introduces a basic CFRunLoop-based implementation of the
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 DISALLOW_COPY_AND_ASSIGN(MessagePumpNSRunLoop); 225 DISALLOW_COPY_AND_ASSIGN(MessagePumpNSRunLoop);
226 }; 226 };
227 227
228 class MessagePumpNSApplication : public MessagePumpCFRunLoopBase { 228 class MessagePumpNSApplication : public MessagePumpCFRunLoopBase {
229 public: 229 public:
230 MessagePumpNSApplication(); 230 MessagePumpNSApplication();
231 231
232 virtual void DoRun(Delegate* delegate) OVERRIDE; 232 virtual void DoRun(Delegate* delegate) OVERRIDE;
233 virtual void Quit() OVERRIDE; 233 virtual void Quit() OVERRIDE;
234 234
235 protected:
236 // Returns nil if NSApp is currently in the middle of calling -sendEvent.
237 virtual NSAutoreleasePool* CreateAutoreleasePool() OVERRIDE;
238
239 private: 235 private:
240 // False after Quit is called. 236 // False after Quit is called.
241 bool keep_running_; 237 bool keep_running_;
242 238
243 // True if DoRun is managing its own run loop as opposed to letting 239 // True if DoRun is managing its own run loop as opposed to letting
244 // -[NSApplication run] handle it. The outermost run loop in the application 240 // -[NSApplication run] handle it. The outermost run loop in the application
245 // is managed by -[NSApplication run], inner run loops are handled by a loop 241 // is managed by -[NSApplication run], inner run loops are handled by a loop
246 // in DoRun. 242 // in DoRun.
247 bool running_own_loop_; 243 bool running_own_loop_;
248 244
249 DISALLOW_COPY_AND_ASSIGN(MessagePumpNSApplication); 245 DISALLOW_COPY_AND_ASSIGN(MessagePumpNSApplication);
250 }; 246 };
251 247
248 class MessagePumpCrApplication : public MessagePumpNSApplication {
249 public:
250 MessagePumpCrApplication();
251
252 protected:
253 // Returns nil if NSApp is currently in the middle of calling
254 // -sendEvent. Requires NSApp implementing CrAppProtocol.
255 virtual NSAutoreleasePool* CreateAutoreleasePool() OVERRIDE;
256
257 private:
258 DISALLOW_COPY_AND_ASSIGN(MessagePumpCrApplication);
259 };
260
252 class MessagePumpMac { 261 class MessagePumpMac {
253 public: 262 public:
254 // Returns a new instance of MessagePumpNSApplication if called on the main 263 // If not on the main thread, returns a new instance of
255 // thread. Otherwise, returns a new instance of MessagePumpNSRunLoop. 264 // MessagePumpNSRunLoop.
265 //
266 // On the main thread, if NSApp exists and conforms to
267 // CrAppProtocol, creates an instances of MessagePumpCrApplication.
Wez 2011/12/02 21:22:10 s/instances/instance
268 //
269 // Otherwise creates an instance of MessagePumpNSApplication
256 static MessagePump* Create(); 270 static MessagePump* Create();
257 271
272 // If a pump is created before the required CrAppProtocol is
273 // created, the wrong MessagePump subclass could be used.
274 // UsingCrApp() returns false if the message pump was created before
275 // NSApp was initialized, or if NSApp does not implement
276 // CrAppProtocol. NSApp must be initialized before calling.
277 static bool UsingCrApp();
278
279 // Wrapper to query -[NSApp isHandlingSendEvent] from C++ code.
280 // Requires NSApp to implement CrAppProtocol.
281 static bool IsHandlingSendEvent();
282
258 private: 283 private:
259 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac); 284 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac);
260 }; 285 };
261 286
262 } // namespace base 287 } // namespace base
263 288
264 #endif // BASE_MESSAGE_PUMP_MAC_H_ 289 #endif // BASE_MESSAGE_PUMP_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | base/message_pump_mac.mm » ('j') | chrome/browser/chrome_browser_application_mac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698