Home | History | Annotate | Download | only in demo_launcher
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "base/basictypes.h"
      6 #include "base/bind.h"
      7 #include "base/run_loop.h"
      8 #include "mojo/public/cpp/application/application.h"
      9 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
     10 
     11 namespace mojo {
     12 namespace examples {
     13 
     14 class DemoLauncher : public Application {
     15  public:
     16   DemoLauncher() {}
     17   virtual ~DemoLauncher() {}
     18 
     19  private:
     20   // Overridden from Application:
     21   virtual void Initialize() MOJO_OVERRIDE {
     22     ConnectTo<view_manager::ViewManagerInitService>("mojo:mojo_view_manager",
     23                                                     &view_manager_init_);
     24     view_manager_init_->EmbedRoot("mojo:mojo_window_manager",
     25                                   base::Bind(&DemoLauncher::OnConnect,
     26                                              base::Unretained(this)));
     27   }
     28 
     29   void OnConnect(bool success) {}
     30 
     31   view_manager::ViewManagerInitServicePtr view_manager_init_;
     32 
     33   DISALLOW_COPY_AND_ASSIGN(DemoLauncher);
     34 };
     35 
     36 }  // namespace examples
     37 
     38 // static
     39 Application* Application::Create() {
     40   return new examples::DemoLauncher;
     41 }
     42 
     43 }  // namespace mojo
     44