diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 23:32:43 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 23:32:43 +0000 |
commit | d7de57877613a63e36facbd485245918c1131f61 (patch) | |
tree | 164f1422c744e42edd84bb92fe347024ab71ec3c /base/message_pump_mac.h | |
parent | 5179b9146ce7029e1daedf8607d2bfae50764e7b (diff) | |
download | chromium_src-d7de57877613a63e36facbd485245918c1131f61.zip chromium_src-d7de57877613a63e36facbd485245918c1131f61.tar.gz chromium_src-d7de57877613a63e36facbd485245918c1131f61.tar.bz2 |
[Mac] Remove content/ CrApplication.
Pull the CrAppProtocol autorelease-pool handling down into
MessagePumpCrApplication, which is selected at Create() if NSApp
implements the right protocol. UsingCrApp() allows clients to
confirm the correct setup (unfortunately, synchronizing NSApp
initialization and MessagePump::Create() would be intrusive).
Also push CrAppProtocol and CrAppControlProtocol implementation into
BrowserCrApplication, and reparent that class from NSApplication.
Reparent ServiceCrApplication on NSApplication and rename.
Remove CrApplication registration from gpu, plugin, and renderer
mains.
Remove MockCrApp dependency from remoting sample code.
BUG=102224
Review URL: http://codereview.chromium.org/8771028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113281 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_pump_mac.h')
-rw-r--r-- | base/message_pump_mac.h | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/base/message_pump_mac.h b/base/message_pump_mac.h index 501d8c6..1f7ea10 100644 --- a/base/message_pump_mac.h +++ b/base/message_pump_mac.h @@ -232,10 +232,6 @@ class MessagePumpNSApplication : public MessagePumpCFRunLoopBase { virtual void DoRun(Delegate* delegate) OVERRIDE; virtual void Quit() OVERRIDE; - protected: - // Returns nil if NSApp is currently in the middle of calling -sendEvent. - virtual NSAutoreleasePool* CreateAutoreleasePool() OVERRIDE; - private: // False after Quit is called. bool keep_running_; @@ -249,12 +245,42 @@ class MessagePumpNSApplication : public MessagePumpCFRunLoopBase { DISALLOW_COPY_AND_ASSIGN(MessagePumpNSApplication); }; +class MessagePumpCrApplication : public MessagePumpNSApplication { + public: + MessagePumpCrApplication(); + + protected: + // Returns nil if NSApp is currently in the middle of calling + // -sendEvent. Requires NSApp implementing CrAppProtocol. + virtual NSAutoreleasePool* CreateAutoreleasePool() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(MessagePumpCrApplication); +}; + class MessagePumpMac { public: - // Returns a new instance of MessagePumpNSApplication if called on the main - // thread. Otherwise, returns a new instance of MessagePumpNSRunLoop. + // If not on the main thread, returns a new instance of + // MessagePumpNSRunLoop. + // + // On the main thread, if NSApp exists and conforms to + // CrAppProtocol, creates an instances of MessagePumpCrApplication. + // + // Otherwise creates an instance of MessagePumpNSApplication using a + // default NSApplication. static MessagePump* Create(); + // If a pump is created before the required CrAppProtocol is + // created, the wrong MessagePump subclass could be used. + // UsingCrApp() returns false if the message pump was created before + // NSApp was initialized, or if NSApp does not implement + // CrAppProtocol. NSApp must be initialized before calling. + static bool UsingCrApp(); + + // Wrapper to query -[NSApp isHandlingSendEvent] from C++ code. + // Requires NSApp to implement CrAppProtocol. + static bool IsHandlingSendEvent(); + private: DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePumpMac); }; |