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

Side by Side Diff: ui/aura/remote_window_tree_host_win.h

Issue 1586843002: 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: remove ash_unittests from being run 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_
6 #define UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_
7
8 #include <stdint.h>
9
10 #include <vector>
11
12 #include "base/compiler_specific.h"
13 #include "base/macros.h"
14 #include "base/strings/string16.h"
15 #include "ui/aura/window_tree_host.h"
16 #include "ui/base/ime/remote_input_method_delegate_win.h"
17 #include "ui/events/event.h"
18 #include "ui/events/event_constants.h"
19 #include "ui/events/event_source.h"
20 #include "ui/gfx/native_widget_types.h"
21 #include "ui/metro_viewer/ime_types.h"
22
23 struct MetroViewerHostMsg_MouseButtonParams;
24
25 namespace base {
26 class FilePath;
27 }
28
29 namespace ui {
30 class RemoteInputMethodPrivateWin;
31 class ViewProp;
32 }
33
34 namespace IPC {
35 class Message;
36 class Sender;
37 }
38
39 namespace aura {
40
41 // WindowTreeHost implementaton that receives events from a different
42 // process. In the case of Windows this is the Windows 8 (aka Metro)
43 // frontend process, which forwards input events to this class.
44 class AURA_EXPORT RemoteWindowTreeHostWin
45 : public WindowTreeHost,
46 public ui::internal::RemoteInputMethodDelegateWin {
47 public:
48 // Returns the current RemoteWindowTreeHostWin. This does *not* create a
49 // RemoteWindowTreeHostWin.
50 static RemoteWindowTreeHostWin* Instance();
51
52 // Returns true if there is a RemoteWindowTreeHostWin and it has a valid
53 // HWND. A return value of false typically indicates we're not in metro mode.
54 static bool IsValid();
55
56 // Sets the handle to the remote window. The |remote_window| is the actual
57 // window owned by the viewer process. Call this before Connected() for some
58 // customers like input method initialization which needs the handle.
59 void SetRemoteWindowHandle(HWND remote_window);
60 HWND remote_window() { return remote_window_; }
61
62 // The |host| can be used when we need to send a message to it.
63 void Connected(IPC::Sender* host);
64 // Called when the remote process has closed its IPC connection.
65 void Disconnected();
66
67 // Called when we have a message from the remote process.
68 bool OnMessageReceived(const IPC::Message& message);
69
70 void HandleOpenURLOnDesktop(const base::FilePath& shortcut,
71 const base::string16& url);
72
73 void HandleWindowSizeChanged(uint32_t width, uint32_t height);
74
75 // Returns the active ASH root window.
76 Window* GetAshWindow();
77
78 // Returns true if the remote window is the foreground window according to the
79 // OS.
80 bool IsForegroundWindow();
81
82 protected:
83 RemoteWindowTreeHostWin();
84 ~RemoteWindowTreeHostWin() override;
85
86 private:
87 // IPC message handing methods:
88 void OnMouseMoved(int32_t x, int32_t y, int32_t flags);
89 void OnMouseButton(const MetroViewerHostMsg_MouseButtonParams& params);
90 void OnKeyDown(uint32_t vkey,
91 uint32_t repeat_count,
92 uint32_t scan_code,
93 uint32_t flags);
94 void OnKeyUp(uint32_t vkey,
95 uint32_t repeat_count,
96 uint32_t scan_code,
97 uint32_t flags);
98 void OnChar(uint32_t key_code,
99 uint32_t repeat_count,
100 uint32_t scan_code,
101 uint32_t flags);
102 void OnWindowActivated(bool repaint);
103 void OnEdgeGesture();
104 void OnTouchDown(int32_t x,
105 int32_t y,
106 uint64_t timestamp,
107 uint32_t pointer_id);
108 void OnTouchUp(int32_t x, int32_t y, uint64_t timestamp, uint32_t pointer_id);
109 void OnTouchMoved(int32_t x,
110 int32_t y,
111 uint64_t timestamp,
112 uint32_t pointer_id);
113 void OnSetCursorPosAck();
114
115 // For Input Method support:
116 ui::RemoteInputMethodPrivateWin* GetRemoteInputMethodPrivate();
117 void OnImeCandidatePopupChanged(bool visible);
118 void OnImeCompositionChanged(
119 const base::string16& text,
120 int32_t selection_start,
121 int32_t selection_end,
122 const std::vector<metro_viewer::UnderlineInfo>& underlines);
123 void OnImeTextCommitted(const base::string16& text);
124 void OnImeInputSourceChanged(uint16_t language_id, bool is_ime);
125
126 // WindowTreeHost overrides:
127 ui::EventSource* GetEventSource() override;
128 gfx::AcceleratedWidget GetAcceleratedWidget() override;
129 void ShowImpl() override;
130 void HideImpl() override;
131 gfx::Rect GetBounds() const override;
132 void SetBounds(const gfx::Rect& bounds) override;
133 gfx::Point GetLocationOnNativeScreen() const override;
134 void SetCapture() override;
135 void ReleaseCapture() override;
136 void SetCursorNative(gfx::NativeCursor cursor) override;
137 void MoveCursorToNative(const gfx::Point& location) override;
138 void OnCursorVisibilityChangedNative(bool show) override;
139
140 // ui::internal::RemoteInputMethodDelegateWin overrides:
141 void CancelComposition() override;
142 void OnTextInputClientUpdated(
143 const std::vector<int32_t>& input_scopes,
144 const std::vector<gfx::Rect>& composition_character_bounds) override;
145
146 // Helper function to dispatch a keyboard message to the desired target.
147 // The default target is the WindowEventDispatcher. For nested message loop
148 // invocations we post a synthetic keyboard message directly into the message
149 // loop. The dispatcher for the nested loop would then decide how this
150 // message is routed.
151 void DispatchKeyboardMessage(ui::EventType type,
152 uint32_t vkey,
153 uint32_t repeat_count,
154 uint32_t scan_code,
155 uint32_t flags,
156 bool is_character);
157
158 // Sets the event flags. |flags| is a bitmask of EventFlags. If there is a
159 // change the system virtual key state is updated as well. This way if chrome
160 // queries for key state it matches that of event being dispatched.
161 void SetEventFlags(uint32_t flags);
162
163 uint32_t mouse_event_flags() const {
164 return event_flags_ & (ui::EF_LEFT_MOUSE_BUTTON |
165 ui::EF_MIDDLE_MOUSE_BUTTON |
166 ui::EF_RIGHT_MOUSE_BUTTON);
167 }
168
169 uint32_t key_event_flags() const {
170 return event_flags_ & (ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN |
171 ui::EF_ALT_DOWN | ui::EF_CAPS_LOCK_ON);
172 }
173
174 HWND remote_window_;
175 IPC::Sender* host_;
176 scoped_ptr<ui::ViewProp> prop_;
177
178 // Incremented if we need to ignore mouse messages until the SetCursorPos
179 // operation is acked by the viewer.
180 int ignore_mouse_moves_until_set_cursor_ack_;
181
182 // Tracking last click event for synthetically generated mouse events.
183 scoped_ptr<ui::MouseEvent> last_mouse_click_event_;
184
185 // State of the keyboard/mouse at the time of the last input event. See
186 // description of SetEventFlags().
187 uint32_t event_flags_;
188
189 // Current size of this root window.
190 gfx::Size window_size_;
191
192 DISALLOW_COPY_AND_ASSIGN(RemoteWindowTreeHostWin);
193 };
194
195 } // namespace aura
196
197 #endif // UI_AURA_REMOTE_WINDOW_TREE_HOST_WIN_H_
OLDNEW
« 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