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

Side by Side Diff: ui/views/widget/desktop_root_window_host_win.cc

Issue 10910144: Get mouse events to work with win aura, and make the combobox function in the views examples app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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/views/widget/desktop_root_window_host_win.h ('k') | ui/views/win/hwnd_message_handler.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/views/widget/desktop_root_window_host_win.h" 5 #include "ui/views/widget/desktop_root_window_host_win.h"
6 6
7 #include "ui/aura/desktop/desktop_activation_client.h"
8 #include "ui/aura/desktop/desktop_dispatcher_client.h"
9 #include "ui/aura/focus_manager.h"
7 #include "ui/aura/root_window.h" 10 #include "ui/aura/root_window.h"
11 #include "ui/views/widget/desktop_capture_client.h"
8 #include "ui/views/win/hwnd_message_handler.h" 12 #include "ui/views/win/hwnd_message_handler.h"
9 13
10 namespace views { 14 namespace views {
11 15
12 //////////////////////////////////////////////////////////////////////////////// 16 ////////////////////////////////////////////////////////////////////////////////
13 // DesktopRootWindowHostWin, public: 17 // DesktopRootWindowHostWin, public:
14 18
15 DesktopRootWindowHostWin::DesktopRootWindowHostWin( 19 DesktopRootWindowHostWin::DesktopRootWindowHostWin(
16 internal::NativeWidgetDelegate* native_widget_delegate, 20 internal::NativeWidgetDelegate* native_widget_delegate,
17 const gfx::Rect& initial_bounds) 21 const gfx::Rect& initial_bounds)
(...skipping 15 matching lines...) Expand all
33 // TODO(beng): SetInitParams(). 37 // TODO(beng): SetInitParams().
34 content_window_ = content_window; 38 content_window_ = content_window;
35 message_handler_->Init(NULL, params.bounds); 39 message_handler_->Init(NULL, params.bounds);
36 40
37 aura::RootWindow::CreateParams rw_params(params.bounds); 41 aura::RootWindow::CreateParams rw_params(params.bounds);
38 rw_params.host = this; 42 rw_params.host = this;
39 root_window_.reset(new aura::RootWindow(rw_params)); 43 root_window_.reset(new aura::RootWindow(rw_params));
40 root_window_->Init(); 44 root_window_->Init();
41 root_window_->AddChild(content_window_); 45 root_window_->AddChild(content_window_);
42 root_window_host_delegate_ = root_window_.get(); 46 root_window_host_delegate_ = root_window_.get();
47
48 native_widget_delegate_->OnNativeWidgetCreated();
49
50 capture_client_.reset(new DesktopCaptureClient);
51 aura::client::SetCaptureClient(root_window_.get(), capture_client_.get());
52
53 focus_manager_.reset(new aura::FocusManager);
54 root_window_->set_focus_manager(focus_manager_.get());
55
56 activation_client_.reset(
57 new aura::DesktopActivationClient(root_window_->GetFocusManager()));
58 aura::client::SetActivationClient(root_window_.get(),
59 activation_client_.get());
60
61 dispatcher_client_.reset(new aura::DesktopDispatcherClient);
62 aura::client::SetDispatcherClient(root_window_.get(),
63 dispatcher_client_.get());
64 }
65
66 void DesktopRootWindowHostWin::Close() {
67 message_handler_->Close();
68 }
69
70 void DesktopRootWindowHostWin::CloseNow() {
71 message_handler_->CloseNow();
72 }
73
74 aura::RootWindowHost* DesktopRootWindowHostWin::AsRootWindowHost() {
75 return this;
43 } 76 }
44 77
45 void DesktopRootWindowHostWin::ShowWindowWithState( 78 void DesktopRootWindowHostWin::ShowWindowWithState(
46 ui::WindowShowState show_state) { 79 ui::WindowShowState show_state) {
47 message_handler_->ShowWindowWithState(show_state); 80 message_handler_->ShowWindowWithState(show_state);
48 } 81 }
49 82
83 bool DesktopRootWindowHostWin::IsVisible() const {
84 return message_handler_->IsVisible();
85 }
86
87 gfx::Rect DesktopRootWindowHostWin::GetClientAreaBoundsInScreen() const {
88 return message_handler_->GetClientAreaBoundsInScreen();
89 }
90
50 //////////////////////////////////////////////////////////////////////////////// 91 ////////////////////////////////////////////////////////////////////////////////
51 // DesktopRootWindowHostWin, RootWindowHost implementation: 92 // DesktopRootWindowHostWin, RootWindowHost implementation:
52 93
53 aura::RootWindow* DesktopRootWindowHostWin::GetRootWindow() { 94 aura::RootWindow* DesktopRootWindowHostWin::GetRootWindow() {
54 return root_window_.get(); 95 return root_window_.get();
55 } 96 }
56 97
57 gfx::AcceleratedWidget DesktopRootWindowHostWin::GetAcceleratedWidget() { 98 gfx::AcceleratedWidget DesktopRootWindowHostWin::GetAcceleratedWidget() {
58 return message_handler_->hwnd(); 99 return message_handler_->hwnd();
59 } 100 }
60 101
61 void DesktopRootWindowHostWin::Show() { 102 void DesktopRootWindowHostWin::Show() {
103 message_handler_->Show();
62 } 104 }
63 105
64 void DesktopRootWindowHostWin::Hide() { 106 void DesktopRootWindowHostWin::Hide() {
107 message_handler_->Hide();
65 } 108 }
66 109
67 void DesktopRootWindowHostWin::ToggleFullScreen() { 110 void DesktopRootWindowHostWin::ToggleFullScreen() {
68 } 111 }
69 112
70 gfx::Rect DesktopRootWindowHostWin::GetBounds() const { 113 gfx::Rect DesktopRootWindowHostWin::GetBounds() const {
71 return gfx::Rect(100, 100); 114 return gfx::Rect(100, 100);
72 } 115 }
73 116
74 void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) { 117 void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 290 }
248 291
249 void DesktopRootWindowHostWin::HandleCreate() { 292 void DesktopRootWindowHostWin::HandleCreate() {
250 // TODO(beng): moar 293 // TODO(beng): moar
251 NOTIMPLEMENTED(); 294 NOTIMPLEMENTED();
252 295
253 // 1. Window property association 296 // 1. Window property association
254 // 2. MouseWheel. 297 // 2. MouseWheel.
255 // 3. Drop target. 298 // 3. Drop target.
256 // 4. Tooltip Manager. 299 // 4. Tooltip Manager.
257
258 native_widget_delegate_->OnNativeWidgetCreated();
259 } 300 }
260 301
261 void DesktopRootWindowHostWin::HandleDestroying() { 302 void DesktopRootWindowHostWin::HandleDestroying() {
262 native_widget_delegate_->OnNativeWidgetDestroying(); 303 native_widget_delegate_->OnNativeWidgetDestroying();
263 } 304 }
264 305
265 void DesktopRootWindowHostWin::HandleDestroyed() { 306 void DesktopRootWindowHostWin::HandleDestroyed() {
266 } 307 }
267 308
268 bool DesktopRootWindowHostWin::HandleInitialFocus() { 309 bool DesktopRootWindowHostWin::HandleInitialFocus() {
(...skipping 13 matching lines...) Expand all
282 } 323 }
283 324
284 void DesktopRootWindowHostWin::HandleWorkAreaChanged() { 325 void DesktopRootWindowHostWin::HandleWorkAreaChanged() {
285 } 326 }
286 327
287 void DesktopRootWindowHostWin::HandleVisibilityChanged(bool visible) { 328 void DesktopRootWindowHostWin::HandleVisibilityChanged(bool visible) {
288 } 329 }
289 330
290 void DesktopRootWindowHostWin::HandleClientSizeChanged( 331 void DesktopRootWindowHostWin::HandleClientSizeChanged(
291 const gfx::Size& new_size) { 332 const gfx::Size& new_size) {
292 root_window_host_delegate_->OnHostResized(new_size); 333 if (root_window_host_delegate_)
334 root_window_host_delegate_->OnHostResized(new_size);
293 // TODO(beng): replace with a layout manager?? 335 // TODO(beng): replace with a layout manager??
294 content_window_->SetBounds(gfx::Rect(new_size)); 336 content_window_->SetBounds(gfx::Rect(new_size));
295 } 337 }
296 338
297 void DesktopRootWindowHostWin::HandleFrameChanged() { 339 void DesktopRootWindowHostWin::HandleFrameChanged() {
298 } 340 }
299 341
300 void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) { 342 void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) {
301 } 343 }
302 344
303 void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) { 345 void DesktopRootWindowHostWin::HandleNativeBlur(HWND focused_window) {
304 } 346 }
305 347
306 bool DesktopRootWindowHostWin::HandleMouseEvent(const ui::MouseEvent& event) { 348 bool DesktopRootWindowHostWin::HandleMouseEvent(const ui::MouseEvent& event) {
307 return false; 349 return root_window_host_delegate_->OnHostMouseEvent(
350 const_cast<ui::MouseEvent*>(&event));
308 } 351 }
309 352
310 bool DesktopRootWindowHostWin::HandleKeyEvent(const ui::KeyEvent& event) { 353 bool DesktopRootWindowHostWin::HandleKeyEvent(const ui::KeyEvent& event) {
311 return false; 354 return false;
312 } 355 }
313 356
314 bool DesktopRootWindowHostWin::HandleUntranslatedKeyEvent( 357 bool DesktopRootWindowHostWin::HandleUntranslatedKeyEvent(
315 const ui::KeyEvent& event) { 358 const ui::KeyEvent& event) {
316 return false; 359 return false;
317 } 360 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // DesktopRootWindowHost, public: 410 // DesktopRootWindowHost, public:
368 411
369 // static 412 // static
370 DesktopRootWindowHost* DesktopRootWindowHost::Create( 413 DesktopRootWindowHost* DesktopRootWindowHost::Create(
371 internal::NativeWidgetDelegate* native_widget_delegate, 414 internal::NativeWidgetDelegate* native_widget_delegate,
372 const gfx::Rect& initial_bounds) { 415 const gfx::Rect& initial_bounds) {
373 return new DesktopRootWindowHostWin(native_widget_delegate, initial_bounds); 416 return new DesktopRootWindowHostWin(native_widget_delegate, initial_bounds);
374 } 417 }
375 418
376 } // namespace views 419 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_root_window_host_win.h ('k') | ui/views/win/hwnd_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698