Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Unified Diff: ui/aura/remote_window_tree_host_win.h

Issue 1602403002: Revert of Remove remote tree host and some related input and metro_driver code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-3
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/aura.gyp ('k') | ui/aura/remote_window_tree_host_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/remote_window_tree_host_win.h
diff --git a/ui/aura/remote_window_tree_host_win.h b/ui/aura/remote_window_tree_host_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..4614fd6e8aa46ebde1dd56dc5a860297939b3ec0
--- /dev/null
+++ b/ui/aura/remote_window_tree_host_win.h
@@ -0,0 +1,197 @@
+// 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_WINDOW_TREE_HOST_WIN_H_
+#define UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_
+
+#include <stdint.h>
+
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "ui/aura/window_tree_host.h"
+#include "ui/base/ime/remote_input_method_delegate_win.h"
+#include "ui/events/event.h"
+#include "ui/events/event_constants.h"
+#include "ui/events/event_source.h"
+#include "ui/gfx/native_widget_types.h"
+#include "ui/metro_viewer/ime_types.h"
+
+struct MetroViewerHostMsg_MouseButtonParams;
+
+namespace base {
+class FilePath;
+}
+
+namespace ui {
+class RemoteInputMethodPrivateWin;
+class ViewProp;
+}
+
+namespace IPC {
+class Message;
+class Sender;
+}
+
+namespace aura {
+
+// WindowTreeHost implementaton that receives events from a different
+// process. In the case of Windows this is the Windows 8 (aka Metro)
+// frontend process, which forwards input events to this class.
+class AURA_EXPORT RemoteWindowTreeHostWin
+ : public WindowTreeHost,
+ public ui::internal::RemoteInputMethodDelegateWin {
+ public:
+ // Returns the current RemoteWindowTreeHostWin. This does *not* create a
+ // RemoteWindowTreeHostWin.
+ static RemoteWindowTreeHostWin* Instance();
+
+ // Returns true if there is a RemoteWindowTreeHostWin and it has a valid
+ // HWND. A return value of false typically indicates we're not in metro mode.
+ static bool IsValid();
+
+ // Sets the handle to the remote window. The |remote_window| is the actual
+ // window owned by the viewer process. Call this before Connected() for some
+ // customers like input method initialization which needs the handle.
+ void SetRemoteWindowHandle(HWND remote_window);
+ HWND remote_window() { return remote_window_; }
+
+ // The |host| can be used when we need to send a message to it.
+ void Connected(IPC::Sender* host);
+ // Called when the remote process has closed its IPC connection.
+ void Disconnected();
+
+ // Called when we have a message from the remote process.
+ bool OnMessageReceived(const IPC::Message& message);
+
+ void HandleOpenURLOnDesktop(const base::FilePath& shortcut,
+ const base::string16& url);
+
+ void HandleWindowSizeChanged(uint32_t width, uint32_t height);
+
+ // Returns the active ASH root window.
+ Window* GetAshWindow();
+
+ // Returns true if the remote window is the foreground window according to the
+ // OS.
+ bool IsForegroundWindow();
+
+ protected:
+ RemoteWindowTreeHostWin();
+ ~RemoteWindowTreeHostWin() override;
+
+ private:
+ // IPC message handing methods:
+ void OnMouseMoved(int32_t x, int32_t y, int32_t flags);
+ void OnMouseButton(const MetroViewerHostMsg_MouseButtonParams& params);
+ void OnKeyDown(uint32_t vkey,
+ uint32_t repeat_count,
+ uint32_t scan_code,
+ uint32_t flags);
+ void OnKeyUp(uint32_t vkey,
+ uint32_t repeat_count,
+ uint32_t scan_code,
+ uint32_t flags);
+ void OnChar(uint32_t key_code,
+ uint32_t repeat_count,
+ uint32_t scan_code,
+ uint32_t flags);
+ void OnWindowActivated(bool repaint);
+ void OnEdgeGesture();
+ void OnTouchDown(int32_t x,
+ int32_t y,
+ uint64_t timestamp,
+ uint32_t pointer_id);
+ void OnTouchUp(int32_t x, int32_t y, uint64_t timestamp, uint32_t pointer_id);
+ void OnTouchMoved(int32_t x,
+ int32_t y,
+ uint64_t timestamp,
+ uint32_t pointer_id);
+ void OnSetCursorPosAck();
+
+ // For Input Method support:
+ ui::RemoteInputMethodPrivateWin* GetRemoteInputMethodPrivate();
+ void OnImeCandidatePopupChanged(bool visible);
+ void OnImeCompositionChanged(
+ const base::string16& text,
+ int32_t selection_start,
+ int32_t selection_end,
+ const std::vector<metro_viewer::UnderlineInfo>& underlines);
+ void OnImeTextCommitted(const base::string16& text);
+ void OnImeInputSourceChanged(uint16_t language_id, bool is_ime);
+
+ // WindowTreeHost overrides:
+ ui::EventSource* GetEventSource() override;
+ gfx::AcceleratedWidget GetAcceleratedWidget() override;
+ void ShowImpl() override;
+ void HideImpl() override;
+ gfx::Rect GetBounds() const override;
+ void SetBounds(const gfx::Rect& bounds) override;
+ gfx::Point GetLocationOnNativeScreen() const override;
+ void SetCapture() override;
+ void ReleaseCapture() override;
+ void SetCursorNative(gfx::NativeCursor cursor) override;
+ void MoveCursorToNative(const gfx::Point& location) override;
+ void OnCursorVisibilityChangedNative(bool show) override;
+
+ // ui::internal::RemoteInputMethodDelegateWin overrides:
+ void CancelComposition() override;
+ void OnTextInputClientUpdated(
+ const std::vector<int32_t>& input_scopes,
+ const std::vector<gfx::Rect>& composition_character_bounds) override;
+
+ // Helper function to dispatch a keyboard message to the desired target.
+ // The default target is the WindowEventDispatcher. For nested message loop
+ // invocations we post a synthetic keyboard message directly into the message
+ // loop. The dispatcher for the nested loop would then decide how this
+ // message is routed.
+ void DispatchKeyboardMessage(ui::EventType type,
+ uint32_t vkey,
+ uint32_t repeat_count,
+ uint32_t scan_code,
+ uint32_t flags,
+ bool is_character);
+
+ // Sets the event flags. |flags| is a bitmask of EventFlags. If there is a
+ // change the system virtual key state is updated as well. This way if chrome
+ // queries for key state it matches that of event being dispatched.
+ void SetEventFlags(uint32_t flags);
+
+ uint32_t mouse_event_flags() const {
+ return event_flags_ & (ui::EF_LEFT_MOUSE_BUTTON |
+ ui::EF_MIDDLE_MOUSE_BUTTON |
+ ui::EF_RIGHT_MOUSE_BUTTON);
+ }
+
+ uint32_t key_event_flags() const {
+ return event_flags_ & (ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN |
+ ui::EF_ALT_DOWN | ui::EF_CAPS_LOCK_ON);
+ }
+
+ HWND remote_window_;
+ IPC::Sender* host_;
+ scoped_ptr<ui::ViewProp> prop_;
+
+ // Incremented if we need to ignore mouse messages until the SetCursorPos
+ // operation is acked by the viewer.
+ int ignore_mouse_moves_until_set_cursor_ack_;
+
+ // Tracking last click event for synthetically generated mouse events.
+ scoped_ptr<ui::MouseEvent> last_mouse_click_event_;
+
+ // State of the keyboard/mouse at the time of the last input event. See
+ // description of SetEventFlags().
+ uint32_t event_flags_;
+
+ // Current size of this root window.
+ gfx::Size window_size_;
+
+ DISALLOW_COPY_AND_ASSIGN(RemoteWindowTreeHostWin);
+};
+
+} // namespace aura
+
+#endif // UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_
« no previous file with comments | « ui/aura/aura.gyp ('k') | ui/aura/remote_window_tree_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698