| 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/feature/compositor/blimp_compositor.h" | 7 #include "blimp/client/feature/compositor/blimp_compositor.h" |
| 8 #include "blimp/client/feature/render_widget_feature.h" | 8 #include "blimp/client/feature/render_widget_feature.h" |
| 9 #include "blimp/client/feature/tab_control_feature.h" | 9 #include "blimp/client/feature/tab_control_feature.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| 11 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
| 12 #include "ui/platform_window/platform_window.h" | 12 #include "ui/platform_window/platform_window.h" |
| 13 #include "ui/platform_window/x11/x11_window.h" | 13 #include "ui/platform_window/x11/x11_window.h" |
| 14 | 14 |
| 15 namespace blimp { | 15 namespace blimp { |
| 16 namespace client { | 16 namespace client { |
| 17 | 17 |
| 18 BlimpDisplayManager::BlimpDisplayManager( | 18 BlimpDisplayManager::BlimpDisplayManager( |
| 19 const gfx::Size& window_size, | 19 const gfx::Size& window_size, |
| 20 BlimpDisplayManagerDelegate* delegate, | 20 BlimpDisplayManagerDelegate* delegate, |
| 21 RenderWidgetFeature* render_widget_feature, | 21 RenderWidgetFeature* render_widget_feature, |
| 22 TabControlFeature* tab_control_feature) | 22 TabControlFeature* tab_control_feature) |
| 23 : device_pixel_ratio_(1.f), | 23 : device_pixel_ratio_(1.f), |
| 24 delegate_(delegate), | 24 delegate_(delegate), |
| 25 tab_control_feature_(tab_control_feature), | 25 tab_control_feature_(tab_control_feature), |
| 26 blimp_compositor_(new BlimpCompositor(1.f, render_widget_feature)), | 26 blimp_compositor_(new BlimpCompositor(1.f, render_widget_feature)), |
| 27 platform_window_(new ui::X11Window(this)) { | 27 platform_window_(new ui::X11Window(this)) { |
| 28 platform_window_->SetBounds(gfx::Rect(window_size)); | 28 platform_window_->SetBounds(gfx::Rect(window_size)); |
| 29 platform_window_->Show(); | 29 platform_window_->Show(); |
| 30 blimp_compositor_->SetSize(window_size); | |
| 31 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), | 30 tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(), |
| 32 device_pixel_ratio_); | 31 device_pixel_ratio_); |
| 33 | 32 |
| 34 blimp_compositor_->SetVisible(true); | 33 blimp_compositor_->SetVisible(true); |
| 35 } | 34 } |
| 36 | 35 |
| 37 BlimpDisplayManager::~BlimpDisplayManager() {} | 36 BlimpDisplayManager::~BlimpDisplayManager() {} |
| 38 | 37 |
| 39 void BlimpDisplayManager::OnBoundsChanged(const gfx::Rect& new_bounds) { | 38 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_); | 39 tab_control_feature_->SetSizeAndScale(new_bounds.size(), device_pixel_ratio_); |
| 42 } | 40 } |
| 43 | 41 |
| 44 void BlimpDisplayManager::OnDamageRect(const gfx::Rect& damaged_region) {} | 42 void BlimpDisplayManager::OnDamageRect(const gfx::Rect& damaged_region) {} |
| 45 | 43 |
| 46 void BlimpDisplayManager::DispatchEvent(ui::Event* event) { | 44 void BlimpDisplayManager::DispatchEvent(ui::Event* event) { |
| 47 // 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 |
| 48 // blink events. | 46 // blink events. |
| 49 } | 47 } |
| 50 | 48 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 75 } | 73 } |
| 76 | 74 |
| 77 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() { | 75 void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() { |
| 78 blimp_compositor_->ReleaseAcceleratedWidget(); | 76 blimp_compositor_->ReleaseAcceleratedWidget(); |
| 79 } | 77 } |
| 80 | 78 |
| 81 void BlimpDisplayManager::OnActivationChanged(bool active) {} | 79 void BlimpDisplayManager::OnActivationChanged(bool active) {} |
| 82 | 80 |
| 83 } // namespace client | 81 } // namespace client |
| 84 } // namespace blimp | 82 } // namespace blimp |
| OLD | NEW |