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

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

Issue 275363002: Internalize ServiceConnector<> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add OnConnectionEstablished() Created 6 years, 7 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_service.cc
diff --git a/mojo/services/native_viewport/native_viewport_service.cc b/mojo/services/native_viewport/native_viewport_service.cc
index 0118208ce7349ace151d8899f48495c9eb461ff9..1b82cf9ac0489173f148364206146594b4cedc52 100644
--- a/mojo/services/native_viewport/native_viewport_service.cc
+++ b/mojo/services/native_viewport/native_viewport_service.cc
@@ -28,13 +28,12 @@ bool IsRateLimitedEventType(ui::Event* event) {
}
class NativeViewportImpl
- : public ServiceConnection<mojo::NativeViewport,
- NativeViewportImpl,
- shell::Context>,
+ : public InterfaceImpl<mojo::NativeViewport>,
public NativeViewportDelegate {
public:
- NativeViewportImpl()
- : widget_(gfx::kNullAcceleratedWidget),
+ NativeViewportImpl(shell::Context* context)
+ : context_(context),
+ widget_(gfx::kNullAcceleratedWidget),
waiting_for_event_ack_(false) {}
virtual ~NativeViewportImpl() {
// Destroy the NativeViewport early on as it may call us back during
@@ -42,9 +41,11 @@ class NativeViewportImpl
native_viewport_.reset();
}
+ virtual void OnConnectionError() OVERRIDE {}
+
virtual void Create(const Rect& bounds) OVERRIDE {
native_viewport_ =
- services::NativeViewport::Create(context(), this);
+ services::NativeViewport::Create(context_, this);
native_viewport_->Init(bounds);
client()->OnCreated();
OnBoundsChanged(bounds);
@@ -174,6 +175,7 @@ class NativeViewportImpl
}
private:
+ shell::Context* context_;
gfx::AcceleratedWidget widget_;
scoped_ptr<services::NativeViewport> native_viewport_;
ScopedMessagePipeHandle command_buffer_handle_;
@@ -189,9 +191,7 @@ MOJO_NATIVE_VIEWPORT_EXPORT mojo::Application*
CreateNativeViewportService(mojo::shell::Context* context,
mojo::ScopedMessagePipeHandle shell_handle) {
mojo::Application* app = new mojo::Application(shell_handle.Pass());
- app->AddServiceConnector(
- new mojo::ServiceConnector<mojo::services::NativeViewportImpl,
- mojo::shell::Context>(context));
+ app->AddService<mojo::services::NativeViewportImpl>(context);
return app;
}

Powered by Google App Engine
This is Rietveld 408576698