Move InputEventObserver to api::BrowserWindow

This commit is contained in:
Cheng Zhao 2018-02-22 17:07:08 +09:00
parent aa3eafcea1
commit c611eb061d
7 changed files with 32 additions and 59 deletions

View file

@ -1038,9 +1038,6 @@ NativeWindowMac::NativeWindowMac(
// Set maximizable state last to ensure zoom button does not get reset
// by calls to other APIs.
SetMaximizable(maximizable);
RegisterInputEventObserver(
web_contents->GetWebContents()->GetRenderViewHost());
}
NativeWindowMac::~NativeWindowMac() {
@ -1869,25 +1866,6 @@ void NativeWindowMac::UpdateDraggableRegions(
[window_ setMovableByWindowBackground:YES];
}
void NativeWindowMac::OnInputEvent(const blink::WebInputEvent& event) {
switch (event.GetType()) {
case blink::WebInputEvent::kGestureScrollBegin:
case blink::WebInputEvent::kGestureScrollUpdate:
case blink::WebInputEvent::kGestureScrollEnd:
this->NotifyWindowScrollTouchEdge();
break;
default:
break;
}
}
void NativeWindowMac::RenderViewHostChanged(
content::RenderViewHost* old_host,
content::RenderViewHost* new_host) {
UnregisterInputEventObserver(old_host);
RegisterInputEventObserver(new_host);
}
std::vector<gfx::Rect> NativeWindowMac::CalculateNonDraggableRegions(
const std::vector<DraggableRegion>& regions, int width, int height) {
std::vector<gfx::Rect> result;
@ -2016,18 +1994,6 @@ void NativeWindowMac::SetCollectionBehavior(bool on, NSUInteger flag) {
SetMaximizable(was_maximizable);
}
void NativeWindowMac::RegisterInputEventObserver(
content::RenderViewHost* host) {
if (host)
host->GetWidget()->AddInputEventObserver(this);
}
void NativeWindowMac::UnregisterInputEventObserver(
content::RenderViewHost* host) {
if (host)
host->GetWidget()->RemoveInputEventObserver(this);
}
// static
NativeWindow* NativeWindow::Create(
brightray::InspectableWebContents* inspectable_web_contents,