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