summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/display/multi_display_manager.cc20
-rw-r--r--chrome/browser/metro_viewer/metro_viewer_process_host_win.cc23
-rw-r--r--chrome/browser/metro_viewer/metro_viewer_process_host_win.h3
-rw-r--r--content/browser/renderer_host/web_input_event_aura.cc70
-rw-r--r--content/browser/renderer_host/web_input_event_aura.h4
-rw-r--r--content/browser/renderer_host/web_input_event_aurax11.cc56
-rw-r--r--ui/aura/aura.gyp2
-rw-r--r--ui/aura/remote_root_window_host_win.cc159
-rw-r--r--ui/aura/remote_root_window_host_win.h67
-rw-r--r--ui/aura/root_window.cc6
-rw-r--r--ui/aura/root_window_host.h6
-rw-r--r--ui/aura/root_window_host_linux.cc14
-rw-r--r--ui/aura/root_window_host_linux.h4
-rw-r--r--ui/aura/root_window_host_win.cc14
-rw-r--r--ui/aura/root_window_host_win.h5
-rw-r--r--ui/metro_viewer/metro_viewer_messages.h15
-rw-r--r--ui/views/widget/desktop_root_window_host_linux.cc6
-rw-r--r--ui/views/widget/desktop_root_window_host_linux.h1
-rw-r--r--ui/views/widget/desktop_root_window_host_win.cc7
-rw-r--r--ui/views/widget/desktop_root_window_host_win.h1
-rw-r--r--win8/metro_driver/chrome_app_view.h20
-rw-r--r--win8/metro_driver/devices_handler.cc33
-rw-r--r--win8/metro_driver/devices_handler.h18
-rw-r--r--win8/metro_driver/stdafx.h1
24 files changed, 460 insertions, 95 deletions
diff --git a/ash/display/multi_display_manager.cc b/ash/display/multi_display_manager.cc
index e428c7c..be5897c 100644
--- a/ash/display/multi_display_manager.cc
+++ b/ash/display/multi_display_manager.cc
@@ -31,6 +31,11 @@
#include "chromeos/display/output_configurator.h"
#endif
+#if defined(OS_WIN)
+#include "base/win/windows_version.h"
+#include "ui/aura/remote_root_window_host_win.h"
+#endif
+
DECLARE_WINDOW_PROPERTY_TYPE(int64);
typedef std::vector<gfx::Display> DisplayList;
@@ -253,8 +258,15 @@ void MultiDisplayManager::OnNativeDisplaysChanged(
RootWindow* MultiDisplayManager::CreateRootWindowForDisplay(
const gfx::Display& display) {
- RootWindow* root_window =
- new RootWindow(RootWindow::CreateParams(display.bounds_in_pixel()));
+
+ RootWindow::CreateParams params(display.bounds_in_pixel());
+#if defined(OS_WIN)
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
+ params.host = aura::RemoteRootWindowHostWin::Create(
+ display.bounds_in_pixel());
+ }
+#endif
+ aura::RootWindow* root_window = new aura::RootWindow(params);
// No need to remove RootWindowObserver because
// the DisplayManager object outlives RootWindow objects.
root_window->AddRootWindowObserver(this);
@@ -358,6 +370,10 @@ void MultiDisplayManager::Init() {
}
#endif
+#if defined(OS_WIN)
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8)
+ set_use_fullscreen_host_window(true);
+#endif
// TODO(oshima): Move this logic to DisplayChangeObserver.
const string size_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kAuraHostWindowSize);
diff --git a/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc b/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc
index bfbfe5f..db26ed4 100644
--- a/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc
+++ b/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc
@@ -5,8 +5,10 @@
#include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h"
#include "base/logging.h"
+#include "chrome/browser/lifetime/application_lifetime.h"
#include "content/public/browser/browser_thread.h"
#include "ipc/ipc_channel_proxy.h"
+#include "ui/aura/remote_root_window_host_win.h"
#include "ui/metro_viewer/metro_viewer_messages.h"
#include "ui/surface/accelerated_surface_win.h"
@@ -33,12 +35,20 @@ bool MetroViewerProcessHost::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(MetroViewerProcessHost, message)
IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetTargetSurface, OnSetTargetSurface)
- IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MouseEvent, OnMouseEvent)
+ IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MouseMoved, OnMouseMoved)
+ IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MouseButton, OnMouseButton)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
+void MetroViewerProcessHost::OnChannelError() {
+ // TODO(cpu): At some point we only close the browser. Right now this
+ // is very convenient for developing.
+ DLOG(INFO) << "viewer channel error : Quitting browser";
+ browser::CloseAllBrowsers();
+}
+
void MetroViewerProcessHost::OnSetTargetSurface(
gfx::NativeViewId target_surface) {
DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface;
@@ -49,7 +59,12 @@ void MetroViewerProcessHost::OnSetTargetSurface(
any_window->SetNewTargetWindow(hwnd);
}
-void MetroViewerProcessHost::OnMouseEvent(
- int msg, WPARAM w_param, LPARAM l_param) {
- // TODO(scottmg): Pass to window.
+void MetroViewerProcessHost::OnMouseMoved(int x, int y, int modifiers) {
+ // TODO(cpu): Find a decent way to get to the root window host.
+ aura::RemoteRootWindowHostWin::Instance()->OnMouseMoved(x, y, modifiers);
+}
+
+void MetroViewerProcessHost::OnMouseButton(int x, int y, int modifiers) {
+ // TODO(cpu): Find a decent way to get to the root window host.
+ aura::RemoteRootWindowHostWin::Instance()->OnMouseClick(x, y, modifiers);
}
diff --git a/chrome/browser/metro_viewer/metro_viewer_process_host_win.h b/chrome/browser/metro_viewer/metro_viewer_process_host_win.h
index 076d61b..51207ec 100644
--- a/chrome/browser/metro_viewer/metro_viewer_process_host_win.h
+++ b/chrome/browser/metro_viewer/metro_viewer_process_host_win.h
@@ -28,10 +28,13 @@ class MetroViewerProcessHost : public IPC::Listener,
// IPC::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ virtual void OnChannelError() OVERRIDE;
private:
void OnSetTargetSurface(gfx::NativeViewId target_surface);
void OnMouseEvent(int msg, WPARAM w_param, LPARAM l_param);
+ void OnMouseMoved(int x, int y, int modifiers);
+ void OnMouseButton(int x, int y, int modifiers);
scoped_ptr<IPC::ChannelProxy> channel_;
diff --git a/content/browser/renderer_host/web_input_event_aura.cc b/content/browser/renderer_host/web_input_event_aura.cc
index aa9fd81..33b189e 100644
--- a/content/browser/renderer_host/web_input_event_aura.cc
+++ b/content/browser/renderer_host/web_input_event_aura.cc
@@ -21,7 +21,6 @@ WebKit::WebGestureEvent MakeWebGestureEventFromNativeEvent(
WebKit::WebTouchPoint* UpdateWebTouchEventFromNativeEvent(
base::NativeEvent native_event, WebKit::WebTouchEvent* web_event);
#else
-WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(ui::MouseEvent* event);
WebKit::WebMouseWheelEvent MakeWebMouseWheelEventFromAuraEvent(
ui::MouseWheelEvent* event);
WebKit::WebMouseWheelEvent MakeWebMouseWheelEventFromAuraEvent(
@@ -36,6 +35,8 @@ WebKit::WebTouchPoint* UpdateWebTouchEventFromAuraEvent(
ui::TouchEvent* event, WebKit::WebTouchEvent* web_event);
#endif
+WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(ui::MouseEvent* event);
+
// General approach:
//
// ui::Event only carries a subset of possible event data provided to Aura by
@@ -60,14 +61,17 @@ WebKit::WebTouchPoint* UpdateWebTouchEventFromAuraEvent(
//
WebKit::WebMouseEvent MakeWebMouseEvent(ui::MouseEvent* event) {
-#if defined(OS_WIN)
// Construct an untranslated event from the platform event data.
WebKit::WebMouseEvent webkit_event =
- MakeUntranslatedWebMouseEventFromNativeEvent(event->native_event());
+#if defined(OS_WIN)
+ // On Windows we have WM_ events comming from desktop and pure aura
+ // events comming from metro mode.
+ event->native_event().message ?
+ MakeUntranslatedWebMouseEventFromNativeEvent(event->native_event()) :
+ MakeWebMouseEventFromAuraEvent(event);
#else
- WebKit::WebMouseEvent webkit_event = MakeWebMouseEventFromAuraEvent(event);
+ MakeWebMouseEventFromAuraEvent(event);
#endif
-
// Replace the event's coordinate fields with translated position data from
// |event|.
webkit_event.windowX = webkit_event.x = event->x();
@@ -193,4 +197,60 @@ WebKit::WebTouchPoint* UpdateWebTouchEvent(ui::TouchEvent* event,
#endif
}
+int EventFlagsToWebEventModifiers(int flags) {
+ int modifiers = 0;
+ if (flags & ui::EF_SHIFT_DOWN)
+ modifiers |= WebKit::WebInputEvent::ShiftKey;
+ if (flags & ui::EF_CONTROL_DOWN)
+ modifiers |= WebKit::WebInputEvent::ControlKey;
+ if (flags & ui::EF_ALT_DOWN)
+ modifiers |= WebKit::WebInputEvent::AltKey;
+ // TODO(beng): MetaKey/META_MASK
+ if (flags & ui::EF_LEFT_MOUSE_BUTTON)
+ modifiers |= WebKit::WebInputEvent::LeftButtonDown;
+ if (flags & ui::EF_MIDDLE_MOUSE_BUTTON)
+ modifiers |= WebKit::WebInputEvent::MiddleButtonDown;
+ if (flags & ui::EF_RIGHT_MOUSE_BUTTON)
+ modifiers |= WebKit::WebInputEvent::RightButtonDown;
+ if (flags & ui::EF_CAPS_LOCK_DOWN)
+ modifiers |= WebKit::WebInputEvent::CapsLockOn;
+ return modifiers;
+}
+
+WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(ui::MouseEvent* event) {
+ WebKit::WebMouseEvent webkit_event;
+
+ webkit_event.modifiers = EventFlagsToWebEventModifiers(event->flags());
+ webkit_event.timeStampSeconds = event->time_stamp().InSecondsF();
+
+ webkit_event.button = WebKit::WebMouseEvent::ButtonNone;
+ if (event->flags() & ui::EF_LEFT_MOUSE_BUTTON)
+ webkit_event.button = WebKit::WebMouseEvent::ButtonLeft;
+ if (event->flags() & ui::EF_MIDDLE_MOUSE_BUTTON)
+ webkit_event.button = WebKit::WebMouseEvent::ButtonMiddle;
+ if (event->flags() & ui::EF_RIGHT_MOUSE_BUTTON)
+ webkit_event.button = WebKit::WebMouseEvent::ButtonRight;
+
+ switch (event->type()) {
+ case ui::ET_MOUSE_PRESSED:
+ webkit_event.type = WebKit::WebInputEvent::MouseDown;
+ webkit_event.clickCount = event->GetClickCount();
+ break;
+ case ui::ET_MOUSE_RELEASED:
+ webkit_event.type = WebKit::WebInputEvent::MouseUp;
+ break;
+ case ui::ET_MOUSE_ENTERED:
+ case ui::ET_MOUSE_EXITED:
+ case ui::ET_MOUSE_MOVED:
+ case ui::ET_MOUSE_DRAGGED:
+ webkit_event.type = WebKit::WebInputEvent::MouseMove;
+ break;
+ default:
+ NOTIMPLEMENTED() << "Received unexpected event: " << event->type();
+ break;
+ }
+
+ return webkit_event;
+}
+
} // namespace content
diff --git a/content/browser/renderer_host/web_input_event_aura.h b/content/browser/renderer_host/web_input_event_aura.h
index fabf70c..4373660 100644
--- a/content/browser/renderer_host/web_input_event_aura.h
+++ b/content/browser/renderer_host/web_input_event_aura.h
@@ -39,6 +39,8 @@ CONTENT_EXPORT WebKit::WebGestureEvent MakeWebGestureEventFlingCancel();
WebKit::WebTouchPoint* UpdateWebTouchEvent(ui::TouchEvent* event,
WebKit::WebTouchEvent* web_event);
-}
+int EventFlagsToWebEventModifiers(int flags);
+
+} // namespace content
#endif // CONTENT_BROWSER_RENDERER_HOST_WEB_INPUT_EVENT_AURA_H_
diff --git a/content/browser/renderer_host/web_input_event_aurax11.cc b/content/browser/renderer_host/web_input_event_aurax11.cc
index 4105058..8193bbf 100644
--- a/content/browser/renderer_host/web_input_event_aurax11.cc
+++ b/content/browser/renderer_host/web_input_event_aurax11.cc
@@ -59,26 +59,6 @@ namespace {
// This matches Firefox behavior.
const int kPixelsPerTick = 53;
-int EventFlagsToWebEventModifiers(int flags) {
- int modifiers = 0;
- if (flags & ui::EF_SHIFT_DOWN)
- modifiers |= WebKit::WebInputEvent::ShiftKey;
- if (flags & ui::EF_CONTROL_DOWN)
- modifiers |= WebKit::WebInputEvent::ControlKey;
- if (flags & ui::EF_ALT_DOWN)
- modifiers |= WebKit::WebInputEvent::AltKey;
- // TODO(beng): MetaKey/META_MASK
- if (flags & ui::EF_LEFT_MOUSE_BUTTON)
- modifiers |= WebKit::WebInputEvent::LeftButtonDown;
- if (flags & ui::EF_MIDDLE_MOUSE_BUTTON)
- modifiers |= WebKit::WebInputEvent::MiddleButtonDown;
- if (flags & ui::EF_RIGHT_MOUSE_BUTTON)
- modifiers |= WebKit::WebInputEvent::RightButtonDown;
- if (flags & ui::EF_CAPS_LOCK_DOWN)
- modifiers |= WebKit::WebInputEvent::CapsLockOn;
- return modifiers;
-}
-
int XKeyEventToWindowsKeyCode(XKeyEvent* event) {
int windows_key_code =
ui::KeyboardCodeFromXKeyEvent(reinterpret_cast<XEvent*>(event));
@@ -189,42 +169,6 @@ WebKit::WebInputEvent::Type TouchEventTypeFromEvent(
} // namespace
-WebKit::WebMouseEvent MakeWebMouseEventFromAuraEvent(ui::MouseEvent* event) {
- WebKit::WebMouseEvent webkit_event;
-
- webkit_event.modifiers = EventFlagsToWebEventModifiers(event->flags());
- webkit_event.timeStampSeconds = event->time_stamp().InSecondsF();
-
- webkit_event.button = WebKit::WebMouseEvent::ButtonNone;
- if (event->flags() & ui::EF_LEFT_MOUSE_BUTTON)
- webkit_event.button = WebKit::WebMouseEvent::ButtonLeft;
- if (event->flags() & ui::EF_MIDDLE_MOUSE_BUTTON)
- webkit_event.button = WebKit::WebMouseEvent::ButtonMiddle;
- if (event->flags() & ui::EF_RIGHT_MOUSE_BUTTON)
- webkit_event.button = WebKit::WebMouseEvent::ButtonRight;
-
- switch (event->type()) {
- case ui::ET_MOUSE_PRESSED:
- webkit_event.type = WebKit::WebInputEvent::MouseDown;
- webkit_event.clickCount = event->GetClickCount();
- break;
- case ui::ET_MOUSE_RELEASED:
- webkit_event.type = WebKit::WebInputEvent::MouseUp;
- break;
- case ui::ET_MOUSE_ENTERED:
- case ui::ET_MOUSE_EXITED:
- case ui::ET_MOUSE_MOVED:
- case ui::ET_MOUSE_DRAGGED:
- webkit_event.type = WebKit::WebInputEvent::MouseMove;
- break;
- default:
- NOTIMPLEMENTED() << "Received unexpected event: " << event->type();
- break;
- }
-
- return webkit_event;
-}
-
WebKit::WebMouseWheelEvent MakeWebMouseWheelEventFromAuraEvent(
ui::MouseWheelEvent* event) {
WebKit::WebMouseWheelEvent webkit_event;
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp
index 07daf50..76b7fe8 100644
--- a/ui/aura/aura.gyp
+++ b/ui/aura/aura.gyp
@@ -88,6 +88,8 @@
'display_change_observer_x11.h',
'display_manager.cc',
'display_manager.h',
+ 'remote_root_window_host_win.cc',
+ 'remote_root_window_host_win.h',
'root_window_host.h',
'root_window_host_delegate.h',
'root_window_host_linux.cc',
diff --git a/ui/aura/remote_root_window_host_win.cc b/ui/aura/remote_root_window_host_win.cc
new file mode 100644
index 0000000..de3ccd8
--- /dev/null
+++ b/ui/aura/remote_root_window_host_win.cc
@@ -0,0 +1,159 @@
+// Copyright (c) 2012 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.
+
+#include "ui/aura/remote_root_window_host_win.h"
+
+#include <windows.h>
+
+#include <algorithm>
+
+#include "base/message_loop.h"
+#include "ui/aura/client/capture_client.h"
+#include "ui/aura/env.h"
+#include "ui/aura/root_window.h"
+#include "ui/base/cursor/cursor_loader_win.h"
+#include "ui/base/events/event.h"
+#include "ui/base/view_prop.h"
+
+using std::max;
+using std::min;
+
+namespace aura {
+
+namespace {
+
+const char* kRootWindowHostWinKey = "__AURA_REMOTE_ROOT_WINDOW_HOST_WIN__";
+
+} // namespace
+
+RemoteRootWindowHostWin* g_instance = NULL;
+
+RemoteRootWindowHostWin* RemoteRootWindowHostWin::Instance() {
+ return g_instance;
+}
+
+RemoteRootWindowHostWin* RemoteRootWindowHostWin::Create(
+ const gfx::Rect& bounds) {
+ g_instance = new RemoteRootWindowHostWin(bounds);
+ return g_instance;
+}
+
+RemoteRootWindowHostWin::RemoteRootWindowHostWin(const gfx::Rect& bounds)
+ : delegate_(NULL) {
+ prop_.reset(new ui::ViewProp(NULL, kRootWindowHostWinKey, this));
+}
+
+RemoteRootWindowHostWin::~RemoteRootWindowHostWin() {
+}
+
+void RemoteRootWindowHostWin::SetDelegate(RootWindowHostDelegate* delegate) {
+ delegate_ = delegate;
+}
+
+RootWindow* RemoteRootWindowHostWin::GetRootWindow() {
+ return delegate_->AsRootWindow();
+}
+
+gfx::AcceleratedWidget RemoteRootWindowHostWin::GetAcceleratedWidget() {
+ // TODO(cpu): This is bad. Chrome's compositor needs a valid window
+ // initially and then later on we swap it. Since the compositor never
+ // uses this initial window we tell ourselves this hack is ok to get
+ // thing off the ground.
+ return ::GetDesktopWindow();
+}
+
+void RemoteRootWindowHostWin::Show() {
+}
+
+void RemoteRootWindowHostWin::Hide() {
+ NOTIMPLEMENTED();
+}
+
+void RemoteRootWindowHostWin::ToggleFullScreen() {
+}
+
+gfx::Rect RemoteRootWindowHostWin::GetBounds() const {
+ gfx::Rect r(gfx::Point(0, 0), aura::RootWindowHost::GetNativeScreenSize());
+ return r;
+}
+
+void RemoteRootWindowHostWin::SetBounds(const gfx::Rect& bounds) {
+}
+
+gfx::Point RemoteRootWindowHostWin::GetLocationOnNativeScreen() const {
+ return gfx::Point(0, 0);
+}
+
+void RemoteRootWindowHostWin::SetCursor(gfx::NativeCursor native_cursor) {
+}
+
+void RemoteRootWindowHostWin::SetCapture() {
+}
+
+void RemoteRootWindowHostWin::ReleaseCapture() {
+}
+
+void RemoteRootWindowHostWin::ShowCursor(bool show) {
+}
+
+bool RemoteRootWindowHostWin::QueryMouseLocation(gfx::Point* location_return) {
+ POINT pt;
+ GetCursorPos(&pt);
+ *location_return =
+ gfx::Point(static_cast<int>(pt.x), static_cast<int>(pt.y));
+ return true;
+}
+
+bool RemoteRootWindowHostWin::ConfineCursorToRootWindow() {
+ return true;
+}
+
+bool RemoteRootWindowHostWin::GrabSnapshot(
+ const gfx::Rect& snapshot_bounds,
+ std::vector<unsigned char>* png_representation) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+void RemoteRootWindowHostWin::UnConfineCursor() {
+}
+
+void RemoteRootWindowHostWin::MoveCursorTo(const gfx::Point& location) {
+}
+
+void RemoteRootWindowHostWin::SetFocusWhenShown(bool focus_when_shown) {
+ NOTIMPLEMENTED();
+}
+
+void RemoteRootWindowHostWin::PostNativeEvent(
+ const base::NativeEvent& native_event) {
+}
+
+void RemoteRootWindowHostWin::OnDeviceScaleFactorChanged(
+ float device_scale_factor) {
+ NOTIMPLEMENTED();
+}
+
+void RemoteRootWindowHostWin::PrepareForShutdown() {
+ NOTIMPLEMENTED();
+}
+
+void RemoteRootWindowHostWin::OnMouseMoved(int x, int y, int extra) {
+ gfx::Point location(x, y);
+ ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location, 0);
+ delegate_->OnHostMouseEvent(&event);
+}
+
+void RemoteRootWindowHostWin::OnMouseClick(int x, int y, int extra) {
+ gfx::Point location(x, y);
+ ui::EventType type = (extra == 1) ?
+ ui::ET_MOUSE_PRESSED : ui::ET_MOUSE_RELEASED;
+ ui::MouseEvent event(type, location, location, 0);
+ event.SetClickCount(1);
+ event.set_flags(ui::EF_LEFT_MOUSE_BUTTON);
+ delegate_->OnHostMouseEvent(&event);
+}
+
+} // namespace aura
+
diff --git a/ui/aura/remote_root_window_host_win.h b/ui/aura/remote_root_window_host_win.h
new file mode 100644
index 0000000..52990c9
--- /dev/null
+++ b/ui/aura/remote_root_window_host_win.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2012 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.
+
+#ifndef UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_
+#define UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_
+
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "ui/aura/root_window_host.h"
+#include "ui/base/win/window_impl.h"
+
+namespace ui {
+class ViewProp;
+}
+
+namespace aura {
+// RootWindowHost implementaton that receives events from a different process.
+class AURA_EXPORT RemoteRootWindowHostWin : public RootWindowHost {
+ public:
+ static RemoteRootWindowHostWin* Instance();
+ static RemoteRootWindowHostWin* Create(const gfx::Rect& bounds);
+
+ void OnMouseMoved(int x, int y, int extra);
+ void OnMouseClick(int x, int y, int extra);
+
+ private:
+ RemoteRootWindowHostWin(const gfx::Rect& bounds);
+ virtual ~RemoteRootWindowHostWin();
+
+ // RootWindowHost overrides:
+ virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE;
+ virtual RootWindow* GetRootWindow() OVERRIDE;
+ virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
+ virtual void Show() OVERRIDE;
+ virtual void Hide() OVERRIDE;
+ virtual void ToggleFullScreen() OVERRIDE;
+ virtual gfx::Rect GetBounds() const OVERRIDE;
+ virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
+ virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE;
+ virtual void SetCapture() OVERRIDE;
+ virtual void ReleaseCapture() OVERRIDE;
+ virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE;
+ virtual void ShowCursor(bool show) OVERRIDE;
+ virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE;
+ virtual bool ConfineCursorToRootWindow() OVERRIDE;
+ virtual void UnConfineCursor() OVERRIDE;
+ virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE;
+ virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE;
+ virtual bool GrabSnapshot(
+ const gfx::Rect& snapshot_bounds,
+ std::vector<unsigned char>* png_representation) OVERRIDE;
+ virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE;
+ virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
+ virtual void PrepareForShutdown() OVERRIDE;
+
+ RootWindowHostDelegate* delegate_;
+ scoped_ptr<ui::ViewProp> prop_;
+
+ DISALLOW_COPY_AND_ASSIGN(RemoteRootWindowHostWin);
+};
+
+} // namespace aura
+
+#endif // UI_AURA_REMOTE_ROOT_WINDOW_HOST_WIN_H_
+
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 4af5464..10d2297 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -83,8 +83,10 @@ void SetLastMouseLocation(const Window* root_window,
RootWindowHost* CreateHost(RootWindow* root_window,
const RootWindow::CreateParams& params) {
- return params.host ? params.host :
- RootWindowHost::Create(root_window, params.initial_bounds);
+ RootWindowHost* host = params.host ?
+ params.host : RootWindowHost::Create(params.initial_bounds);
+ host->SetDelegate(root_window);
+ return host;
}
} // namespace
diff --git a/ui/aura/root_window_host.h b/ui/aura/root_window_host.h
index 5105fa9..fdd2e3c 100644
--- a/ui/aura/root_window_host.h
+++ b/ui/aura/root_window_host.h
@@ -31,13 +31,15 @@ class AURA_EXPORT RootWindowHost {
virtual ~RootWindowHost() {}
// Creates a new RootWindowHost. The caller owns the returned value.
- static RootWindowHost* Create(RootWindowHostDelegate* delegate,
- const gfx::Rect& bounds);
+ static RootWindowHost* Create(const gfx::Rect& bounds);
// Returns the actual size of the screen.
// (gfx::Screen only reports on the virtual desktop exposed by Aura.)
static gfx::Size GetNativeScreenSize();
+ // Sets the delegate, which is normally done by the root window.
+ virtual void SetDelegate(RootWindowHostDelegate* delegate) = 0;
+
virtual RootWindow* GetRootWindow() = 0;
// Returns the RootWindowHost for the specified accelerated widget, or NULL if
diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc
index 3ce1cde..d068d8b 100644
--- a/ui/aura/root_window_host_linux.cc
+++ b/ui/aura/root_window_host_linux.cc
@@ -331,9 +331,8 @@ class TouchEventCalibrate : public base::MessagePumpObserver {
} // namespace internal
-RootWindowHostLinux::RootWindowHostLinux(RootWindowHostDelegate* delegate,
- const gfx::Rect& bounds)
- : delegate_(delegate),
+RootWindowHostLinux::RootWindowHostLinux(const gfx::Rect& bounds)
+ : delegate_(NULL),
xdisplay_(base::MessagePumpAuraX11::GetDefaultXDisplay()),
xwindow_(0),
x_root_window_(DefaultRootWindow(xdisplay_)),
@@ -698,6 +697,10 @@ void RootWindowHostLinux::DispatchXI2Event(const base::NativeEvent& event) {
XFreeEventData(xev->xgeneric.display, &last_event.xcookie);
}
+void RootWindowHostLinux::SetDelegate(RootWindowHostDelegate* delegate) {
+ delegate_ = delegate;
+}
+
RootWindow* RootWindowHostLinux::GetRootWindow() {
return delegate_->AsRootWindow();
}
@@ -1011,9 +1014,8 @@ void RootWindowHostLinux::TranslateAndDispatchMouseEvent(
}
// static
-RootWindowHost* RootWindowHost::Create(RootWindowHostDelegate* delegate,
- const gfx::Rect& bounds) {
- return new RootWindowHostLinux(delegate, bounds);
+RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) {
+ return new RootWindowHostLinux(bounds);
}
// static
diff --git a/ui/aura/root_window_host_linux.h b/ui/aura/root_window_host_linux.h
index 21e95ce..c244039 100644
--- a/ui/aura/root_window_host_linux.h
+++ b/ui/aura/root_window_host_linux.h
@@ -30,8 +30,7 @@ class TouchEventCalibrate;
class RootWindowHostLinux : public RootWindowHost,
public MessageLoop::Dispatcher {
public:
- RootWindowHostLinux(RootWindowHostDelegate* delegate,
- const gfx::Rect& bounds);
+ RootWindowHostLinux(const gfx::Rect& bounds);
virtual ~RootWindowHostLinux();
// Overridden from Dispatcher overrides:
@@ -46,6 +45,7 @@ class RootWindowHostLinux : public RootWindowHost,
void DispatchXI2Event(const base::NativeEvent& event);
// RootWindowHost Overrides.
+ virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE;
virtual RootWindow* GetRootWindow() OVERRIDE;
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
virtual void Show() OVERRIDE;
diff --git a/ui/aura/root_window_host_win.cc b/ui/aura/root_window_host_win.cc
index fef153d..9f3b6a7 100644
--- a/ui/aura/root_window_host_win.cc
+++ b/ui/aura/root_window_host_win.cc
@@ -28,9 +28,8 @@ const char* kRootWindowHostWinKey = "__AURA_ROOT_WINDOW_HOST_WIN__";
} // namespace
// static
-RootWindowHost* RootWindowHost::Create(RootWindowHostDelegate* delegate,
- const gfx::Rect& bounds) {
- return new RootWindowHostWin(delegate, bounds);
+RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) {
+ return new RootWindowHostWin(bounds);
}
// static
@@ -46,9 +45,8 @@ gfx::Size RootWindowHost::GetNativeScreenSize() {
GetSystemMetrics(SM_CYSCREEN));
}
-RootWindowHostWin::RootWindowHostWin(RootWindowHostDelegate* delegate,
- const gfx::Rect& bounds)
- : delegate_(delegate),
+RootWindowHostWin::RootWindowHostWin(const gfx::Rect& bounds)
+ : delegate_(NULL),
fullscreen_(false),
has_capture_(false),
saved_window_style_(0),
@@ -62,6 +60,10 @@ RootWindowHostWin::~RootWindowHostWin() {
DestroyWindow(hwnd());
}
+void RootWindowHostWin::SetDelegate(RootWindowHostDelegate* delegate) {
+ delegate_ = delegate;
+}
+
RootWindow* RootWindowHostWin::GetRootWindow() {
return delegate_->AsRootWindow();
}
diff --git a/ui/aura/root_window_host_win.h b/ui/aura/root_window_host_win.h
index 8c8810c..f7d6dda 100644
--- a/ui/aura/root_window_host_win.h
+++ b/ui/aura/root_window_host_win.h
@@ -17,11 +17,10 @@ namespace aura {
class RootWindowHostWin : public RootWindowHost, public ui::WindowImpl {
public:
- RootWindowHostWin(RootWindowHostDelegate* delegate,
- const gfx::Rect& bounds);
+ RootWindowHostWin(const gfx::Rect& bounds);
virtual ~RootWindowHostWin();
-
// RootWindowHost:
+ virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE;
virtual RootWindow* GetRootWindow() OVERRIDE;
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
virtual void Show() OVERRIDE;
diff --git a/ui/metro_viewer/metro_viewer_messages.h b/ui/metro_viewer/metro_viewer_messages.h
index 776e06b..66d482c 100644
--- a/ui/metro_viewer/metro_viewer_messages.h
+++ b/ui/metro_viewer/metro_viewer_messages.h
@@ -15,8 +15,15 @@
// Inform the browser of the surface to target for compositing.
IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_SetTargetSurface,
gfx::NativeViewId /* target hwnd */)
+// Informs the browser that the mouse moved.
+IPC_MESSAGE_CONTROL3(MetroViewerHostMsg_MouseMoved,
+ int, /* x-coordinate */
+ int, /* y-coordinate */
+ int /* modifiers */)
+// Inforoms the brower that a mouse button was pressed.
+IPC_MESSAGE_CONTROL3(MetroViewerHostMsg_MouseButton,
+ int, /* x-coordinate */
+ int, /* y-coordinate */
+ int /* modifiers */)
+
-IPC_MESSAGE_CONTROL3(MetroViewerHostMsg_MouseEvent,
- int, /* msg */
- uintptr_t, /* message's wParam */
- intptr_t /* message's lParam */)
diff --git a/ui/views/widget/desktop_root_window_host_linux.cc b/ui/views/widget/desktop_root_window_host_linux.cc
index b0b1dbc..c32e87a 100644
--- a/ui/views/widget/desktop_root_window_host_linux.cc
+++ b/ui/views/widget/desktop_root_window_host_linux.cc
@@ -157,7 +157,6 @@ aura::RootWindow* DesktopRootWindowHostLinux::InitRootWindow(
root_window_->Init();
root_window_->AddChild(content_window_);
root_window_->SetLayoutManager(new DesktopLayoutManager(root_window_));
- root_window_host_delegate_ = root_window_;
// If we're given a parent, we need to mark ourselves as transient to another
// window. Otherwise activation gets screwy.
@@ -559,6 +558,11 @@ void DesktopRootWindowHostLinux::FlashFrame(bool flash_frame) {
////////////////////////////////////////////////////////////////////////////////
// DesktopRootWindowHostLinux, aura::RootWindowHost implementation:
+void DesktopRootWindowHostLinux::SetDelegate(
+ aura::RootWindowHostDelegate* delegate) {
+ root_window_host_delegate_ = delegate;
+}
+
aura::RootWindow* DesktopRootWindowHostLinux::GetRootWindow() {
return root_window_;
}
diff --git a/ui/views/widget/desktop_root_window_host_linux.h b/ui/views/widget/desktop_root_window_host_linux.h
index 8180b9b..8de4f76 100644
--- a/ui/views/widget/desktop_root_window_host_linux.h
+++ b/ui/views/widget/desktop_root_window_host_linux.h
@@ -129,6 +129,7 @@ class VIEWS_EXPORT DesktopRootWindowHostLinux
virtual void FlashFrame(bool flash_frame) OVERRIDE;
// Overridden from aura::RootWindowHost:
+ virtual void SetDelegate(aura::RootWindowHostDelegate* delegate) OVERRIDE;
virtual aura::RootWindow* GetRootWindow() OVERRIDE;
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
virtual void Show() OVERRIDE;
diff --git a/ui/views/widget/desktop_root_window_host_win.cc b/ui/views/widget/desktop_root_window_host_win.cc
index efae689..ecdf1d9 100644
--- a/ui/views/widget/desktop_root_window_host_win.cc
+++ b/ui/views/widget/desktop_root_window_host_win.cc
@@ -77,7 +77,6 @@ aura::RootWindow* DesktopRootWindowHostWin::Init(
root_window_->Init();
root_window_->AddChild(content_window_);
- root_window_host_delegate_ = root_window_;
native_widget_delegate_->OnNativeWidgetCreated();
@@ -313,6 +312,12 @@ void DesktopRootWindowHostWin::FlashFrame(bool flash_frame) {
////////////////////////////////////////////////////////////////////////////////
// DesktopRootWindowHostWin, RootWindowHost implementation:
+
+void DesktopRootWindowHostWin::SetDelegate(
+ aura::RootWindowHostDelegate* delegate) {
+ root_window_host_delegate_ = delegate;
+}
+
aura::RootWindow* DesktopRootWindowHostWin::GetRootWindow() {
return root_window_;
}
diff --git a/ui/views/widget/desktop_root_window_host_win.h b/ui/views/widget/desktop_root_window_host_win.h
index 8580057..f8d9299 100644
--- a/ui/views/widget/desktop_root_window_host_win.h
+++ b/ui/views/widget/desktop_root_window_host_win.h
@@ -92,6 +92,7 @@ class VIEWS_EXPORT DesktopRootWindowHostWin
virtual void FlashFrame(bool flash_frame) OVERRIDE;
// Overridden from aura::RootWindowHost:
+ virtual void SetDelegate(aura::RootWindowHostDelegate* delegate) OVERRIDE;
virtual aura::RootWindow* GetRootWindow() OVERRIDE;
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
virtual void Show() OVERRIDE;
diff --git a/win8/metro_driver/chrome_app_view.h b/win8/metro_driver/chrome_app_view.h
index cca7864..f9d8f90 100644
--- a/win8/metro_driver/chrome_app_view.h
+++ b/win8/metro_driver/chrome_app_view.h
@@ -25,6 +25,11 @@
#include "win8/metro_driver/settings_handler.h"
#include "win8/metro_driver/toast_notification_handler.h"
+namespace IPC {
+ class Listener;
+ class ChannelProxy;
+}
+
class ChromeAppView
: public mswr::RuntimeClass<winapp::Core::IFrameworkView> {
public:
@@ -77,6 +82,15 @@ class ChromeAppView
HRESULT OnSizeChanged(winui::Core::ICoreWindow* sender,
winui::Core::IWindowSizeChangedEventArgs* args);
+ HRESULT OnPointerMoved(winui::Core::ICoreWindow* sender,
+ winui::Core::IPointerEventArgs* args);
+
+ HRESULT OnPointerPressed(winui::Core::ICoreWindow* sender,
+ winui::Core::IPointerEventArgs* args);
+
+ HRESULT OnPointerReleased(winui::Core::ICoreWindow* sender,
+ winui::Core::IPointerEventArgs* args);
+
HRESULT OnEdgeGestureCompleted(winui::Input::IEdgeGesture* gesture,
winui::Input::IEdgeGestureEventArgs* args);
@@ -110,6 +124,9 @@ class ChromeAppView
EventRegistrationToken input_pane_visible_token_;
EventRegistrationToken input_pane_hiding_token_;
EventRegistrationToken app_exit_token_;
+ EventRegistrationToken pointermoved_token_;
+ EventRegistrationToken pointerpressed_token_;
+ EventRegistrationToken pointerreleased_token_;
ChromeUrlLaunchHandler url_launch_handler_;
metro_driver::DevicesHandler devices_handler_;
@@ -135,6 +152,9 @@ class ChromeAppView
MetroDialogBox dialog_box_;
metro_driver::Direct3DHelper direct3d_helper_;
+
+ IPC::Listener* ui_channel_listener_;
+ IPC::ChannelProxy* ui_channel_;
};
class ChromeAppViewFactory
diff --git a/win8/metro_driver/devices_handler.cc b/win8/metro_driver/devices_handler.cc
index 20fd413..9175885 100644
--- a/win8/metro_driver/devices_handler.cc
+++ b/win8/metro_driver/devices_handler.cc
@@ -20,4 +20,37 @@ HRESULT DevicesHandler::Initialize(winui::Core::ICoreWindow* window) {
return hr;
}
+PointerEventHandler::PointerEventHandler() {
+}
+
+PointerEventHandler::~PointerEventHandler() {
+}
+
+HRESULT PointerEventHandler::Init(winui::Core::IPointerEventArgs* args) {
+ mswr::ComPtr<winui::Input::IPointerPoint> pointer_point;
+ HRESULT hr = args->get_CurrentPoint(&pointer_point);
+ if (FAILED(hr))
+ return hr;
+
+ mswr::ComPtr<windevs::Input::IPointerDevice> pointer_device;
+ hr = pointer_point->get_PointerDevice(&pointer_device);
+ if (FAILED(hr))
+ return hr;
+
+ windevs::Input::PointerDeviceType device_type;
+ hr = pointer_device->get_PointerDeviceType(&device_type);
+ if (FAILED(hr))
+ return hr;
+
+ is_mouse_ = (device_type == windevs::Input::PointerDeviceType_Mouse);
+ winfoundtn::Point point;
+ hr = pointer_point->get_Position(&point);
+ if (FAILED(hr))
+ return hr;
+
+ x_ = point.X;
+ y_ = point.Y;
+ return S_OK;
+}
+
} // namespace metro_driver
diff --git a/win8/metro_driver/devices_handler.h b/win8/metro_driver/devices_handler.h
index fdb2226..c3623b0 100644
--- a/win8/metro_driver/devices_handler.h
+++ b/win8/metro_driver/devices_handler.h
@@ -26,6 +26,24 @@ class DevicesHandler {
DISALLOW_COPY_AND_ASSIGN(DevicesHandler);
};
+// This class helps decoding the pointer properties of an event.
+class PointerEventHandler {
+ public:
+ PointerEventHandler();
+ ~PointerEventHandler();
+
+ HRESULT Init(winui::Core::IPointerEventArgs* args);
+
+ bool is_mouse() const { return is_mouse_; }
+ int x() const { return x_; }
+ int y() const { return y_; }
+
+ private:
+ int x_;
+ int y_;
+ bool is_mouse_;
+};
+
} // namespace metro_driver
#endif // CHROME_BROWSER_UI_METRO_DRIVER_DEVICES_HANDLER_H_
diff --git a/win8/metro_driver/stdafx.h b/win8/metro_driver/stdafx.h
index d8c1a01..8373c3c 100644
--- a/win8/metro_driver/stdafx.h
+++ b/win8/metro_driver/stdafx.h
@@ -27,6 +27,7 @@ namespace mswr = Microsoft::WRL;
namespace mswrw = Microsoft::WRL::Wrappers;
namespace winapp = ABI::Windows::ApplicationModel;
namespace windata = ABI::Windows::Data;
+namespace windevs = ABI::Windows::Devices;
namespace winfoundtn = ABI::Windows::Foundation;
namespace wingfx = ABI::Windows::Graphics;
namespace winui = ABI::Windows::UI;