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