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

Unified Diff: mojo/examples/launcher/launcher.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/examples/launcher/launcher.cc
diff --git a/mojo/examples/launcher/launcher.cc b/mojo/examples/launcher/launcher.cc
index 695269936d9868611d7f356d8d6f03f4e2b3e899..bd9d844aca83c9609971fdd51f1c426cfe874fdc 100644
--- a/mojo/examples/launcher/launcher.cc
+++ b/mojo/examples/launcher/launcher.cc
@@ -188,20 +188,18 @@ class LauncherController : public views::TextfieldController {
DISALLOW_COPY_AND_ASSIGN(LauncherController);
};
-class LauncherImpl : public ServiceConnection<Launcher, LauncherImpl>,
+class LauncherImpl : public InterfaceImpl<Launcher>,
public URLReceiver {
public:
- LauncherImpl()
- : launcher_controller_(this),
+ explicit LauncherImpl(Application* app)
+ : app_(app),
+ launcher_controller_(this),
pending_show_(false) {
- }
-
- void Initialize() {
screen_.reset(ScreenMojo::Create());
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
NativeViewportPtr viewport;
- ConnectTo(shell(), "mojo:mojo_native_viewport_service", &viewport);
+ app_->ConnectTo("mojo:mojo_native_viewport_service", &viewport);
window_tree_host_.reset(new WindowTreeHostMojo(
viewport.Pass(), gfx::Rect(50, 50, 450, 60),
@@ -250,6 +248,7 @@ class LauncherImpl : public ServiceConnection<Launcher, LauncherImpl>,
}
}
+ Application* app_;
scoped_ptr<ScreenMojo> screen_;
scoped_ptr<LauncherWindowTreeClient> window_tree_client_;
scoped_ptr<aura::client::FocusClient> focus_client_;
@@ -287,8 +286,7 @@ extern "C" LAUNCHER_EXPORT MojoResult CDECL MojoMain(
aura::Env::CreateInstance(true);
mojo::Application app(shell_handle);
- app.AddServiceConnector(
- new mojo::ServiceConnector<mojo::examples::LauncherImpl>());
+ app.AddService<mojo::examples::LauncherImpl>(&app);
loop.Run();
return MOJO_RESULT_OK;

Powered by Google App Engine
This is Rietveld 408576698