Chromium Code Reviews| Index: base/message_pump_mac.h |
| diff --git a/base/message_pump_mac.h b/base/message_pump_mac.h |
| index 501d8c68d592677aebba8274e875978aa2d0a430..304044197a2298efadc6abaeb257d992372a29dd 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,41 @@ 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. |
|
Wez
2011/12/02 21:22:10
s/instances/instance
|
| + // |
| + // Otherwise creates an instance of MessagePumpNSApplication |
| 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); |
| }; |