diff options
-rw-r--r-- | mojo/aura/DEPS | 9 | ||||
-rw-r--r-- | mojo/aura/context_factory_mojo.cc (renamed from mojo/examples/aura_demo/demo_context_factory.cc) | 41 | ||||
-rw-r--r-- | mojo/aura/context_factory_mojo.h (renamed from mojo/examples/aura_demo/demo_context_factory.h) | 23 | ||||
-rw-r--r-- | mojo/aura/screen_mojo.cc | 76 | ||||
-rw-r--r-- | mojo/aura/screen_mojo.h (renamed from mojo/examples/aura_demo/demo_screen.h) | 20 | ||||
-rw-r--r-- | mojo/aura/window_tree_host_mojo.cc (renamed from mojo/examples/aura_demo/window_tree_host_mojo.cc) | 28 | ||||
-rw-r--r-- | mojo/aura/window_tree_host_mojo.h (renamed from mojo/examples/aura_demo/window_tree_host_mojo.h) | 15 | ||||
-rw-r--r-- | mojo/cc/DEPS | 3 | ||||
-rw-r--r-- | mojo/cc/context_provider_mojo.cc (renamed from mojo/examples/compositor_app/mojo_context_provider.cc) | 24 | ||||
-rw-r--r-- | mojo/cc/context_provider_mojo.h (renamed from mojo/examples/compositor_app/mojo_context_provider.h) | 17 | ||||
-rw-r--r-- | mojo/examples/aura_demo/DEPS | 6 | ||||
-rw-r--r-- | mojo/examples/aura_demo/aura_demo.cc | 8 | ||||
-rw-r--r-- | mojo/examples/aura_demo/demo_screen.cc | 78 | ||||
-rw-r--r-- | mojo/examples/compositor_app/compositor_host.cc | 4 | ||||
-rw-r--r-- | mojo/examples/launcher/launcher.cc | 8 | ||||
-rw-r--r-- | mojo/mojo.gyp | 43 | ||||
-rw-r--r-- | mojo/mojo_examples.gypi | 46 | ||||
-rw-r--r-- | mojo/services/view_manager/DEPS | 3 |
18 files changed, 222 insertions, 230 deletions
diff --git a/mojo/aura/DEPS b/mojo/aura/DEPS new file mode 100644 index 0000000..698be88 --- /dev/null +++ b/mojo/aura/DEPS @@ -0,0 +1,9 @@ +include_rules = [ + "+cc", + "+ui/aura", + "+ui/compositor", + "+ui/events", + "+ui/gfx", + "+ui/gl", + "+webkit/common/gpu", +] diff --git a/mojo/examples/aura_demo/demo_context_factory.cc b/mojo/aura/context_factory_mojo.cc index 19af8e5..5c2a66e 100644 --- a/mojo/examples/aura_demo/demo_context_factory.cc +++ b/mojo/aura/context_factory_mojo.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "mojo/examples/aura_demo/demo_context_factory.h" +#include "mojo/aura/context_factory_mojo.h" #include "cc/output/output_surface.h" -#include "mojo/examples/aura_demo/window_tree_host_mojo.h" -#include "mojo/examples/compositor_app/mojo_context_provider.h" +#include "mojo/aura/window_tree_host_mojo.h" +#include "mojo/cc/context_provider_mojo.h" #include "ui/compositor/reflector.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_surface.h" @@ -15,46 +15,32 @@ #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" namespace mojo { -namespace examples { -DemoContextFactory::DemoContextFactory(WindowTreeHostMojo* rwhm) : rwhm_(rwhm) { +ContextFactoryMojo::ContextFactoryMojo(ScopedMessagePipeHandle gles2_handle) + : gles2_handle_(gles2_handle.Pass()) { } -DemoContextFactory::~DemoContextFactory() { +ContextFactoryMojo::~ContextFactoryMojo() { } -bool DemoContextFactory::Initialize() { - if (gfx::GetGLImplementation() != gfx::kGLImplementationNone) { - return true; - } - - if (!gfx::GLSurface::InitializeOneOff() || - gfx::GetGLImplementation() == gfx::kGLImplementationNone) { - LOG(ERROR) << "Could not load the GL bindings"; - return false; - } - - return true; -} - -scoped_ptr<cc::OutputSurface> DemoContextFactory::CreateOutputSurface( +scoped_ptr<cc::OutputSurface> ContextFactoryMojo::CreateOutputSurface( ui::Compositor* compositor, bool software_fallback) { return make_scoped_ptr(new cc::OutputSurface( - new MojoContextProvider(rwhm_->TakeGLES2PipeHandle()))); + new ContextProviderMojo(gles2_handle_.Pass()))); } -scoped_refptr<ui::Reflector> DemoContextFactory::CreateReflector( +scoped_refptr<ui::Reflector> ContextFactoryMojo::CreateReflector( ui::Compositor* mirroed_compositor, ui::Layer* mirroring_layer) { return NULL; } -void DemoContextFactory::RemoveReflector( +void ContextFactoryMojo::RemoveReflector( scoped_refptr<ui::Reflector> reflector) { } scoped_refptr<cc::ContextProvider> -DemoContextFactory::SharedMainThreadContextProvider() { +ContextFactoryMojo::SharedMainThreadContextProvider() { if (!shared_main_thread_contexts_ || shared_main_thread_contexts_->DestroyedOnMainThread()) { bool lose_context_when_out_of_memory = false; @@ -68,10 +54,9 @@ DemoContextFactory::SharedMainThreadContextProvider() { return shared_main_thread_contexts_; } -void DemoContextFactory::RemoveCompositor(ui::Compositor* compositor) { +void ContextFactoryMojo::RemoveCompositor(ui::Compositor* compositor) { } -bool DemoContextFactory::DoesCreateTestContexts() { return false; } +bool ContextFactoryMojo::DoesCreateTestContexts() { return false; } -} // namespace examples } // namespace mojo diff --git a/mojo/examples/aura_demo/demo_context_factory.h b/mojo/aura/context_factory_mojo.h index f4d07ca..d63f8e8 100644 --- a/mojo/examples/aura_demo/demo_context_factory.h +++ b/mojo/aura/context_factory_mojo.h @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MOJO_EXAMPLES_AURA_DEMO_DEMO_CONTEXT_FACTORY_H_ -#define MOJO_EXAMPLES_AURA_DEMO_DEMO_CONTEXT_FACTORY_H_ +#ifndef MOJO_AURA_CONTEXT_FACTORY_MOJO_H_ +#define MOJO_AURA_CONTEXT_FACTORY_MOJO_H_ +#include "mojo/public/cpp/system/core.h" #include "ui/compositor/compositor.h" namespace webkit { @@ -14,15 +15,12 @@ class ContextProviderInProcess; } namespace mojo { -namespace examples { - -class WindowTreeHostMojo; // The default factory that creates in-process contexts. -class DemoContextFactory : public ui::ContextFactory { +class ContextFactoryMojo : public ui::ContextFactory { public: - explicit DemoContextFactory(WindowTreeHostMojo* rwhm); - virtual ~DemoContextFactory(); + explicit ContextFactoryMojo(ScopedMessagePipeHandle gles2_handle); + virtual ~ContextFactoryMojo(); // ContextFactory implementation virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface( @@ -38,18 +36,15 @@ class DemoContextFactory : public ui::ContextFactory { virtual void RemoveCompositor(ui::Compositor* compositor) OVERRIDE; virtual bool DoesCreateTestContexts() OVERRIDE; - bool Initialize(); - private: scoped_refptr<webkit::gpu::ContextProviderInProcess> shared_main_thread_contexts_; - WindowTreeHostMojo* rwhm_; + ScopedMessagePipeHandle gles2_handle_; - DISALLOW_COPY_AND_ASSIGN(DemoContextFactory); + DISALLOW_COPY_AND_ASSIGN(ContextFactoryMojo); }; -} // namespace examples } // namespace mojo -#endif // MOJO_EXAMPLES_AURA_DEMO_DEMO_CONTEXT_FACTORY_H_ +#endif // MOJO_AURA_CONTEXT_FACTORY_MOJO_H_ diff --git a/mojo/aura/screen_mojo.cc b/mojo/aura/screen_mojo.cc new file mode 100644 index 0000000..b07c320 --- /dev/null +++ b/mojo/aura/screen_mojo.cc @@ -0,0 +1,76 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/aura/screen_mojo.h" + +#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/rect_conversions.h" + +namespace mojo { + +// static +ScreenMojo* ScreenMojo::Create() { + return new ScreenMojo(gfx::Rect(0, 0, 800, 600)); +} + +ScreenMojo::~ScreenMojo() { +} + +bool ScreenMojo::IsDIPEnabled() { + NOTIMPLEMENTED(); + return true; +} + +gfx::Point ScreenMojo::GetCursorScreenPoint() { + NOTIMPLEMENTED(); + return gfx::Point(); +} + +gfx::NativeWindow ScreenMojo::GetWindowUnderCursor() { + return GetWindowAtScreenPoint(GetCursorScreenPoint()); +} + +gfx::NativeWindow ScreenMojo::GetWindowAtScreenPoint(const gfx::Point& point) { + NOTIMPLEMENTED(); + return NULL; +} + +int ScreenMojo::GetNumDisplays() const { + return 1; +} + +std::vector<gfx::Display> ScreenMojo::GetAllDisplays() const { + return std::vector<gfx::Display>(1, display_); +} + +gfx::Display ScreenMojo::GetDisplayNearestWindow( + gfx::NativeWindow window) const { + return display_; +} + +gfx::Display ScreenMojo::GetDisplayNearestPoint(const gfx::Point& point) const { + return display_; +} + +gfx::Display ScreenMojo::GetDisplayMatching(const gfx::Rect& match_rect) const { + return display_; +} + +gfx::Display ScreenMojo::GetPrimaryDisplay() const { + return display_; +} + +void ScreenMojo::AddObserver(gfx::DisplayObserver* observer) { +} + +void ScreenMojo::RemoveObserver(gfx::DisplayObserver* observer) { +} + +ScreenMojo::ScreenMojo(const gfx::Rect& screen_bounds) { + static int64 synthesized_display_id = 2000; + display_.set_id(synthesized_display_id++); + display_.SetScaleAndBounds(1.0f, screen_bounds); +} + +} // namespace mojo diff --git a/mojo/examples/aura_demo/demo_screen.h b/mojo/aura/screen_mojo.h index 43db5f4..ad50c1c 100644 --- a/mojo/examples/aura_demo/demo_screen.h +++ b/mojo/aura/screen_mojo.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MOJO_EXAMPLES_AURA_DEMO_DEMO_SCREEN_H_ -#define MOJO_EXAMPLES_AURA_DEMO_DEMO_SCREEN_H_ +#ifndef MOJO_AURA_SCREEN_MOJO_H_ +#define MOJO_AURA_SCREEN_MOJO_H_ #include "base/compiler_specific.h" #include "ui/gfx/display.h" @@ -15,13 +15,12 @@ class Transform; } namespace mojo { -namespace examples { -// A minimal, testing Aura implementation of gfx::Screen. -class DemoScreen : public gfx::Screen { +// A minimal implementation of gfx::Screen for mojo. +class ScreenMojo : public gfx::Screen { public: - static DemoScreen* Create(); - virtual ~DemoScreen(); + static ScreenMojo* Create(); + virtual ~ScreenMojo(); protected: // gfx::Screen overrides: @@ -43,14 +42,13 @@ class DemoScreen : public gfx::Screen { virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE; private: - explicit DemoScreen(const gfx::Rect& screen_bounds); + explicit ScreenMojo(const gfx::Rect& screen_bounds); gfx::Display display_; - DISALLOW_COPY_AND_ASSIGN(DemoScreen); + DISALLOW_COPY_AND_ASSIGN(ScreenMojo); }; -} // namespace examples } // namespace mojo -#endif // MOJO_EXAMPLES_AURA_DEMO_DEMO_SCREEN_H_ +#endif // MOJO_AURA_SCREEN_MOJO_H_ diff --git a/mojo/examples/aura_demo/window_tree_host_mojo.cc b/mojo/aura/window_tree_host_mojo.cc index c598dce..b623bbd 100644 --- a/mojo/examples/aura_demo/window_tree_host_mojo.cc +++ b/mojo/aura/window_tree_host_mojo.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "mojo/examples/aura_demo/window_tree_host_mojo.h" +#include "mojo/aura/window_tree_host_mojo.h" -#include "mojo/examples/aura_demo/demo_context_factory.h" +#include "mojo/aura/context_factory_mojo.h" #include "mojo/public/c/gles2/gles2.h" #include "mojo/public/cpp/bindings/allocation_scope.h" #include "mojo/services/native_viewport/geometry_conversions.h" @@ -18,10 +18,9 @@ #include "ui/gfx/geometry/rect.h" namespace mojo { -namespace examples { // static -ui::ContextFactory* WindowTreeHostMojo::context_factory_ = NULL; +mojo::ContextFactoryMojo* WindowTreeHostMojo::context_factory_ = NULL; //////////////////////////////////////////////////////////////////////////////// // WindowTreeHostMojo, public: @@ -36,22 +35,26 @@ WindowTreeHostMojo::WindowTreeHostMojo( AllocationScope scope; native_viewport_->Create(bounds); - ScopedMessagePipeHandle gles2_client_handle; - CreateMessagePipe(&gles2_handle_, &gles2_client_handle); + ScopedMessagePipeHandle gles2_handle, gles2_client_handle; + CreateMessagePipe(&gles2_handle, &gles2_client_handle); // The ContextFactory must exist before any Compositors are created. - if (!context_factory_) { - scoped_ptr<DemoContextFactory> cf(new DemoContextFactory(this)); - if (cf->Initialize()) - context_factory_ = cf.release(); - ui::ContextFactory::SetInstance(context_factory_); + if (context_factory_) { + ui::ContextFactory::SetInstance(NULL); + delete context_factory_; + context_factory_ = NULL; } + context_factory_ = new ContextFactoryMojo(gles2_handle.Pass()); + ui::ContextFactory::SetInstance(context_factory_); CHECK(context_factory_) << "No GL bindings."; native_viewport_->CreateGLES2Context(gles2_client_handle.Pass()); } -WindowTreeHostMojo::~WindowTreeHostMojo() {} +WindowTreeHostMojo::~WindowTreeHostMojo() { + DestroyCompositor(); + DestroyDispatcher(); +} //////////////////////////////////////////////////////////////////////////////// // WindowTreeHostMojo, aura::WindowTreeHost implementation: @@ -172,5 +175,4 @@ void WindowTreeHostMojo::OnEvent(const Event& event, callback.Run(); }; -} // namespace examples } // namespace mojo diff --git a/mojo/examples/aura_demo/window_tree_host_mojo.h b/mojo/aura/window_tree_host_mojo.h index 3514d1e3..c53e884 100644 --- a/mojo/examples/aura_demo/window_tree_host_mojo.h +++ b/mojo/aura/window_tree_host_mojo.h @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_MOJO_H_ -#define MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_MOJO_H_ +#ifndef MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ +#define MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ #include "base/bind.h" +#include "mojo/public/cpp/bindings/error_handler.h" #include "mojo/public/cpp/bindings/remote_ptr.h" #include "mojo/services/native_viewport/native_viewport.mojom.h" #include "ui/aura/window_tree_host.h" @@ -17,7 +18,8 @@ class ContextFactory; } namespace mojo { -namespace examples { + +class ContextFactoryMojo; class WindowTreeHostMojo : public aura::WindowTreeHost, public ui::EventSource, @@ -29,7 +31,6 @@ class WindowTreeHostMojo : public aura::WindowTreeHost, virtual ~WindowTreeHostMojo(); gfx::Rect bounds() const { return bounds_; } - ScopedMessagePipeHandle TakeGLES2PipeHandle() { return gles2_handle_.Pass(); } private: // WindowTreeHost: @@ -58,9 +59,8 @@ class WindowTreeHostMojo : public aura::WindowTreeHost, virtual void OnEvent(const Event& event, const mojo::Callback<void()>& callback) OVERRIDE; - static ui::ContextFactory* context_factory_; + static ContextFactoryMojo* context_factory_; - ScopedMessagePipeHandle gles2_handle_; RemotePtr<NativeViewport> native_viewport_; base::Callback<void()> compositor_created_callback_; @@ -69,7 +69,6 @@ class WindowTreeHostMojo : public aura::WindowTreeHost, DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo); }; -} // namespace examples } // namespace mojo -#endif // MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_MOJO_H_ +#endif // MOJO_AURA_WINDOW_TREE_HOST_MOJO_H_ diff --git a/mojo/cc/DEPS b/mojo/cc/DEPS new file mode 100644 index 0000000..1d0b887 --- /dev/null +++ b/mojo/cc/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+cc", +] diff --git a/mojo/examples/compositor_app/mojo_context_provider.cc b/mojo/cc/context_provider_mojo.cc index 3b52d1e..8a759fd 100644 --- a/mojo/examples/compositor_app/mojo_context_provider.cc +++ b/mojo/cc/context_provider_mojo.cc @@ -2,57 +2,55 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "mojo/examples/compositor_app/mojo_context_provider.h" +#include "mojo/cc/context_provider_mojo.h" #include "base/logging.h" namespace mojo { -namespace examples { -MojoContextProvider::MojoContextProvider(ScopedMessagePipeHandle gl_pipe) +ContextProviderMojo::ContextProviderMojo(ScopedMessagePipeHandle gl_pipe) : gl_pipe_(gl_pipe.Pass()) {} -bool MojoContextProvider::BindToCurrentThread() { +bool ContextProviderMojo::BindToCurrentThread() { DCHECK(gl_pipe_.is_valid()); context_ = MojoGLES2CreateContext( gl_pipe_.release().value(), &ContextLostThunk, NULL, this); return !!context_; } -gpu::gles2::GLES2Interface* MojoContextProvider::ContextGL() { +gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() { if (!context_) return NULL; return static_cast<gpu::gles2::GLES2Interface*>( MojoGLES2GetGLES2Interface(context_)); } -gpu::ContextSupport* MojoContextProvider::ContextSupport() { +gpu::ContextSupport* ContextProviderMojo::ContextSupport() { if (!context_) return NULL; return static_cast<gpu::ContextSupport*>( MojoGLES2GetContextSupport(context_)); } -class GrContext* MojoContextProvider::GrContext() { return NULL; } +class GrContext* ContextProviderMojo::GrContext() { return NULL; } -cc::ContextProvider::Capabilities MojoContextProvider::ContextCapabilities() { +cc::ContextProvider::Capabilities ContextProviderMojo::ContextCapabilities() { return capabilities_; } -bool MojoContextProvider::IsContextLost() { return !context_; } -bool MojoContextProvider::DestroyedOnMainThread() { return !context_; } +bool ContextProviderMojo::IsContextLost() { return !context_; } +bool ContextProviderMojo::DestroyedOnMainThread() { return !context_; } -MojoContextProvider::~MojoContextProvider() { +ContextProviderMojo::~ContextProviderMojo() { if (context_) MojoGLES2DestroyContext(context_); } -void MojoContextProvider::ContextLost() { +void ContextProviderMojo::ContextLost() { if (context_) { MojoGLES2DestroyContext(context_); context_ = NULL; } } -} // namespace examples } // namespace mojo diff --git a/mojo/examples/compositor_app/mojo_context_provider.h b/mojo/cc/context_provider_mojo.h index bcee248..5ddc7c1 100644 --- a/mojo/examples/compositor_app/mojo_context_provider.h +++ b/mojo/cc/context_provider_mojo.h @@ -2,16 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef MOJO_CC_CONTEXT_PROVIDER_MOJO_H_ +#define MOJO_CC_CONTEXT_PROVIDER_MOJO_H_ + #include "cc/output/context_provider.h" #include "mojo/public/c/gles2/gles2.h" #include "mojo/public/cpp/system/core.h" namespace mojo { -namespace examples { -class MojoContextProvider : public cc::ContextProvider { +class ContextProviderMojo : public cc::ContextProvider { public: - explicit MojoContextProvider(ScopedMessagePipeHandle gl_pipe); + explicit ContextProviderMojo(ScopedMessagePipeHandle gl_pipe); // cc::ContextProvider implementation. virtual bool BindToCurrentThread() OVERRIDE; @@ -30,12 +32,12 @@ class MojoContextProvider : public cc::ContextProvider { OVERRIDE {} protected: - friend class base::RefCountedThreadSafe<MojoContextProvider>; - virtual ~MojoContextProvider(); + friend class base::RefCountedThreadSafe<ContextProviderMojo>; + virtual ~ContextProviderMojo(); private: static void ContextLostThunk(void* closure) { - static_cast<MojoContextProvider*>(closure)->ContextLost(); + static_cast<ContextProviderMojo*>(closure)->ContextLost(); } void ContextLost(); @@ -44,5 +46,6 @@ class MojoContextProvider : public cc::ContextProvider { MojoGLES2Context context_; }; -} // namespace examples } // namespace mojo + +#endif // MOJO_CC_CONTEXT_PROVIDER_MOJO_H_ diff --git a/mojo/examples/aura_demo/DEPS b/mojo/examples/aura_demo/DEPS index 57bf26c..ebcc248 100644 --- a/mojo/examples/aura_demo/DEPS +++ b/mojo/examples/aura_demo/DEPS @@ -1,11 +1,5 @@ include_rules = [ - "+cc", - "+gpu/command_buffer/client", "+ui/aura", "+ui/base/hit_test.h", - "+ui/compositor", - "+ui/events", "+ui/gfx", - "+ui/gl", - "+webkit/common/gpu", ] diff --git a/mojo/examples/aura_demo/aura_demo.cc b/mojo/examples/aura_demo/aura_demo.cc index 7a0a7b9..14f00f5 100644 --- a/mojo/examples/aura_demo/aura_demo.cc +++ b/mojo/examples/aura_demo/aura_demo.cc @@ -8,8 +8,8 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/message_loop/message_loop.h" -#include "mojo/examples/aura_demo/demo_screen.h" -#include "mojo/examples/aura_demo/window_tree_host_mojo.h" +#include "mojo/aura/screen_mojo.h" +#include "mojo/aura/window_tree_host_mojo.h" #include "mojo/public/cpp/bindings/allocation_scope.h" #include "mojo/public/cpp/gles2/gles2.h" #include "mojo/public/cpp/shell/application.h" @@ -114,7 +114,7 @@ class DemoWindowTreeClient : public aura::client::WindowTreeClient { class AuraDemo : public Application { public: explicit AuraDemo(MojoHandle shell_handle) : Application(shell_handle) { - screen_.reset(DemoScreen::Create()); + screen_.reset(ScreenMojo::Create()); gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); InterfacePipe<NativeViewport, AnyInterface> pipe; @@ -159,7 +159,7 @@ class AuraDemo : public Application { window_tree_host_->Show(); } - scoped_ptr<DemoScreen> screen_; + scoped_ptr<ScreenMojo> screen_; scoped_ptr<DemoWindowTreeClient> window_tree_client_; diff --git a/mojo/examples/aura_demo/demo_screen.cc b/mojo/examples/aura_demo/demo_screen.cc deleted file mode 100644 index bc66286..0000000 --- a/mojo/examples/aura_demo/demo_screen.cc +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/examples/aura_demo/demo_screen.h" - -#include "ui/gfx/native_widget_types.h" -#include "ui/gfx/rect_conversions.h" - -namespace mojo { -namespace examples { - -// static -DemoScreen* DemoScreen::Create() { - return new DemoScreen(gfx::Rect(0, 0, 800, 600)); -} - -DemoScreen::~DemoScreen() { -} - -bool DemoScreen::IsDIPEnabled() { - NOTIMPLEMENTED(); - return true; -} - -gfx::Point DemoScreen::GetCursorScreenPoint() { - NOTIMPLEMENTED(); - return gfx::Point(); -} - -gfx::NativeWindow DemoScreen::GetWindowUnderCursor() { - return GetWindowAtScreenPoint(GetCursorScreenPoint()); -} - -gfx::NativeWindow DemoScreen::GetWindowAtScreenPoint(const gfx::Point& point) { - NOTIMPLEMENTED(); - return NULL; -} - -int DemoScreen::GetNumDisplays() const { - return 1; -} - -std::vector<gfx::Display> DemoScreen::GetAllDisplays() const { - return std::vector<gfx::Display>(1, display_); -} - -gfx::Display DemoScreen::GetDisplayNearestWindow( - gfx::NativeWindow window) const { - return display_; -} - -gfx::Display DemoScreen::GetDisplayNearestPoint(const gfx::Point& point) const { - return display_; -} - -gfx::Display DemoScreen::GetDisplayMatching(const gfx::Rect& match_rect) const { - return display_; -} - -gfx::Display DemoScreen::GetPrimaryDisplay() const { - return display_; -} - -void DemoScreen::AddObserver(gfx::DisplayObserver* observer) { -} - -void DemoScreen::RemoveObserver(gfx::DisplayObserver* observer) { -} - -DemoScreen::DemoScreen(const gfx::Rect& screen_bounds) { - static int64 synthesized_display_id = 2000; - display_.set_id(synthesized_display_id++); - display_.SetScaleAndBounds(1.0f, screen_bounds); -} - -} // namespace examples -} // namespace mojo diff --git a/mojo/examples/compositor_app/compositor_host.cc b/mojo/examples/compositor_app/compositor_host.cc index 87534ed..7c7e701 100644 --- a/mojo/examples/compositor_app/compositor_host.cc +++ b/mojo/examples/compositor_app/compositor_host.cc @@ -9,7 +9,7 @@ #include "cc/output/context_provider.h" #include "cc/output/output_surface.h" #include "cc/trees/layer_tree_host.h" -#include "mojo/examples/compositor_app/mojo_context_provider.h" +#include "mojo/cc/context_provider_mojo.h" namespace mojo { namespace examples { @@ -73,7 +73,7 @@ void CompositorHost::ApplyScrollAndScale(const gfx::Vector2d& scroll_delta, scoped_ptr<cc::OutputSurface> CompositorHost::CreateOutputSurface( bool fallback) { return make_scoped_ptr( - new cc::OutputSurface(new MojoContextProvider(gl_pipe_.Pass()))); + new cc::OutputSurface(new ContextProviderMojo(gl_pipe_.Pass()))); } void CompositorHost::DidInitializeOutputSurface() { diff --git a/mojo/examples/launcher/launcher.cc b/mojo/examples/launcher/launcher.cc index 063131e..a02effc 100644 --- a/mojo/examples/launcher/launcher.cc +++ b/mojo/examples/launcher/launcher.cc @@ -12,8 +12,8 @@ #include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/path_service.h" -#include "mojo/examples/aura_demo/demo_screen.h" -#include "mojo/examples/aura_demo/window_tree_host_mojo.h" +#include "mojo/aura/screen_mojo.h" +#include "mojo/aura/window_tree_host_mojo.h" #include "mojo/examples/launcher/launcher.mojom.h" #include "mojo/public/cpp/bindings/allocation_scope.h" #include "mojo/public/cpp/bindings/remote_ptr.h" @@ -197,7 +197,7 @@ class LauncherImpl : public Application, : Application(shell_handle), launcher_controller_(this), pending_show_(false) { - screen_.reset(DemoScreen::Create()); + screen_.reset(ScreenMojo::Create()); gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); InterfacePipe<NativeViewport, AnyInterface> pipe; @@ -261,7 +261,7 @@ class LauncherImpl : public Application, } } - scoped_ptr<DemoScreen> screen_; + scoped_ptr<ScreenMojo> screen_; scoped_ptr<LauncherWindowTreeClient> window_tree_client_; scoped_ptr<aura::client::FocusClient> focus_client_; scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; diff --git a/mojo/mojo.gyp b/mojo/mojo.gyp index 6cf2b51..5f5a085 100644 --- a/mojo/mojo.gyp +++ b/mojo/mojo.gyp @@ -632,6 +632,21 @@ 'tools/message_generator.cc', ], }, + { + 'target_name': 'mojo_cc_support', + 'type': 'static_library', + 'dependencies': [ + '../base/base.gyp:base', + '../cc/cc.gyp:cc', + '../skia/skia.gyp:skia', + '../gpu/gpu.gyp:gles2_implementation', + 'mojo_gles2', + ], + 'sources': [ + 'cc/context_provider_mojo.cc', + 'cc/context_provider_mojo.h', + ], + }, ], 'conditions': [ ['OS=="android"', { @@ -820,5 +835,33 @@ }, ], }], + ['use_aura==1', { + 'targets': [ + { + 'target_name': 'mojo_aura_support', + 'type': 'static_library', + 'dependencies': [ + '../cc/cc.gyp:cc', + '../ui/aura/aura.gyp:aura', + '../ui/events/events.gyp:events', + '../ui/events/events.gyp:events_base', + '../ui/compositor/compositor.gyp:compositor', + '../ui/gl/gl.gyp:gl', + '../webkit/common/gpu/webkit_gpu.gyp:webkit_gpu', + 'mojo_cc_support', + 'mojo_gles2', + 'mojo_native_viewport_bindings', + ], + 'sources': [ + 'aura/context_factory_mojo.cc', + 'aura/context_factory_mojo.h', + 'aura/screen_mojo.cc', + 'aura/screen_mojo.h', + 'aura/window_tree_host_mojo.cc', + 'aura/window_tree_host_mojo.h', + ], + }, + ], + }], ], } diff --git a/mojo/mojo_examples.gypi b/mojo/mojo_examples.gypi index 00675d9..5212fe7 100644 --- a/mojo/mojo_examples.gypi +++ b/mojo/mojo_examples.gypi @@ -35,21 +35,6 @@ 'includes': [ 'build/package_app.gypi' ], }, { - 'target_name': 'mojo_compositor_support', - 'type': 'static_library', - 'dependencies': [ - '../base/base.gyp:base', - '../cc/cc.gyp:cc', - '../skia/skia.gyp:skia', - '../gpu/gpu.gyp:gles2_implementation', - 'mojo_gles2', - ], - 'sources': [ - 'examples/compositor_app/mojo_context_provider.cc', - 'examples/compositor_app/mojo_context_provider.h', - ], - }, - { 'target_name': 'mojo_compositor_app', 'type': 'shared_library', 'dependencies': [ @@ -57,8 +42,8 @@ '../cc/cc.gyp:cc', '../ui/gfx/gfx.gyp:gfx', '../ui/gfx/gfx.gyp:gfx_geometry', + 'mojo_cc_support', 'mojo_common_lib', - 'mojo_compositor_support', 'mojo_environment_chromium', 'mojo_gles2', 'mojo_native_viewport_bindings', @@ -176,30 +161,6 @@ ['use_aura==1', { 'targets': [ { - 'target_name': 'mojo_aura_demo_support', - 'type': 'static_library', - 'dependencies': [ - '../cc/cc.gyp:cc', - '../ui/aura/aura.gyp:aura', - '../ui/events/events.gyp:events', - '../ui/events/events.gyp:events_base', - '../ui/compositor/compositor.gyp:compositor', - '../ui/gl/gl.gyp:gl', - '../webkit/common/gpu/webkit_gpu.gyp:webkit_gpu', - 'mojo_compositor_support', - 'mojo_gles2', - 'mojo_native_viewport_bindings', - ], - 'sources': [ - 'examples/aura_demo/demo_context_factory.cc', - 'examples/aura_demo/demo_context_factory.h', - 'examples/aura_demo/demo_screen.cc', - 'examples/aura_demo/demo_screen.h', - 'examples/aura_demo/window_tree_host_mojo.cc', - 'examples/aura_demo/window_tree_host_mojo.h', - ], - }, - { 'target_name': 'mojo_aura_demo', 'type': 'shared_library', 'dependencies': [ @@ -208,7 +169,8 @@ '../ui/base/ui_base.gyp:ui_base', '../ui/gfx/gfx.gyp:gfx', '../ui/gfx/gfx.gyp:gfx_geometry', - 'mojo_aura_demo_support', + 'mojo_aura_support', + 'mojo_cc_support', 'mojo_common_lib', 'mojo_environment_chromium', 'mojo_gles2', @@ -258,7 +220,7 @@ '../ui/views/views.gyp:views', '../ui/wm/wm.gyp:wm', '../url/url.gyp:url_lib', - 'mojo_aura_demo_support', + 'mojo_aura_support', 'mojo_common_lib', 'mojo_environment_chromium', 'mojo_gles2', diff --git a/mojo/services/view_manager/DEPS b/mojo/services/view_manager/DEPS index 05af088..38c3d5e 100644 --- a/mojo/services/view_manager/DEPS +++ b/mojo/services/view_manager/DEPS @@ -1,6 +1,9 @@ include_rules = [ + "+mojo/aura", "+mojo/services", "+ui/aura", + "+ui/base/hit_test.h", "+ui/events", "+ui/gfx", + "+ui/gl", ] |