Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2707)

Unified Diff: blimp/client/app/linux/blimp_display_manager.cc

Issue 2363153002: Migrate Linux Blimp client to use BlimpClientContext (Closed)
Patch Set: Move compositor creation into display manager. Pull out BlimpDisplayManagerDelegateMain class from … Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/client/app/linux/blimp_display_manager.cc
diff --git a/blimp/client/app/linux/blimp_display_manager.cc b/blimp/client/app/linux/blimp_display_manager.cc
index 5997c4d967aeb835cdcf124de341991e4b649801..c339e7e7aa06ef985a5b69276d9ac06f0707b81f 100644
--- a/blimp/client/app/linux/blimp_display_manager.cc
+++ b/blimp/client/app/linux/blimp_display_manager.cc
@@ -4,12 +4,12 @@
#include "blimp/client/app/linux/blimp_display_manager.h"
+#include "base/memory/ptr_util.h"
#include "blimp/client/app/compositor/browser_compositor.h"
-#include "blimp/client/core/compositor/blimp_compositor_dependencies.h"
-#include "blimp/client/core/compositor/blimp_compositor_manager.h"
-#include "blimp/client/core/contents/tab_control_feature.h"
-#include "blimp/client/core/render_widget/render_widget_feature.h"
-#include "blimp/client/support/compositor/compositor_dependencies_impl.h"
+#include "blimp/client/public/compositor/compositor_dependencies.h"
+#include "blimp/client/public/contents/blimp_contents.h"
+#include "blimp/client/public/contents/blimp_contents_view.h"
+#include "blimp/client/public/contents/blimp_navigation_controller.h"
#include "ui/events/event.h"
#include "ui/events/gesture_detection/motion_event_generic.h"
#include "ui/events/gestures/motion_event_aura.h"
@@ -19,7 +19,6 @@
namespace blimp {
namespace {
-constexpr int kDummyBlimpContentsId = 0;
constexpr int kPointer1Id = 0;
constexpr int kPointer2Id = 1;
constexpr int kZoomOffsetMultiplier = 4;
@@ -30,30 +29,24 @@ namespace client {
BlimpDisplayManager::BlimpDisplayManager(
const gfx::Size& window_size,
BlimpDisplayManagerDelegate* delegate,
- RenderWidgetFeature* render_widget_feature,
- TabControlFeature* tab_control_feature)
+ CompositorDependencies* compositor_dependencies,
+ std::unique_ptr<BlimpContents> contents)
: device_pixel_ratio_(1.f),
delegate_(delegate),
- tab_control_feature_(tab_control_feature),
platform_window_(new ui::X11Window(this)) {
- platform_window_->SetBounds(gfx::Rect(window_size));
+ contents_ = std::move(contents);
David Trainor- moved to gerrit 2016/09/26 20:54:26 Put this in the inline setters: contents_(std::mo
steimel 2016/09/27 17:35:01 Done.
- compositor_dependencies_ = base::MakeUnique<BlimpCompositorDependencies>(
- base::MakeUnique<CompositorDependenciesImpl>());
+ compositor_ = base::MakeUnique<BrowserCompositor>(compositor_dependencies);
- compositor_ = base::MakeUnique<BrowserCompositor>(
- compositor_dependencies_->GetEmbedderDependencies());
- compositor_->SetSize(platform_window_->GetBounds().size());
+ platform_window_->SetBounds(gfx::Rect(window_size));
- compositor_manager_ = base::MakeUnique<BlimpCompositorManager>(
- kDummyBlimpContentsId, render_widget_feature,
- compositor_dependencies_.get());
+ compositor_->SetSize(platform_window_->GetBounds().size());
- compositor_->SetContentLayer(compositor_manager_->layer());
+ compositor_->SetContentLayer(contents_->GetView()->GetLayer());
platform_window_->Show();
- tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(),
+ contents_->GetView()->SetSizeAndScale(platform_window_->GetBounds().size(),
David Trainor- moved to gerrit 2016/09/26 20:54:26 Actually, would it be cleaner to call OnBoundsChan
steimel 2016/09/27 17:35:01 Done.
device_pixel_ratio_);
}
@@ -61,7 +54,7 @@ BlimpDisplayManager::~BlimpDisplayManager() {}
void BlimpDisplayManager::OnBoundsChanged(const gfx::Rect& new_bounds) {
compositor_->SetSize(new_bounds.size());
- tab_control_feature_->SetSizeAndScale(new_bounds.size(), device_pixel_ratio_);
+ contents_->GetView()->SetSizeAndScale(new_bounds.size(), device_pixel_ratio_);
}
void BlimpDisplayManager::DispatchEvent(ui::Event* event) {
@@ -81,7 +74,7 @@ void BlimpDisplayManager::DispatchMotionEventAura(
touch_event_stream->OnTouch(
ui::TouchEvent(event_type, gfx::Point(pointer_x, pointer_y), pointer_id,
base::TimeTicks::Now()));
- compositor_manager_->OnTouchEvent(*touch_event_stream);
+ contents_->GetView()->OnTouchEvent(*touch_event_stream);
}
void BlimpDisplayManager::DispatchMouseWheelEvent(
@@ -148,12 +141,12 @@ void BlimpDisplayManager::DispatchMouseEvent(ui::MouseEvent* mouse_event) {
0);
ui::MotionEventGeneric motion_event(action, mouse_event->time_stamp(),
mouse_properties);
- compositor_manager_->OnTouchEvent(motion_event);
+ contents_->GetView()->OnTouchEvent(motion_event);
}
}
void BlimpDisplayManager::OnCloseRequest() {
- compositor_manager_->SetVisible(false);
+ contents_->Hide();
compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
platform_window_->Close();
}
@@ -167,17 +160,17 @@ void BlimpDisplayManager::OnAcceleratedWidgetAvailable(
gfx::AcceleratedWidget widget,
float device_pixel_ratio) {
device_pixel_ratio_ = device_pixel_ratio;
- tab_control_feature_->SetSizeAndScale(platform_window_->GetBounds().size(),
+ contents_->GetView()->SetSizeAndScale(platform_window_->GetBounds().size(),
device_pixel_ratio_);
if (widget != gfx::kNullAcceleratedWidget) {
- compositor_manager_->SetVisible(true);
+ contents_->Show();
compositor_->SetAcceleratedWidget(widget);
}
}
void BlimpDisplayManager::OnAcceleratedWidgetDestroyed() {
- compositor_manager_->SetVisible(false);
+ contents_->Hide();
compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
}

Powered by Google App Engine
This is Rietveld 408576698