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