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

Unified Diff: mojo/services/native_viewport/native_viewport_impl.cc

Issue 606883002: Add a headless configuration to Mojo's native viewport service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address jamesr's questions Created 6 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: mojo/services/native_viewport/native_viewport_impl.cc
diff --git a/mojo/services/native_viewport/native_viewport_impl.cc b/mojo/services/native_viewport/native_viewport_impl.cc
index a0ab9993321c63eb23be1c55c6d5f284d1758549..4fce13fccb6e009e86c198f1b70dc99f2b346659 100644
--- a/mojo/services/native_viewport/native_viewport_impl.cc
+++ b/mojo/services/native_viewport/native_viewport_impl.cc
@@ -11,6 +11,7 @@
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/application/interface_factory.h"
+#include "mojo/services/native_viewport/platform_viewport_headless.h"
#include "mojo/services/native_viewport/viewport_surface.h"
#include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
#include "mojo/services/public/cpp/input_events/input_events_type_converters.h"
@@ -28,8 +29,11 @@ bool IsRateLimitedEventType(ui::Event* event) {
} // namespace
-NativeViewportImpl::NativeViewportImpl(ApplicationImpl* app)
- : widget_id_(0u), waiting_for_event_ack_(false), weak_factory_(this) {
+NativeViewportImpl::NativeViewportImpl(ApplicationImpl* app, bool is_headless)
+ : is_headless_(is_headless),
+ widget_id_(0u),
+ waiting_for_event_ack_(false),
+ weak_factory_(this) {
app->ConnectToService("mojo:mojo_surfaces_service", &surfaces_service_);
// TODO(jamesr): Should be mojo_gpu_service
app->ConnectToService("mojo:mojo_native_viewport_service", &gpu_service_);
@@ -42,7 +46,10 @@ NativeViewportImpl::~NativeViewportImpl() {
}
void NativeViewportImpl::Create(SizePtr bounds) {
- platform_viewport_ = PlatformViewport::Create(this);
+ if (is_headless_)
+ platform_viewport_ = PlatformViewportHeadless::Create(this);
+ else
+ platform_viewport_ = PlatformViewport::Create(this);
gfx::Rect rect = gfx::Rect(bounds.To<gfx::Size>());
platform_viewport_->Init(rect);
OnBoundsChanged(rect);
« no previous file with comments | « mojo/services/native_viewport/native_viewport_impl.h ('k') | mojo/services/native_viewport/platform_viewport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698