diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-29 16:58:53 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-29 16:58:53 +0000 |
commit | a2a3e7ce17671c6c1ec93474ee9eecd7d63b3cbc (patch) | |
tree | d2bc930aa238d76884f56c12ab8e8d12b2126ba4 /mojo/examples/aura_demo | |
parent | f88f20bb8ccea880db1700008e8cc15337c84247 (diff) | |
download | chromium_src-a2a3e7ce17671c6c1ec93474ee9eecd7d63b3cbc.zip chromium_src-a2a3e7ce17671c6c1ec93474ee9eecd7d63b3cbc.tar.gz chromium_src-a2a3e7ce17671c6c1ec93474ee9eecd7d63b3cbc.tar.bz2 |
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
Diffstat (limited to 'mojo/examples/aura_demo')
-rw-r--r-- | mojo/examples/aura_demo/aura_demo.cc | 44 |
1 files changed, 13 insertions, 31 deletions
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 <stdio.h> #include <string> -#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<aura::client::DefaultCaptureClient> 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<ScreenMojo> screen_; scoped_ptr<DemoWindowTreeClient> window_tree_client_; @@ -171,24 +161,16 @@ class AuraDemo : public Application { aura::Window* window21_; scoped_ptr<aura::WindowTreeHost> 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; -} |