OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/native_widget_aura.h" | 5 #include "views/widget/native_widget_aura.h" |
6 | 6 |
7 #include "aura/window.h" | |
8 #include "ui/gfx/canvas.h" | |
9 #include "ui/gfx/compositor/layer.h" | |
10 #include "views/widget/native_widget_delegate.h" | |
11 | |
12 namespace views { | 7 namespace views { |
13 | 8 |
14 //////////////////////////////////////////////////////////////////////////////// | 9 //////////////////////////////////////////////////////////////////////////////// |
15 // NativeWidgetAura, public: | 10 // NativeWidgetAura, public: |
16 | 11 |
17 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate) | 12 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate) { |
18 : delegate_(delegate), | |
19 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))) { | |
20 window_->set_id(1200); | |
21 } | 13 } |
22 | 14 |
23 NativeWidgetAura::~NativeWidgetAura() { | 15 NativeWidgetAura::~NativeWidgetAura() { |
24 } | 16 } |
25 | 17 |
26 //////////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////////// |
27 // NativeWidgetAura, internal::NativeWidgetPrivate implementation: | 19 // NativeWidgetAura, internal::NativeWidgetPrivate implementation: |
28 | 20 |
29 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { | 21 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { |
30 window_->Init(); | |
31 window_->SetBounds(params.bounds, 0); | |
32 window_->SetParent(params.parent); | |
33 // TODO(beng): do this some other way. | |
34 delegate_->OnNativeWidgetSizeChanged(params.bounds.size()); | |
35 window_->SetVisibility(aura::Window::VISIBILITY_SHOWN); | |
36 } | 22 } |
37 | 23 |
38 NonClientFrameView* NativeWidgetAura::CreateNonClientFrameView() { | 24 NonClientFrameView* NativeWidgetAura::CreateNonClientFrameView() { |
39 NOTIMPLEMENTED(); | |
40 return NULL; | 25 return NULL; |
41 } | 26 } |
42 | 27 |
43 void NativeWidgetAura::UpdateFrameAfterFrameChange() { | 28 void NativeWidgetAura::UpdateFrameAfterFrameChange() { |
44 NOTIMPLEMENTED(); | |
45 } | 29 } |
46 | 30 |
47 bool NativeWidgetAura::ShouldUseNativeFrame() const { | 31 bool NativeWidgetAura::ShouldUseNativeFrame() const { |
48 NOTIMPLEMENTED(); | |
49 return false; | 32 return false; |
50 } | 33 } |
51 | 34 |
52 void NativeWidgetAura::FrameTypeChanged() { | 35 void NativeWidgetAura::FrameTypeChanged() { |
53 NOTIMPLEMENTED(); | |
54 } | 36 } |
55 | 37 |
56 Widget* NativeWidgetAura::GetWidget() { | 38 Widget* NativeWidgetAura::GetWidget() { |
57 return delegate_->AsWidget(); | 39 return NULL; |
58 } | 40 } |
59 | 41 |
60 const Widget* NativeWidgetAura::GetWidget() const { | 42 const Widget* NativeWidgetAura::GetWidget() const { |
61 return delegate_->AsWidget(); | 43 return NULL; |
62 } | 44 } |
63 | 45 |
64 gfx::NativeView NativeWidgetAura::GetNativeView() const { | 46 gfx::NativeView NativeWidgetAura::GetNativeView() const { |
65 return window_; | 47 return NULL; |
66 } | 48 } |
67 | 49 |
68 gfx::NativeWindow NativeWidgetAura::GetNativeWindow() const { | 50 gfx::NativeWindow NativeWidgetAura::GetNativeWindow() const { |
69 return window_; | 51 return NULL; |
70 } | 52 } |
71 | 53 |
72 Widget* NativeWidgetAura::GetTopLevelWidget() { | 54 Widget* NativeWidgetAura::GetTopLevelWidget() { |
73 NativeWidgetPrivate* native_widget = GetTopLevelNativeWidget(GetNativeView()); | 55 NativeWidgetPrivate* native_widget = GetTopLevelNativeWidget(GetNativeView()); |
74 return native_widget ? native_widget->GetWidget() : NULL; | 56 return native_widget ? native_widget->GetWidget() : NULL; |
75 } | 57 } |
76 | 58 |
77 const ui::Compositor* NativeWidgetAura::GetCompositor() const { | 59 const ui::Compositor* NativeWidgetAura::GetCompositor() const { |
78 return window_->layer()->compositor(); | 60 return NULL; |
79 } | 61 } |
80 | 62 |
81 ui::Compositor* NativeWidgetAura::GetCompositor() { | 63 ui::Compositor* NativeWidgetAura::GetCompositor() { |
82 return window_->layer()->compositor(); | 64 return NULL; |
83 } | 65 } |
84 | 66 |
85 void NativeWidgetAura::MarkLayerDirty() { | 67 void NativeWidgetAura::MarkLayerDirty() { |
86 NOTIMPLEMENTED(); | |
87 } | 68 } |
88 | 69 |
89 void NativeWidgetAura::CalculateOffsetToAncestorWithLayer(gfx::Point* offset, | 70 void NativeWidgetAura::CalculateOffsetToAncestorWithLayer(gfx::Point* offset, |
90 View** ancestor) { | 71 View** ancestor) { |
91 NOTIMPLEMENTED(); | |
92 } | 72 } |
93 | 73 |
94 void NativeWidgetAura::ViewRemoved(View* view) { | 74 void NativeWidgetAura::ViewRemoved(View* view) { |
95 NOTIMPLEMENTED(); | |
96 } | 75 } |
97 | 76 |
98 void NativeWidgetAura::SetNativeWindowProperty(const char* name, void* value) { | 77 void NativeWidgetAura::SetNativeWindowProperty(const char* name, void* value) { |
99 NOTIMPLEMENTED(); | |
100 } | 78 } |
101 | 79 |
102 void* NativeWidgetAura::GetNativeWindowProperty(const char* name) const { | 80 void* NativeWidgetAura::GetNativeWindowProperty(const char* name) const { |
103 NOTIMPLEMENTED(); | |
104 return NULL; | 81 return NULL; |
105 } | 82 } |
106 | 83 |
107 TooltipManager* NativeWidgetAura::GetTooltipManager() const { | 84 TooltipManager* NativeWidgetAura::GetTooltipManager() const { |
108 NOTIMPLEMENTED(); | |
109 return NULL; | 85 return NULL; |
110 } | 86 } |
111 | 87 |
112 bool NativeWidgetAura::IsScreenReaderActive() const { | 88 bool NativeWidgetAura::IsScreenReaderActive() const { |
113 NOTIMPLEMENTED(); | |
114 return false; | 89 return false; |
115 } | 90 } |
116 | 91 |
117 void NativeWidgetAura::SendNativeAccessibilityEvent( | 92 void NativeWidgetAura::SendNativeAccessibilityEvent( |
118 View* view, | 93 View* view, |
119 ui::AccessibilityTypes::Event event_type) { | 94 ui::AccessibilityTypes::Event event_type) { |
120 NOTIMPLEMENTED(); | |
121 } | 95 } |
122 | 96 |
123 void NativeWidgetAura::SetMouseCapture() { | 97 void NativeWidgetAura::SetMouseCapture() { |
124 NOTIMPLEMENTED(); | |
125 } | 98 } |
126 | 99 |
127 void NativeWidgetAura::ReleaseMouseCapture() { | 100 void NativeWidgetAura::ReleaseMouseCapture() { |
128 NOTIMPLEMENTED(); | |
129 } | 101 } |
130 | 102 |
131 bool NativeWidgetAura::HasMouseCapture() const { | 103 bool NativeWidgetAura::HasMouseCapture() const { |
132 NOTIMPLEMENTED(); | |
133 return false; | 104 return false; |
134 } | 105 } |
135 | 106 |
136 InputMethod* NativeWidgetAura::CreateInputMethod() { | 107 InputMethod* NativeWidgetAura::CreateInputMethod() { |
137 NOTIMPLEMENTED(); | |
138 return NULL; | 108 return NULL; |
139 } | 109 } |
140 | 110 |
141 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { | 111 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { |
142 NOTIMPLEMENTED(); | |
143 } | 112 } |
144 | 113 |
145 void NativeWidgetAura::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, | 114 void NativeWidgetAura::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, |
146 bool* maximized) const { | 115 bool* maximized) const { |
147 NOTIMPLEMENTED(); | |
148 } | 116 } |
149 | 117 |
150 void NativeWidgetAura::SetWindowTitle(const std::wstring& title) { | 118 void NativeWidgetAura::SetWindowTitle(const std::wstring& title) { |
151 NOTIMPLEMENTED(); | |
152 } | 119 } |
153 | 120 |
154 void NativeWidgetAura::SetWindowIcons(const SkBitmap& window_icon, | 121 void NativeWidgetAura::SetWindowIcons(const SkBitmap& window_icon, |
155 const SkBitmap& app_icon) { | 122 const SkBitmap& app_icon) { |
156 NOTIMPLEMENTED(); | |
157 } | 123 } |
158 | 124 |
159 void NativeWidgetAura::SetAccessibleName(const std::wstring& name) { | 125 void NativeWidgetAura::SetAccessibleName(const std::wstring& name) { |
160 NOTIMPLEMENTED(); | |
161 } | 126 } |
162 | 127 |
163 void NativeWidgetAura::SetAccessibleRole(ui::AccessibilityTypes::Role role) { | 128 void NativeWidgetAura::SetAccessibleRole(ui::AccessibilityTypes::Role role) { |
164 NOTIMPLEMENTED(); | |
165 } | 129 } |
166 | 130 |
167 void NativeWidgetAura::SetAccessibleState(ui::AccessibilityTypes::State state) { | 131 void NativeWidgetAura::SetAccessibleState(ui::AccessibilityTypes::State state) { |
168 NOTIMPLEMENTED(); | |
169 } | 132 } |
170 | 133 |
171 void NativeWidgetAura::BecomeModal() { | 134 void NativeWidgetAura::BecomeModal() { |
172 NOTIMPLEMENTED(); | |
173 } | 135 } |
174 | 136 |
175 gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const { | 137 gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const { |
176 // TODO(beng): ensure screen bounds | 138 return gfx::Rect(); |
177 return window_->bounds(); | |
178 } | 139 } |
179 | 140 |
180 gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const { | 141 gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const { |
181 // TODO(beng): | 142 return gfx::Rect(); |
182 return window_->bounds(); | |
183 } | 143 } |
184 | 144 |
185 gfx::Rect NativeWidgetAura::GetRestoredBounds() const { | 145 gfx::Rect NativeWidgetAura::GetRestoredBounds() const { |
186 // TODO(beng): | 146 return gfx::Rect(); |
187 return window_->bounds(); | |
188 } | 147 } |
189 | 148 |
190 void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { | 149 void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { |
191 window_->SetBounds(bounds, 0); | |
192 } | 150 } |
193 | 151 |
194 void NativeWidgetAura::SetSize(const gfx::Size& size) { | 152 void NativeWidgetAura::SetSize(const gfx::Size& size) { |
195 window_->SetBounds(gfx::Rect(window_->bounds().origin(), size), 0); | |
196 } | 153 } |
197 | 154 |
198 void NativeWidgetAura::SetBoundsConstrained(const gfx::Rect& bounds, | 155 void NativeWidgetAura::SetBoundsConstrained(const gfx::Rect& bounds, |
199 Widget* other_widget) { | 156 Widget* other_widget) { |
200 NOTIMPLEMENTED(); | |
201 } | 157 } |
202 | 158 |
203 void NativeWidgetAura::MoveAbove(gfx::NativeView native_view) { | 159 void NativeWidgetAura::MoveAbove(gfx::NativeView native_view) { |
204 NOTIMPLEMENTED(); | |
205 } | 160 } |
206 | 161 |
207 void NativeWidgetAura::MoveToTop() { | 162 void NativeWidgetAura::MoveToTop() { |
208 NOTIMPLEMENTED(); | 163 NOTIMPLEMENTED(); |
209 } | 164 } |
210 | 165 |
211 void NativeWidgetAura::SetShape(gfx::NativeRegion region) { | 166 void NativeWidgetAura::SetShape(gfx::NativeRegion region) { |
212 NOTIMPLEMENTED(); | |
213 } | 167 } |
214 | 168 |
215 void NativeWidgetAura::Close() { | 169 void NativeWidgetAura::Close() { |
216 NOTIMPLEMENTED(); | |
217 } | 170 } |
218 | 171 |
219 void NativeWidgetAura::CloseNow() { | 172 void NativeWidgetAura::CloseNow() { |
220 NOTIMPLEMENTED(); | |
221 } | 173 } |
222 | 174 |
223 void NativeWidgetAura::EnableClose(bool enable) { | 175 void NativeWidgetAura::EnableClose(bool enable) { |
224 NOTIMPLEMENTED(); | |
225 } | 176 } |
226 | 177 |
227 void NativeWidgetAura::Show() { | 178 void NativeWidgetAura::Show() { |
228 window_->SetVisibility(aura::Window::VISIBILITY_SHOWN); | |
229 } | 179 } |
230 | 180 |
231 void NativeWidgetAura::Hide() { | 181 void NativeWidgetAura::Hide() { |
232 window_->SetVisibility(aura::Window::VISIBILITY_HIDDEN); | |
233 } | 182 } |
234 | 183 |
235 void NativeWidgetAura::ShowMaximizedWithBounds( | 184 void NativeWidgetAura::ShowMaximizedWithBounds( |
236 const gfx::Rect& restored_bounds) { | 185 const gfx::Rect& restored_bounds) { |
237 NOTIMPLEMENTED(); | |
238 } | 186 } |
239 | 187 |
240 void NativeWidgetAura::ShowWithState(ShowState state) { | 188 void NativeWidgetAura::ShowWithState(ShowState state) { |
241 NOTIMPLEMENTED(); | |
242 } | 189 } |
243 | 190 |
244 bool NativeWidgetAura::IsVisible() const { | 191 bool NativeWidgetAura::IsVisible() const { |
245 return window_->visibility() != aura::Window::VISIBILITY_HIDDEN; | 192 return false; |
246 } | 193 } |
247 | 194 |
248 void NativeWidgetAura::Activate() { | 195 void NativeWidgetAura::Activate() { |
249 NOTIMPLEMENTED(); | |
250 } | 196 } |
251 | 197 |
252 void NativeWidgetAura::Deactivate() { | 198 void NativeWidgetAura::Deactivate() { |
253 NOTIMPLEMENTED(); | |
254 } | 199 } |
255 | 200 |
256 bool NativeWidgetAura::IsActive() const { | 201 bool NativeWidgetAura::IsActive() const { |
257 NOTIMPLEMENTED(); | |
258 return false; | 202 return false; |
259 } | 203 } |
260 | 204 |
261 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { | 205 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { |
262 NOTIMPLEMENTED(); | |
263 } | 206 } |
264 | 207 |
265 void NativeWidgetAura::Maximize() { | 208 void NativeWidgetAura::Maximize() { |
266 NOTIMPLEMENTED(); | |
267 } | 209 } |
268 | 210 |
269 void NativeWidgetAura::Minimize() { | 211 void NativeWidgetAura::Minimize() { |
270 NOTIMPLEMENTED(); | |
271 } | 212 } |
272 | 213 |
273 bool NativeWidgetAura::IsMaximized() const { | 214 bool NativeWidgetAura::IsMaximized() const { |
274 NOTIMPLEMENTED(); | |
275 return false; | 215 return false; |
276 } | 216 } |
277 | 217 |
278 bool NativeWidgetAura::IsMinimized() const { | 218 bool NativeWidgetAura::IsMinimized() const { |
279 NOTIMPLEMENTED(); | |
280 return false; | 219 return false; |
281 } | 220 } |
282 | 221 |
283 void NativeWidgetAura::Restore() { | 222 void NativeWidgetAura::Restore() { |
284 NOTIMPLEMENTED(); | |
285 } | 223 } |
286 | 224 |
287 void NativeWidgetAura::SetFullscreen(bool fullscreen) { | 225 void NativeWidgetAura::SetFullscreen(bool fullscreen) { |
288 NOTIMPLEMENTED(); | |
289 } | 226 } |
290 | 227 |
291 bool NativeWidgetAura::IsFullscreen() const { | 228 bool NativeWidgetAura::IsFullscreen() const { |
292 NOTIMPLEMENTED(); | |
293 return false; | 229 return false; |
294 } | 230 } |
295 | 231 |
296 void NativeWidgetAura::SetOpacity(unsigned char opacity) { | 232 void NativeWidgetAura::SetOpacity(unsigned char opacity) { |
297 NOTIMPLEMENTED(); | |
298 } | 233 } |
299 | 234 |
300 void NativeWidgetAura::SetUseDragFrame(bool use_drag_frame) { | 235 void NativeWidgetAura::SetUseDragFrame(bool use_drag_frame) { |
301 NOTIMPLEMENTED(); | |
302 } | 236 } |
303 | 237 |
304 bool NativeWidgetAura::IsAccessibleWidget() const { | 238 bool NativeWidgetAura::IsAccessibleWidget() const { |
305 NOTIMPLEMENTED(); | |
306 return false; | 239 return false; |
307 } | 240 } |
308 | 241 |
309 void NativeWidgetAura::RunShellDrag(View* view, | 242 void NativeWidgetAura::RunShellDrag(View* view, |
310 const ui::OSExchangeData& data, | 243 const ui::OSExchangeData& data, |
311 int operation) { | 244 int operation) { |
312 NOTIMPLEMENTED(); | |
313 } | 245 } |
314 | 246 |
315 void NativeWidgetAura::SchedulePaintInRect(const gfx::Rect& rect) { | 247 void NativeWidgetAura::SchedulePaintInRect(const gfx::Rect& rect) { |
316 NOTIMPLEMENTED(); | |
317 } | 248 } |
318 | 249 |
319 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { | 250 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { |
320 NOTIMPLEMENTED(); | |
321 } | 251 } |
322 | 252 |
323 void NativeWidgetAura::ClearNativeFocus() { | 253 void NativeWidgetAura::ClearNativeFocus() { |
324 NOTIMPLEMENTED(); | |
325 } | 254 } |
326 | 255 |
327 void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) { | 256 void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) { |
328 NOTIMPLEMENTED(); | |
329 } | 257 } |
330 | 258 |
331 bool NativeWidgetAura::ConvertPointFromAncestor(const Widget* ancestor, | 259 bool NativeWidgetAura::ConvertPointFromAncestor(const Widget* ancestor, |
332 gfx::Point* point) const { | 260 gfx::Point* point) const { |
333 NOTIMPLEMENTED(); | 261 NOTREACHED(); |
334 return false; | 262 return false; |
335 } | 263 } |
336 | 264 |
337 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { | 265 void NativeWidgetAura::DispatchKeyEventPostIME(const KeyEvent& key) { |
338 NOTIMPLEMENTED(); | |
339 } | 266 } |
340 | 267 |
341 //////////////////////////////////////////////////////////////////////////////// | |
342 // NativeWidgetAura, aura::WindowDelegate implementation: | |
343 | |
344 void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) { | |
345 delegate_->OnNativeWidgetPaint(canvas); | |
346 } | |
347 | |
348 //////////////////////////////////////////////////////////////////////////////// | |
349 // Widget, public: | |
350 | |
351 // static | |
352 void Widget::NotifyLocaleChanged() { | |
353 NOTIMPLEMENTED(); | |
354 } | |
355 | |
356 // static | |
357 void Widget::CloseAllSecondaryWidgets() { | |
358 NOTIMPLEMENTED(); | |
359 } | |
360 | |
361 bool Widget::ConvertRect(const Widget* source, | |
362 const Widget* target, | |
363 gfx::Rect* rect) { | |
364 return false; | |
365 } | |
366 | |
367 | |
368 | |
369 namespace internal { | |
370 | |
371 //////////////////////////////////////////////////////////////////////////////// | |
372 // internal::NativeWidgetPrivate, public: | |
373 | |
374 // static | |
375 NativeWidgetPrivate* NativeWidgetPrivate::CreateNativeWidget( | |
376 internal::NativeWidgetDelegate* delegate) { | |
377 return new NativeWidgetAura(delegate); | |
378 } | |
379 | |
380 // static | |
381 NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeView( | |
382 gfx::NativeView native_view) { | |
383 NOTIMPLEMENTED(); | |
384 return NULL; | |
385 } | |
386 | |
387 // static | |
388 NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeWindow( | |
389 gfx::NativeWindow native_window) { | |
390 NOTIMPLEMENTED(); | |
391 return NULL; | |
392 } | |
393 | |
394 // static | |
395 NativeWidgetPrivate* NativeWidgetPrivate::GetTopLevelNativeWidget( | |
396 gfx::NativeView native_view) { | |
397 NOTIMPLEMENTED(); | |
398 return NULL; | |
399 } | |
400 | |
401 // static | |
402 void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view, | |
403 Widget::Widgets* children) { | |
404 NOTIMPLEMENTED(); | |
405 } | |
406 | |
407 // static | |
408 void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, | |
409 gfx::NativeView new_parent) { | |
410 NOTIMPLEMENTED(); | |
411 } | |
412 | |
413 // static | |
414 bool NativeWidgetPrivate::IsMouseButtonDown() { | |
415 NOTIMPLEMENTED(); | |
416 return false; | |
417 } | |
418 | |
419 } // namespace internal | |
420 } // namespace views | 268 } // namespace views |
OLD | NEW |