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 "blimp/client/app/linux/blimp_display_manager.h" | 5 #include "blimp/client/app/linux/blimp_display_manager.h" |
6 | 6 |
7 #include "blimp/client/core/contents/tab_control_feature.h" | 7 #include "blimp/client/core/contents/tab_control_feature.h" |
8 #include "blimp/client/feature/render_widget_feature.h" | 8 #include "blimp/client/core/render_widget/render_widget_feature.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
11 #include "ui/platform_window/platform_window.h" | 11 #include "ui/platform_window/platform_window.h" |
12 #include "ui/platform_window/x11/x11_window.h" | 12 #include "ui/platform_window/x11/x11_window.h" |
13 | 13 |
14 namespace blimp { | 14 namespace blimp { |
15 namespace client { | 15 namespace client { |
16 | 16 |
17 BlimpDisplayManager::BlimpDisplayManager( | 17 BlimpDisplayManager::BlimpDisplayManager( |
18 const gfx::Size& window_size, | 18 const gfx::Size& window_size, |
19 BlimpDisplayManagerDelegate* delegate, | 19 BlimpDisplayManagerDelegate* delegate, |
20 RenderWidgetFeature* render_widget_feature, | 20 RenderWidgetFeature* render_widget_feature, |
21 TabControlFeature* tab_control_feature) | 21 TabControlFeature* tab_control_feature) |
22 : device_pixel_ratio_(1.f), | 22 : device_pixel_ratio_(1.f), |
23 delegate_(delegate), | 23 delegate_(delegate), |
24 tab_control_feature_(tab_control_feature), | 24 tab_control_feature_(tab_control_feature), |
25 blimp_compositor_manager_( | 25 blimp_contents_manager_(true, render_widget_feature), |
26 new BlimpCompositorManager(render_widget_feature, this)), | |
27 platform_window_(new ui::X11Window(this)) { | 26 platform_window_(new ui::X11Window(this)) { |
28 platform_window_->SetBounds(gfx::Rect(window_size)); | 27 platform_window_->SetBounds(gfx::Rect(window_size)); |
29 platform_window_->Show(); | 28 platform_window_->Show(); |
30 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), | 29 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), |
31 device_pixel_ratio_); | 30 device_pixel_ratio_); |
32 | 31 |
33 blimp_compositor_manager_->SetVisible(true); | 32 blimp_contents_ = blimp_contents_manager_.CreateBlimpContents(); |
| 33 blimp_contents_->SetVisible(true); |
34 } | 34 } |
35 | 35 |
36 BlimpDisplayManager::~BlimpDisplayManager() {} | 36 BlimpDisplayManager::~BlimpDisplayManager() {} |
37 | 37 |
38 void BlimpDisplayManager::OnBoundsChanged(const gfx::Rect& new_bounds) { | 38 void BlimpDisplayManager::OnBoundsChanged(const gfx::Rect& new_bounds) { |
39 tab_control_feature_->SetSizeAndScale(new_bounds.size(), device_pixel_ratio_); | 39 tab_control_feature_->SetSizeAndScale(new_bounds.size(), device_pixel_ratio_); |
40 } | 40 } |
41 | 41 |
42 void BlimpDisplayManager::OnDamageRect(const gfx::Rect& damaged_region) {} | 42 void BlimpDisplayManager::OnDamageRect(const gfx::Rect& damaged_region) {} |
43 | 43 |
44 void BlimpDisplayManager::DispatchEvent(ui::Event* event) { | 44 void BlimpDisplayManager::DispatchEvent(ui::Event* event) { |
45 // TODO(dtrainor): Look into using web_input_event_aura to translate these to | 45 // TODO(dtrainor): Look into using web_input_event_aura to translate these to |
46 // blink events. | 46 // blink events. |
47 } | 47 } |
48 | 48 |
49 void BlimpDisplayManager::OnCloseRequest() { | 49 void BlimpDisplayManager::OnCloseRequest() { |
50 blimp_compositor_manager_->SetVisible(false); | 50 blimp_contents_->SetVisible(false); |
51 platform_window_->Close(); | 51 platform_window_->Close(); |
52 } | 52 } |
53 | 53 |
54 void BlimpDisplayManager::OnClosed() { | 54 void BlimpDisplayManager::OnClosed() { |
55 if (delegate_) | 55 if (delegate_) |
56 delegate_->OnClosed(); | 56 delegate_->OnClosed(); |
57 } | 57 } |
58 | 58 |
59 void BlimpDisplayManager::OnWindowStateChanged( | 59 void BlimpDisplayManager::OnWindowStateChanged( |
60 ui::PlatformWindowState new_state) {} | 60 ui::PlatformWindowState new_state) {} |
61 | 61 |
62 void BlimpDisplayManager::OnLostCapture() {} | 62 void BlimpDisplayManager::OnLostCapture() {} |
63 | 63 |
64 void BlimpDisplayManager::OnAcceleratedWidgetAvailable( | 64 void BlimpDisplayManager::OnAcceleratedWidgetAvailable( |
65 gfx::AcceleratedWidget widget, | 65 gfx::AcceleratedWidget widget, |
66 float device_pixel_ratio) { | 66 float device_pixel_ratio) { |
67 device_pixel_ratio_ = device_pixel_ratio; | 67 device_pixel_ratio_ = device_pixel_ratio; |
68 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), | 68 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), |
69 device_pixel_ratio_); | 69 device_pixel_ratio_); |
70 | 70 |
71 if (widget != gfx::kNullAcceleratedWidget) | 71 if (widget != gfx::kNullAcceleratedWidget) |
72 blimp_compositor_manager_->SetAcceleratedWidget(widget); | 72 blimp_contents_->SetAcceleratedWidget(widget); |
73 } | 73 } |
74 | 74 |
75 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() { | 75 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() { |
76 blimp_compositor_manager_->ReleaseAcceleratedWidget(); | 76 blimp_contents_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); |
77 } | 77 } |
78 | 78 |
79 void BlimpDisplayManager::OnActivationChanged(bool active) {} | 79 void BlimpDisplayManager::OnActivationChanged(bool active) {} |
80 | 80 |
81 void BlimpDisplayManager::OnSwapBuffersCompleted() {} | |
82 | |
83 void BlimpDisplayManager::DidCommitAndDrawFrame() {} | |
84 | |
85 } // namespace client | 81 } // namespace client |
86 } // namespace blimp | 82 } // namespace blimp |
OLD | NEW |