| OLD | NEW |
| 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 "base/message_loop/message_pump_mac.h" | 5 #import "base/message_loop/message_pump_mac.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // Process work when NSMenus are fading out. | 40 // Process work when NSMenus are fading out. |
| 41 CFSTR("com.apple.hitoolbox.windows.windowfadingmode"), | 41 CFSTR("com.apple.hitoolbox.windows.windowfadingmode"), |
| 42 | 42 |
| 43 // Process work when AppKit is highlighting an item on the main menubar. | 43 // Process work when AppKit is highlighting an item on the main menubar. |
| 44 CFSTR("NSUnhighlightMenuRunLoopMode"), | 44 CFSTR("NSUnhighlightMenuRunLoopMode"), |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // Mask that determines which modes in |kAllModes| to use. | 47 // Mask that determines which modes in |kAllModes| to use. |
| 48 enum { kCommonModeMask = 0x1, kAllModesMask = ~0 }; | 48 enum { kCommonModeMask = 0x1, kAllModesMask = ~0 }; |
| 49 | 49 |
| 50 // Modes to use for MessagePumpNSApplication. Currently just common and |
| 51 // exclusive modes. TODO(tapted): Use kAllModesMask once http://crbug.com/640466 |
| 52 // blockers are fixed. |
| 53 enum { kNSApplicationModeMask = 0x3 }; |
| 54 |
| 50 void NoOp(void* info) { | 55 void NoOp(void* info) { |
| 51 } | 56 } |
| 52 | 57 |
| 53 const CFTimeInterval kCFTimeIntervalMax = | 58 const CFTimeInterval kCFTimeIntervalMax = |
| 54 std::numeric_limits<CFTimeInterval>::max(); | 59 std::numeric_limits<CFTimeInterval>::max(); |
| 55 | 60 |
| 56 #if !defined(OS_IOS) | 61 #if !defined(OS_IOS) |
| 57 // Set to true if MessagePumpMac::Create() is called before NSApp is | 62 // Set to true if MessagePumpMac::Create() is called before NSApp is |
| 58 // initialized. Only accessed from the main thread. | 63 // initialized. Only accessed from the main thread. |
| 59 bool g_not_using_cr_app = false; | 64 bool g_not_using_cr_app = false; |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 void MessagePumpUIApplication::Attach(Delegate* delegate) { | 720 void MessagePumpUIApplication::Attach(Delegate* delegate) { |
| 716 DCHECK(!run_loop_); | 721 DCHECK(!run_loop_); |
| 717 run_loop_ = new RunLoop(); | 722 run_loop_ = new RunLoop(); |
| 718 CHECK(run_loop_->BeforeRun()); | 723 CHECK(run_loop_->BeforeRun()); |
| 719 SetDelegate(delegate); | 724 SetDelegate(delegate); |
| 720 } | 725 } |
| 721 | 726 |
| 722 #else | 727 #else |
| 723 | 728 |
| 724 MessagePumpNSApplication::MessagePumpNSApplication() | 729 MessagePumpNSApplication::MessagePumpNSApplication() |
| 725 : MessagePumpCFRunLoopBase(kAllModesMask), | 730 : MessagePumpCFRunLoopBase(kNSApplicationModeMask), |
| 726 keep_running_(true), | 731 keep_running_(true), |
| 727 running_own_loop_(false) {} | 732 running_own_loop_(false) {} |
| 728 | 733 |
| 729 MessagePumpNSApplication::~MessagePumpNSApplication() {} | 734 MessagePumpNSApplication::~MessagePumpNSApplication() {} |
| 730 | 735 |
| 731 void MessagePumpNSApplication::DoRun(Delegate* delegate) { | 736 void MessagePumpNSApplication::DoRun(Delegate* delegate) { |
| 732 bool last_running_own_loop_ = running_own_loop_; | 737 bool last_running_own_loop_ = running_own_loop_; |
| 733 | 738 |
| 734 // NSApp must be initialized by calling: | 739 // NSApp must be initialized by calling: |
| 735 // [{some class which implements CrAppProtocol} sharedApplication] | 740 // [{some class which implements CrAppProtocol} sharedApplication] |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 [NSApplication sharedApplication]; | 868 [NSApplication sharedApplication]; |
| 864 g_not_using_cr_app = true; | 869 g_not_using_cr_app = true; |
| 865 return new MessagePumpNSApplication; | 870 return new MessagePumpNSApplication; |
| 866 #endif | 871 #endif |
| 867 } | 872 } |
| 868 | 873 |
| 869 return new MessagePumpNSRunLoop; | 874 return new MessagePumpNSRunLoop; |
| 870 } | 875 } |
| 871 | 876 |
| 872 } // namespace base | 877 } // namespace base |
| OLD | NEW |