Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_aura/desktop_root_window_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" |
| 6 | 6 |
| 7 #include "base/win/metro.h" | 7 #include "base/win/metro.h" |
| 8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
| 9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 | 64 |
| 65 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); | 65 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); |
| 66 | 66 |
| 67 // Identifies the DesktopWindowTreeHostWin associated with the RootWindow. | 67 // Identifies the DesktopWindowTreeHostWin associated with the RootWindow. |
| 68 DEFINE_WINDOW_PROPERTY_KEY(DesktopWindowTreeHostWin*, kDesktopWindowTreeHostKey, | 68 DEFINE_WINDOW_PROPERTY_KEY(DesktopWindowTreeHostWin*, kDesktopWindowTreeHostKey, |
| 69 NULL); | 69 NULL); |
| 70 | 70 |
| 71 //////////////////////////////////////////////////////////////////////////////// | 71 //////////////////////////////////////////////////////////////////////////////// |
| 72 // DesktopWindowTreeHostWin, public: | 72 // DesktopWindowTreeHostWin, public: |
| 73 | 73 |
| 74 bool DesktopWindowTreeHostWin::is_cursor_visible_ = true; | |
| 75 | |
| 74 DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( | 76 DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( |
| 75 internal::NativeWidgetDelegate* native_widget_delegate, | 77 internal::NativeWidgetDelegate* native_widget_delegate, |
| 76 DesktopNativeWidgetAura* desktop_native_widget_aura) | 78 DesktopNativeWidgetAura* desktop_native_widget_aura) |
| 77 : root_window_(NULL), | 79 : root_window_(NULL), |
| 78 message_handler_(new HWNDMessageHandler(this)), | 80 message_handler_(new HWNDMessageHandler(this)), |
| 79 native_widget_delegate_(native_widget_delegate), | 81 native_widget_delegate_(native_widget_delegate), |
| 80 desktop_native_widget_aura_(desktop_native_widget_aura), | 82 desktop_native_widget_aura_(desktop_native_widget_aura), |
| 81 content_window_(NULL), | 83 content_window_(NULL), |
| 82 drag_drop_client_(NULL), | 84 drag_drop_client_(NULL), |
| 83 should_animate_window_close_(false), | 85 should_animate_window_close_(false), |
| 84 pending_close_(false), | 86 pending_close_(false), |
| 85 has_non_client_view_(false), | 87 has_non_client_view_(false), |
| 86 tooltip_(NULL), | 88 tooltip_(NULL) { |
| 87 is_cursor_visible_(true) { | |
| 88 } | 89 } |
| 89 | 90 |
| 90 DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() { | 91 DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() { |
| 91 // WARNING: |content_window_| has been destroyed by the time we get here. | 92 // WARNING: |content_window_| has been destroyed by the time we get here. |
| 92 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed( | 93 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed( |
| 93 root_window_); | 94 root_window_); |
| 94 } | 95 } |
| 95 | 96 |
| 96 // static | 97 // static |
| 97 aura::Window* DesktopWindowTreeHostWin::GetContentWindowForHWND(HWND hwnd) { | 98 aura::Window* DesktopWindowTreeHostWin::GetContentWindowForHWND(HWND hwnd) { |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 547 RECT window_rect = root_window_->window()->GetBoundsInScreen().ToRECT(); | 548 RECT window_rect = root_window_->window()->GetBoundsInScreen().ToRECT(); |
| 548 ::ClipCursor(&window_rect); | 549 ::ClipCursor(&window_rect); |
| 549 return true; | 550 return true; |
| 550 } | 551 } |
| 551 | 552 |
| 552 void DesktopWindowTreeHostWin::UnConfineCursor() { | 553 void DesktopWindowTreeHostWin::UnConfineCursor() { |
| 553 ::ClipCursor(NULL); | 554 ::ClipCursor(NULL); |
| 554 } | 555 } |
| 555 | 556 |
| 556 void DesktopWindowTreeHostWin::OnCursorVisibilityChanged(bool show) { | 557 void DesktopWindowTreeHostWin::OnCursorVisibilityChanged(bool show) { |
| 557 if (is_cursor_visible_ == show) | 558 if (is_cursor_visible_ == show) |
|
sky
2014/02/03 20:57:21
What if the destructor is hit and iss_cursor_visib
tdanderson
2014/02/03 22:41:02
Is your concern that I'm not resetting this member
| |
| 558 return; | 559 return; |
| 559 is_cursor_visible_ = show; | 560 is_cursor_visible_ = show; |
| 560 ::ShowCursor(!!show); | 561 ::ShowCursor(!!show); |
| 561 } | 562 } |
| 562 | 563 |
| 563 void DesktopWindowTreeHostWin::MoveCursorTo(const gfx::Point& location) { | 564 void DesktopWindowTreeHostWin::MoveCursorTo(const gfx::Point& location) { |
| 564 POINT cursor_location = location.ToPOINT(); | 565 POINT cursor_location = location.ToPOINT(); |
| 565 ::ClientToScreen(GetHWND(), &cursor_location); | 566 ::ClientToScreen(GetHWND(), &cursor_location); |
| 566 ::SetCursorPos(cursor_location.x, cursor_location.y); | 567 ::SetCursorPos(cursor_location.x, cursor_location.y); |
| 567 } | 568 } |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1012 | 1013 |
| 1013 // static | 1014 // static |
| 1014 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 1015 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
| 1015 internal::NativeWidgetDelegate* native_widget_delegate, | 1016 internal::NativeWidgetDelegate* native_widget_delegate, |
| 1016 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 1017 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 1017 return new DesktopWindowTreeHostWin(native_widget_delegate, | 1018 return new DesktopWindowTreeHostWin(native_widget_delegate, |
| 1018 desktop_native_widget_aura); | 1019 desktop_native_widget_aura); |
| 1019 } | 1020 } |
| 1020 | 1021 |
| 1021 } // namespace views | 1022 } // namespace views |
| OLD | NEW |