summaryrefslogtreecommitdiffstats
path: root/base/mac/scoped_sending_event.mm
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 23:56:17 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 23:56:17 +0000
commitd47af217ea470077b039d9f4d49f529dd0eda6bd (patch)
treef55006b328a59a6f702a8921f0e74f8ef3d82be4 /base/mac/scoped_sending_event.mm
parent7f2c27ac648a224202f59da047e73e9821328f5d (diff)
downloadchromium_src-d47af217ea470077b039d9f4d49f529dd0eda6bd.zip
chromium_src-d47af217ea470077b039d9f4d49f529dd0eda6bd.tar.gz
chromium_src-d47af217ea470077b039d9f4d49f529dd0eda6bd.tar.bz2
[Mac] Move ScopedSendingEvent from content/common/mac to base/mac.
Also merge content/ MockCrControlApp into base/ MockCrApp. Also use MockCrApp in test_shell_tests, and slight tweak to autorelease pool in test_shell's initialization. BUG=102224 Review URL: http://codereview.chromium.org/8724004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112578 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac/scoped_sending_event.mm')
-rw-r--r--base/mac/scoped_sending_event.mm24
1 files changed, 24 insertions, 0 deletions
diff --git a/base/mac/scoped_sending_event.mm b/base/mac/scoped_sending_event.mm
new file mode 100644
index 0000000..c3813d8
--- /dev/null
+++ b/base/mac/scoped_sending_event.mm
@@ -0,0 +1,24 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "base/mac/scoped_sending_event.h"
+
+#include "base/logging.h"
+
+namespace base {
+namespace mac {
+
+ScopedSendingEvent::ScopedSendingEvent()
+ : app_(static_cast<NSObject<CrAppControlProtocol>*>(NSApp)) {
+ DCHECK([app_ conformsToProtocol:@protocol(CrAppControlProtocol)]);
+ handling_ = [app_ isHandlingSendEvent];
+ [app_ setHandlingSendEvent:YES];
+}
+
+ScopedSendingEvent::~ScopedSendingEvent() {
+ [app_ setHandlingSendEvent:handling_];
+}
+
+} // namespace mac
+} // namespace base