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

Unified Diff: components/view_manager/native_viewport/platform_viewport_x11.cc

Issue 1149083010: Mandoline: Remove native_viewport.mojom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Windows Build I hope Created 5 years, 6 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: components/view_manager/native_viewport/platform_viewport_x11.cc
diff --git a/components/view_manager/native_viewport/platform_viewport_x11.cc b/components/view_manager/native_viewport/platform_viewport_x11.cc
index d0f6976700b6dc6100746135261c4646eec05033..c661fb5c09edd68517aabb711d8fca8b8efccf2c 100644
--- a/components/view_manager/native_viewport/platform_viewport_x11.cc
+++ b/components/view_manager/native_viewport/platform_viewport_x11.cc
@@ -6,6 +6,8 @@
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
+#include "components/view_manager/native_viewport/platform_viewport_headless.h"
+#include "components/view_manager/public/interfaces/view_manager.mojom.h"
#include "mojo/converters/geometry/geometry_type_converters.h"
#include "mojo/converters/input_events/input_events_type_converters.h"
#include "mojo/converters/input_events/mojo_extended_key_event_data.h"
@@ -49,7 +51,7 @@ class PlatformViewportX11 : public PlatformViewport,
metrics_ = mojo::ViewportMetrics::New();
// TODO(sky): make density real.
metrics_->device_pixel_ratio = 1.f;
- metrics_->size = mojo::Size::From(bounds.size());
+ metrics_->size_in_pixels = mojo::Size::From(bounds.size());
platform_window_.reset(new ui::X11Window(this));
platform_window_->SetBounds(bounds);
@@ -61,7 +63,9 @@ class PlatformViewportX11 : public PlatformViewport,
void Close() override { platform_window_->Close(); }
- gfx::Size GetSize() override { return metrics_->size.To<gfx::Size>(); }
+ gfx::Size GetSize() override {
+ return metrics_->size_in_pixels.To<gfx::Size>();
+ }
void SetBounds(const gfx::Rect& bounds) override {
platform_window_->SetBounds(bounds);
@@ -69,8 +73,9 @@ class PlatformViewportX11 : public PlatformViewport,
// ui::PlatformWindowDelegate:
void OnBoundsChanged(const gfx::Rect& new_bounds) override {
- metrics_->size = mojo::Size::From(new_bounds.size());
- delegate_->OnMetricsChanged(metrics_.Clone());
+ // TODO(fsamuel): Use the real device_scale_factor.
+ delegate_->OnMetricsChanged(new_bounds.size(),
+ 1.f /* device_scale_factor */);
}
void OnDamageRect(const gfx::Rect& damaged_region) override {}
@@ -158,7 +163,10 @@ class PlatformViewportX11 : public PlatformViewport,
};
// static
-scoped_ptr<PlatformViewport> PlatformViewport::Create(Delegate* delegate) {
+scoped_ptr<PlatformViewport> PlatformViewport::Create(Delegate* delegate,
+ bool headless) {
+ if (headless)
+ return PlatformViewportHeadless::Create(delegate);
return make_scoped_ptr(new PlatformViewportX11(delegate));
}
« no previous file with comments | « components/view_manager/native_viewport/platform_viewport_win.cc ('k') | components/view_manager/public/cpp/lib/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698