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