• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2011 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#import "base/mac/scoped_sending_event.h"
6
7#include "base/check.h"
8
9namespace base::mac {
10
11ScopedSendingEvent::ScopedSendingEvent()
12    : app_(static_cast<NSObject<CrAppControlProtocol>*>(NSApp)) {
13  DCHECK([app_ conformsToProtocol:@protocol(CrAppControlProtocol)]);
14  handling_ = [app_ isHandlingSendEvent];
15  [app_ setHandlingSendEvent:YES];
16}
17
18ScopedSendingEvent::~ScopedSendingEvent() {
19  [app_ setHandlingSendEvent:handling_];
20}
21
22}  // namespace base::mac
23