summaryrefslogtreecommitdiffstats
path: root/base/mac/scoped_sending_event.mm
blob: c3813d8ae66e0f0c99ac08c5415df2ffc6e30fa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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