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/app/compositor/browser_compositor.h" | 7 #include "blimp/client/app/compositor/browser_compositor.h" |
8 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" | 8 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" |
9 #include "blimp/client/core/compositor/blimp_compositor_manager.h" | 9 #include "blimp/client/core/compositor/blimp_compositor_manager.h" |
10 #include "blimp/client/core/contents/tab_control_feature.h" | 10 #include "blimp/client/core/contents/tab_control_feature.h" |
11 #include "blimp/client/core/render_widget/render_widget_feature.h" | 11 #include "blimp/client/core/render_widget/render_widget_feature.h" |
12 #include "blimp/client/support/compositor/compositor_dependencies_impl.h" | 12 #include "blimp/client/support/compositor/compositor_dependencies_impl.h" |
13 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
14 #include "ui/events/gesture_detection/motion_event_generic.h" | 14 #include "ui/events/gesture_detection/motion_event_generic.h" |
15 #include "ui/events/gestures/motion_event_aura.h" | 15 #include "ui/events/gestures/motion_event_aura.h" |
16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
17 #include "ui/platform_window/platform_window.h" | 17 #include "ui/platform_window/platform_window.h" |
18 #include "ui/platform_window/x11/x11_window.h" | 18 #include "ui/platform_window/x11/x11_window.h" |
19 | 19 |
20 namespace blimp { | 20 namespace blimp { |
21 namespace { | 21 namespace { |
| 22 constexpr int kDummyBlimpContentsId = 0; |
22 constexpr int kPointer1Id = 0; | 23 constexpr int kPointer1Id = 0; |
23 constexpr int kPointer2Id = 1; | 24 constexpr int kPointer2Id = 1; |
24 constexpr int kZoomOffsetMultiplier = 4; | 25 constexpr int kZoomOffsetMultiplier = 4; |
25 } // namespace | 26 } // namespace |
26 | 27 |
27 namespace client { | 28 namespace client { |
28 | 29 |
29 BlimpDisplayManager::BlimpDisplayManager( | 30 BlimpDisplayManager::BlimpDisplayManager( |
30 const gfx::Size& window_size, | 31 const gfx::Size& window_size, |
31 BlimpDisplayManagerDelegate* delegate, | 32 BlimpDisplayManagerDelegate* delegate, |
32 RenderWidgetFeature* render_widget_feature, | 33 RenderWidgetFeature* render_widget_feature, |
33 TabControlFeature* tab_control_feature) | 34 TabControlFeature* tab_control_feature) |
34 : device_pixel_ratio_(1.f), | 35 : device_pixel_ratio_(1.f), |
35 delegate_(delegate), | 36 delegate_(delegate), |
36 tab_control_feature_(tab_control_feature), | 37 tab_control_feature_(tab_control_feature), |
37 platform_window_(new ui::X11Window(this)) { | 38 platform_window_(new ui::X11Window(this)) { |
38 platform_window_->SetBounds(gfx::Rect(window_size)); | 39 platform_window_->SetBounds(gfx::Rect(window_size)); |
39 | 40 |
40 compositor_dependencies_ = base::MakeUnique<BlimpCompositorDependencies>( | 41 compositor_dependencies_ = base::MakeUnique<BlimpCompositorDependencies>( |
41 base::MakeUnique<CompositorDependenciesImpl>()); | 42 base::MakeUnique<CompositorDependenciesImpl>()); |
42 | 43 |
43 compositor_ = base::MakeUnique<BrowserCompositor>( | 44 compositor_ = base::MakeUnique<BrowserCompositor>( |
44 compositor_dependencies_->GetEmbedderDependencies()); | 45 compositor_dependencies_->GetEmbedderDependencies()); |
45 compositor_->SetSize(platform_window_->GetBounds().size()); | 46 compositor_->SetSize(platform_window_->GetBounds().size()); |
46 | 47 |
47 compositor_manager_ = base::MakeUnique<BlimpCompositorManager>( | 48 compositor_manager_ = base::MakeUnique<BlimpCompositorManager>( |
48 render_widget_feature, compositor_dependencies_.get()); | 49 kDummyBlimpContentsId, render_widget_feature, |
| 50 compositor_dependencies_.get()); |
49 | 51 |
50 compositor_->SetContentLayer(compositor_manager_->layer()); | 52 compositor_->SetContentLayer(compositor_manager_->layer()); |
51 | 53 |
52 platform_window_->Show(); | 54 platform_window_->Show(); |
53 | 55 |
54 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), | 56 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), |
55 device_pixel_ratio_); | 57 device_pixel_ratio_); |
56 } | 58 } |
57 | 59 |
58 BlimpDisplayManager::~BlimpDisplayManager() {} | 60 BlimpDisplayManager::~BlimpDisplayManager() {} |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 176 } |
175 } | 177 } |
176 | 178 |
177 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() { | 179 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() { |
178 compositor_manager_->SetVisible(false); | 180 compositor_manager_->SetVisible(false); |
179 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); | 181 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); |
180 } | 182 } |
181 | 183 |
182 } // namespace client | 184 } // namespace client |
183 } // namespace blimp | 185 } // namespace blimp |
OLD | NEW |