Commit bb79f418 authored by erikchen's avatar erikchen Committed by Commit Bot

Add support for native event processor observer to headless mode.

The hooks are currently required by the jank calculator. They will eventually be
the mechanism that the browser task scheduler hooks into native events.

Bug: 859155
Change-Id: I4b633c7b350c673c7b59cdcfe3a115ae74e5bacb
Reviewed-on: https://chromium-review.googlesource.com/1238777Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593575}
parent 21472615
......@@ -5,6 +5,15 @@
#include "headless/lib/browser/headless_shell_application_mac.h"
#include "base/auto_reset.h"
#include "base/observer_list.h"
#include "content/public/browser/native_event_processor_mac.h"
#include "content/public/browser/native_event_processor_observer_mac.h"
@interface HeadlessShellCrApplication ()<NativeEventProcessor> {
base::ObserverList<content::NativeEventProcessorObserver>::Unchecked
observers_;
}
@end
@implementation HeadlessShellCrApplication
......@@ -17,4 +26,20 @@
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent {
}
- (void)sendEvent:(NSEvent*)event {
content::ScopedNotifyNativeEventProcessorObserver scopedObserverNotifier(
&observers_, event);
[super sendEvent:event];
}
- (void)addNativeEventProcessorObserver:
(content::NativeEventProcessorObserver*)observer {
observers_.AddObserver(observer);
}
- (void)removeNativeEventProcessorObserver:
(content::NativeEventProcessorObserver*)observer {
observers_.RemoveObserver(observer);
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment