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