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

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

Issue 10241005: Make win_aura work without ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
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/root_window_host_win.h" 5 #include "ui/aura/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
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
13 #include "ui/aura/event.h" 13 #include "ui/aura/event.h"
14 #include "ui/aura/root_window.h" 14 #include "ui/aura/root_window.h"
15 #include "ui/base/view_prop.h"
15 16
16 using std::max; 17 using std::max;
17 using std::min; 18 using std::min;
18 19
19 namespace aura { 20 namespace aura {
20 21
21 namespace { 22 namespace {
22 23
24 const char* kRootWindowHostWinKey = "__AURA_ROOT_WINDOW_HOST_WIN__";
25
23 const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) { 26 const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) {
24 switch (native_cursor.native_type()) { 27 switch (native_cursor.native_type()) {
25 case ui::kCursorNull: 28 case ui::kCursorNull:
26 return IDC_ARROW; 29 return IDC_ARROW;
27 case ui::kCursorPointer: 30 case ui::kCursorPointer:
28 return IDC_ARROW; 31 return IDC_ARROW;
29 case ui::kCursorCross: 32 case ui::kCursorCross:
30 return IDC_CROSS; 33 return IDC_CROSS;
31 case ui::kCursorHand: 34 case ui::kCursorHand:
32 return IDC_HAND; 35 return IDC_HAND;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 104 }
102 105
103 } // namespace 106 } // namespace
104 107
105 // static 108 // static
106 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) { 109 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) {
107 return new RootWindowHostWin(bounds); 110 return new RootWindowHostWin(bounds);
108 } 111 }
109 112
110 // static 113 // static
114 RootWindowHost* RootWindowHost::GetForAcceleratedWidget(
115 gfx::AcceleratedWidget accelerated_widget) {
116 return reinterpret_cast<RootWindowHost*>(
117 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostWinKey));
118 }
119
120 // static
111 gfx::Size RootWindowHost::GetNativeScreenSize() { 121 gfx::Size RootWindowHost::GetNativeScreenSize() {
112 return gfx::Size(GetSystemMetrics(SM_CXSCREEN), 122 return gfx::Size(GetSystemMetrics(SM_CXSCREEN),
113 GetSystemMetrics(SM_CYSCREEN)); 123 GetSystemMetrics(SM_CYSCREEN));
114 } 124 }
115 125
116 RootWindowHostWin::RootWindowHostWin(const gfx::Rect& bounds) 126 RootWindowHostWin::RootWindowHostWin(const gfx::Rect& bounds)
117 : root_window_(NULL), 127 : root_window_(NULL),
118 fullscreen_(false), 128 fullscreen_(false),
119 has_capture_(false), 129 has_capture_(false),
120 saved_window_style_(0), 130 saved_window_style_(0),
121 saved_window_ex_style_(0) { 131 saved_window_ex_style_(0) {
122 Init(NULL, bounds); 132 Init(NULL, bounds);
123 SetWindowText(hwnd(), L"aura::RootWindow!"); 133 SetWindowText(hwnd(), L"aura::RootWindow!");
134 prop_.reset(new ui::ViewProp(hwnd(), kRootWindowHostWinKey, this));
124 } 135 }
125 136
126 RootWindowHostWin::~RootWindowHostWin() { 137 RootWindowHostWin::~RootWindowHostWin() {
127 DestroyWindow(hwnd()); 138 DestroyWindow(hwnd());
128 } 139 }
129 140
130 void RootWindowHostWin::SetRootWindow(RootWindow* root_window) { 141 void RootWindowHostWin::SetRootWindow(RootWindow* root_window) {
131 root_window_ = root_window; 142 root_window_ = root_window;
132 } 143 }
133 144
145 RootWindow* RootWindowHostWin::GetRootWindow() {
146 return root_window_;
147 }
148
134 gfx::AcceleratedWidget RootWindowHostWin::GetAcceleratedWidget() { 149 gfx::AcceleratedWidget RootWindowHostWin::GetAcceleratedWidget() {
135 return hwnd(); 150 return hwnd();
136 } 151 }
137 152
138 void RootWindowHostWin::Show() { 153 void RootWindowHostWin::Show() {
139 ShowWindow(hwnd(), SW_SHOWNORMAL); 154 ShowWindow(hwnd(), SW_SHOWNORMAL);
140 } 155 }
141 156
142 void RootWindowHostWin::ToggleFullScreen() { 157 void RootWindowHostWin::ToggleFullScreen() {
143 gfx::Rect target_rect; 158 gfx::Rect target_rect;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 329 }
315 330
316 void RootWindowHostWin::OnSize(UINT param, const CSize& size) { 331 void RootWindowHostWin::OnSize(UINT param, const CSize& size) {
317 // Minimizing resizes the window to 0x0 which causes our layout to go all 332 // Minimizing resizes the window to 0x0 which causes our layout to go all
318 // screwy, so we just ignore it. 333 // screwy, so we just ignore it.
319 if (param != SIZE_MINIMIZED) 334 if (param != SIZE_MINIMIZED)
320 root_window_->OnHostResized(gfx::Size(size.cx, size.cy)); 335 root_window_->OnHostResized(gfx::Size(size.cx, size.cy));
321 } 336 }
322 337
323 } // namespace aura 338 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698