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

Side by Side Diff: ui/aura/remote_root_window_host_win.cc

Issue 22876030: Remove using the Shell desktop Window when we don't have an acceleated widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/remote_root_window_host_win.h ('k') | ui/surface/accelerated_surface_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/remote_root_window_host_win.h" 5 #include "ui/aura/remote_root_window_host_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 const FileSelectionCanceled& on_failure) { 101 const FileSelectionCanceled& on_failure) {
102 DCHECK(aura::RemoteRootWindowHostWin::Instance()); 102 DCHECK(aura::RemoteRootWindowHostWin::Instance());
103 aura::RemoteRootWindowHostWin::Instance()->HandleSelectFolder(title, 103 aura::RemoteRootWindowHostWin::Instance()->HandleSelectFolder(title,
104 on_success, 104 on_success,
105 on_failure); 105 on_failure);
106 } 106 }
107 107
108 RemoteRootWindowHostWin* g_instance = NULL; 108 RemoteRootWindowHostWin* g_instance = NULL;
109 109
110 RemoteRootWindowHostWin* RemoteRootWindowHostWin::Instance() { 110 RemoteRootWindowHostWin* RemoteRootWindowHostWin::Instance() {
111 return g_instance; 111 if (g_instance)
112 return g_instance;
113 return Create(gfx::Rect());
112 } 114 }
113 115
114 RemoteRootWindowHostWin* RemoteRootWindowHostWin::Create( 116 RemoteRootWindowHostWin* RemoteRootWindowHostWin::Create(
115 const gfx::Rect& bounds) { 117 const gfx::Rect& bounds) {
116 g_instance = new RemoteRootWindowHostWin(bounds); 118 g_instance = g_instance ? g_instance : new RemoteRootWindowHostWin(bounds);
117 return g_instance; 119 return g_instance;
118 } 120 }
119 121
120 RemoteRootWindowHostWin::RemoteRootWindowHostWin(const gfx::Rect& bounds) 122 RemoteRootWindowHostWin::RemoteRootWindowHostWin(const gfx::Rect& bounds)
121 : delegate_(NULL), 123 : remote_window_(NULL),
124 delegate_(NULL),
122 host_(NULL), 125 host_(NULL),
123 ignore_mouse_moves_until_set_cursor_ack_(false) { 126 ignore_mouse_moves_until_set_cursor_ack_(false) {
124 prop_.reset(new ui::ViewProp(NULL, kRootWindowHostWinKey, this)); 127 prop_.reset(new ui::ViewProp(NULL, kRootWindowHostWinKey, this));
125 } 128 }
126 129
127 RemoteRootWindowHostWin::~RemoteRootWindowHostWin() { 130 RemoteRootWindowHostWin::~RemoteRootWindowHostWin() {
131 g_instance = NULL;
128 } 132 }
129 133
130 void RemoteRootWindowHostWin::Connected(IPC::Sender* host) { 134 void RemoteRootWindowHostWin::Connected(IPC::Sender* host, HWND remote_window) {
131 CHECK(host_ == NULL); 135 CHECK(host_ == NULL);
132 host_ = host; 136 host_ = host;
137 remote_window_ = remote_window;
133 } 138 }
134 139
135 void RemoteRootWindowHostWin::Disconnected() { 140 void RemoteRootWindowHostWin::Disconnected() {
136 CHECK(host_ != NULL); 141 CHECK(host_ != NULL);
137 host_ = NULL; 142 host_ = NULL;
143 remote_window_ = NULL;
138 } 144 }
139 145
140 bool RemoteRootWindowHostWin::OnMessageReceived(const IPC::Message& message) { 146 bool RemoteRootWindowHostWin::OnMessageReceived(const IPC::Message& message) {
141 bool handled = true; 147 bool handled = true;
142 IPC_BEGIN_MESSAGE_MAP(RemoteRootWindowHostWin, message) 148 IPC_BEGIN_MESSAGE_MAP(RemoteRootWindowHostWin, message)
143 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MouseMoved, OnMouseMoved) 149 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MouseMoved, OnMouseMoved)
144 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MouseButton, OnMouseButton) 150 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_MouseButton, OnMouseButton)
145 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_KeyDown, OnKeyDown) 151 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_KeyDown, OnKeyDown)
146 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_KeyUp, OnKeyUp) 152 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_KeyUp, OnKeyUp)
147 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_Character, OnChar) 153 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_Character, OnChar)
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 270
265 void RemoteRootWindowHostWin::SetDelegate(RootWindowHostDelegate* delegate) { 271 void RemoteRootWindowHostWin::SetDelegate(RootWindowHostDelegate* delegate) {
266 delegate_ = delegate; 272 delegate_ = delegate;
267 } 273 }
268 274
269 RootWindow* RemoteRootWindowHostWin::GetRootWindow() { 275 RootWindow* RemoteRootWindowHostWin::GetRootWindow() {
270 return delegate_->AsRootWindow(); 276 return delegate_->AsRootWindow();
271 } 277 }
272 278
273 gfx::AcceleratedWidget RemoteRootWindowHostWin::GetAcceleratedWidget() { 279 gfx::AcceleratedWidget RemoteRootWindowHostWin::GetAcceleratedWidget() {
274 // TODO(cpu): This is bad. Chrome's compositor needs a valid window 280 if (remote_window_)
275 // initially and then later on we swap it. Since the compositor never 281 return remote_window_;
276 // uses this initial window we tell ourselves this hack is ok to get 282 // Getting here should only happen for ash_unittests.exe and related code.
277 // thing off the ground.
278 return ::GetDesktopWindow(); 283 return ::GetDesktopWindow();
279 } 284 }
280 285
281 void RemoteRootWindowHostWin::Show() { 286 void RemoteRootWindowHostWin::Show() {
282 } 287 }
283 288
284 void RemoteRootWindowHostWin::Hide() { 289 void RemoteRootWindowHostWin::Hide() {
285 NOTIMPLEMENTED(); 290 NOTIMPLEMENTED();
286 } 291 }
287 292
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 } else { 574 } else {
570 ui::KeyEvent event(type, 575 ui::KeyEvent event(type,
571 ui::KeyboardCodeForWindowsKeyCode(vkey), 576 ui::KeyboardCodeForWindowsKeyCode(vkey),
572 flags, 577 flags,
573 is_character); 578 is_character);
574 delegate_->OnHostKeyEvent(&event); 579 delegate_->OnHostKeyEvent(&event);
575 } 580 }
576 } 581 }
577 582
578 } // namespace aura 583 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/remote_root_window_host_win.h ('k') | ui/surface/accelerated_surface_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698