From a2a3e7ce17671c6c1ec93474ee9eecd7d63b3cbc Mon Sep 17 00:00:00 2001 From: "davemoore@chromium.org" Date: Thu, 29 May 2014 16:58:53 +0000 Subject: Support MojoMain() in an Application context BUG= R=darin@chromium.org Review URL: https://codereview.chromium.org/302773005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273503 0039d316-1c4b-4281-b951-d872f2087c98 --- mojo/examples/aura_demo/aura_demo.cc | 44 +++++++++++------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) (limited to 'mojo/examples/aura_demo') diff --git a/mojo/examples/aura_demo/aura_demo.cc b/mojo/examples/aura_demo/aura_demo.cc index 7e4ec8c..062800c 100644 --- a/mojo/examples/aura_demo/aura_demo.cc +++ b/mojo/examples/aura_demo/aura_demo.cc @@ -5,9 +5,6 @@ #include #include -#include "base/at_exit.h" -#include "base/command_line.h" -#include "base/message_loop/message_loop.h" #include "mojo/aura/screen_mojo.h" #include "mojo/aura/window_tree_host_mojo.h" #include "mojo/public/cpp/application/application.h" @@ -24,16 +21,6 @@ #include "ui/base/hit_test.h" #include "ui/gfx/canvas.h" -#if defined(WIN32) -#if !defined(CDECL) -#define CDECL __cdecl -#endif -#define AURA_DEMO_EXPORT __declspec(dllexport) -#else -#define CDECL -#define AURA_DEMO_EXPORT __attribute__((visibility("default"))) -#endif - namespace mojo { namespace examples { @@ -105,7 +92,6 @@ class DemoWindowTreeClient : public aura::client::WindowTreeClient { private: aura::Window* window_; - scoped_ptr capture_client_; DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); @@ -113,8 +99,11 @@ class DemoWindowTreeClient : public aura::client::WindowTreeClient { class AuraDemo : public Application { public: - explicit AuraDemo(MojoHandle service_provider_handle) - : Application(service_provider_handle) { + AuraDemo() {} + virtual ~AuraDemo() {} + + virtual void Initialize() OVERRIDE { + aura::Env::CreateInstance(true); screen_.reset(ScreenMojo::Create()); gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); @@ -158,6 +147,7 @@ class AuraDemo : public Application { window_tree_host_->Show(); } + mojo::GLES2Initializer gles2; scoped_ptr screen_; scoped_ptr window_tree_client_; @@ -171,24 +161,16 @@ class AuraDemo : public Application { aura::Window* window21_; scoped_ptr window_tree_host_; + + DISALLOW_COPY_AND_ASSIGN(AuraDemo); }; } // namespace examples -} // namespace mojo -extern "C" AURA_DEMO_EXPORT MojoResult CDECL MojoMain( - MojoHandle service_provider_handle) { - base::CommandLine::Init(0, NULL); - base::AtExitManager at_exit; - base::MessageLoop loop; - mojo::GLES2Initializer gles2; +// static +Application* Application::Create() { + return new examples::AuraDemo(); +} - // TODO(beng): This crashes in a DCHECK on X11 because this thread's - // MessageLoop is not of TYPE_UI. I think we need a way to build - // Aura that doesn't define platform-specific stuff. - aura::Env::CreateInstance(true); - mojo::examples::AuraDemo app(service_provider_handle); - loop.Run(); +} // namespace mojo - return MOJO_RESULT_OK; -} -- cgit v1.1