OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/platform_window/stub/stub_window.h" | 5 #include "ui/platform_window/stub/stub_window.h" |
6 | 6 |
| 7 #include "ui/gfx/native_widget_types.h" |
7 #include "ui/platform_window/platform_window_delegate.h" | 8 #include "ui/platform_window/platform_window_delegate.h" |
8 | 9 |
9 namespace ui { | 10 namespace ui { |
10 | 11 |
11 StubWindow::StubWindow(PlatformWindowDelegate* delegate) : delegate_(delegate) { | 12 StubWindow::StubWindow( |
12 delegate_->OnAcceleratedWidgetAvailable(gfx::kNullAcceleratedWidget, 1.f); | 13 PlatformWindowDelegate* delegate, gfx::AcceleratedWidget accelerated_widget) |
| 14 : delegate_(delegate) { |
| 15 if (delegate_) |
| 16 delegate_->OnAcceleratedWidgetAvailable(accelerated_widget, 1.f); |
13 } | 17 } |
14 | 18 |
15 StubWindow::~StubWindow() { | 19 StubWindow::~StubWindow() { |
16 } | 20 } |
17 | 21 |
18 void StubWindow::Show() { | 22 void StubWindow::Show() { |
19 } | 23 } |
20 | 24 |
21 void StubWindow::Hide() { | 25 void StubWindow::Hide() { |
22 } | 26 } |
23 | 27 |
24 void StubWindow::Close() { | 28 void StubWindow::Close() { |
25 delegate_->OnClosed(); | 29 if (delegate_) |
| 30 delegate_->OnClosed(); |
26 } | 31 } |
27 | 32 |
28 void StubWindow::SetBounds(const gfx::Rect& bounds) { | 33 void StubWindow::SetBounds(const gfx::Rect& bounds) { |
29 if (bounds_ == bounds) | 34 if (bounds_ == bounds) |
30 return; | 35 return; |
31 bounds_ = bounds; | 36 bounds_ = bounds; |
32 delegate_->OnBoundsChanged(bounds); | 37 if (delegate_) |
| 38 delegate_->OnBoundsChanged(bounds); |
33 } | 39 } |
34 | 40 |
35 gfx::Rect StubWindow::GetBounds() { | 41 gfx::Rect StubWindow::GetBounds() { |
36 return bounds_; | 42 return bounds_; |
37 } | 43 } |
38 | 44 |
39 void StubWindow::SetTitle(const base::string16& title) {} | 45 void StubWindow::SetTitle(const base::string16& title) {} |
40 | 46 |
41 void StubWindow::SetCapture() { | 47 void StubWindow::SetCapture() { |
42 } | 48 } |
(...skipping 20 matching lines...) Expand all Loading... |
63 } | 69 } |
64 | 70 |
65 void StubWindow::ConfineCursorToBounds(const gfx::Rect& bounds) { | 71 void StubWindow::ConfineCursorToBounds(const gfx::Rect& bounds) { |
66 } | 72 } |
67 | 73 |
68 PlatformImeController* StubWindow::GetPlatformImeController() { | 74 PlatformImeController* StubWindow::GetPlatformImeController() { |
69 return nullptr; | 75 return nullptr; |
70 } | 76 } |
71 | 77 |
72 } // namespace ui | 78 } // namespace ui |
OLD | NEW |