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

Unified Diff: mojo/examples/launcher/launcher.cc

Issue 287143003: Mojo: Internalize ServiceConnector<> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing function 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
« no previous file with comments | « mojo/dbus/dbus_external_service.h ('k') | mojo/mojo_public.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/examples/launcher/launcher.cc
diff --git a/mojo/examples/launcher/launcher.cc b/mojo/examples/launcher/launcher.cc
index e39b3b3869ec19e4bf44e0a55419e257f53468dc..302f30cf3d9277f1e0b8a74a90d34b9a4fb17c94 100644
--- a/mojo/examples/launcher/launcher.cc
+++ b/mojo/examples/launcher/launcher.cc
@@ -188,26 +188,27 @@ 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),
base::Bind(&LauncherImpl::HostContextCreated, base::Unretained(this))));
}
+ // Overridden from InterfaceImpl:
+ virtual void OnConnectionError() OVERRIDE {}
+
private:
// Overridden from Launcher:
virtual void Show() OVERRIDE {
@@ -250,6 +251,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 +289,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;
« no previous file with comments | « mojo/dbus/dbus_external_service.h ('k') | mojo/mojo_public.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698