summaryrefslogtreecommitdiffstats
path: root/chromium/mojo/aura
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/mojo/aura')
-rw-r--r--chromium/mojo/aura/DEPS10
-rw-r--r--chromium/mojo/aura/aura_init.cc26
-rw-r--r--chromium/mojo/aura/aura_init.h33
-rw-r--r--chromium/mojo/aura/context_factory_mojo.cc136
-rw-r--r--chromium/mojo/aura/context_factory_mojo.h40
-rw-r--r--chromium/mojo/aura/screen_mojo.cc76
-rw-r--r--chromium/mojo/aura/screen_mojo.h54
-rw-r--r--chromium/mojo/aura/window_tree_host_mojo.cc179
-rw-r--r--chromium/mojo/aura/window_tree_host_mojo.h82
-rw-r--r--chromium/mojo/aura/window_tree_host_mojo_delegate.h24
10 files changed, 660 insertions, 0 deletions
diff --git a/chromium/mojo/aura/DEPS b/chromium/mojo/aura/DEPS
new file mode 100644
index 00000000000..ad60823f193
--- /dev/null
+++ b/chromium/mojo/aura/DEPS
@@ -0,0 +1,10 @@
+include_rules = [
+ "+cc",
+ "+skia",
+ "+ui/aura",
+ "+ui/compositor",
+ "+ui/events",
+ "+ui/gfx",
+ "+ui/gl",
+ "+webkit/common/gpu",
+]
diff --git a/chromium/mojo/aura/aura_init.cc b/chromium/mojo/aura/aura_init.cc
new file mode 100644
index 00000000000..a99ce25fc3a
--- /dev/null
+++ b/chromium/mojo/aura/aura_init.cc
@@ -0,0 +1,26 @@
+// 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/aura_init.h"
+
+#include "mojo/aura/context_factory_mojo.h"
+#include "mojo/aura/screen_mojo.h"
+#include "ui/aura/env.h"
+
+namespace mojo {
+
+AuraInit::AuraInit() {
+ aura::Env::CreateInstance(true);
+
+ context_factory_.reset(new ContextFactoryMojo);
+ aura::Env::GetInstance()->set_context_factory(context_factory_.get());
+
+ screen_.reset(ScreenMojo::Create());
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
+}
+
+AuraInit::~AuraInit() {
+}
+
+} // namespace mojo
diff --git a/chromium/mojo/aura/aura_init.h b/chromium/mojo/aura/aura_init.h
new file mode 100644
index 00000000000..dea16843761
--- /dev/null
+++ b/chromium/mojo/aura/aura_init.h
@@ -0,0 +1,33 @@
+// Copyright 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.
+
+#ifndef MOJO_AURA_AURA_INIT_MOJO_H_
+#define MOJO_AURA_AURA_INIT_MOJO_H_
+
+#include "base/memory/scoped_ptr.h"
+
+namespace ui {
+class ContextFactory;
+}
+
+namespace mojo {
+
+class ScreenMojo;
+
+// Sets up necessary state for aura when run with the viewmanager.
+class AuraInit {
+ public:
+ AuraInit();
+ ~AuraInit();
+
+ private:
+ scoped_ptr<ui::ContextFactory> context_factory_;
+ scoped_ptr<ScreenMojo> screen_;
+
+ DISALLOW_COPY_AND_ASSIGN(AuraInit);
+};
+
+} // namespace mojo
+
+#endif // MOJO_AURA_AURA_INIT_MOJO_H_
diff --git a/chromium/mojo/aura/context_factory_mojo.cc b/chromium/mojo/aura/context_factory_mojo.cc
new file mode 100644
index 00000000000..6b2b709cdcd
--- /dev/null
+++ b/chromium/mojo/aura/context_factory_mojo.cc
@@ -0,0 +1,136 @@
+// Copyright 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/context_factory_mojo.h"
+
+#include "base/bind.h"
+#include "cc/output/output_surface.h"
+#include "cc/output/software_output_device.h"
+#include "cc/resources/shared_bitmap_manager.h"
+#include "mojo/aura/window_tree_host_mojo.h"
+#include "skia/ext/platform_canvas.h"
+#include "ui/compositor/reflector.h"
+
+namespace mojo {
+namespace {
+
+void FreeSharedBitmap(cc::SharedBitmap* shared_bitmap) {
+ delete shared_bitmap->memory();
+}
+
+void IgnoreSharedBitmap(cc::SharedBitmap* shared_bitmap) {}
+
+class SoftwareOutputDeviceViewManager : public cc::SoftwareOutputDevice {
+ public:
+ explicit SoftwareOutputDeviceViewManager(ui::Compositor* compositor)
+ : compositor_(compositor) {
+ }
+ virtual ~SoftwareOutputDeviceViewManager() {}
+
+ // cc::SoftwareOutputDevice:
+ virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE {
+ WindowTreeHostMojo* window_tree_host =
+ WindowTreeHostMojo::ForCompositor(compositor_);
+ DCHECK(window_tree_host);
+ window_tree_host->SetContents(
+ skia::GetTopDevice(*canvas_)->accessBitmap(true));
+
+ SoftwareOutputDevice::EndPaint(frame_data);
+ }
+
+ private:
+ ui::Compositor* compositor_;
+
+ DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceViewManager);
+};
+
+// TODO(sky): this is a copy from cc/test. Copy to a common place.
+class TestSharedBitmapManager : public cc::SharedBitmapManager {
+ public:
+ TestSharedBitmapManager() {}
+ virtual ~TestSharedBitmapManager() {}
+
+ virtual scoped_ptr<cc::SharedBitmap> AllocateSharedBitmap(
+ const gfx::Size& size) OVERRIDE {
+ base::AutoLock lock(lock_);
+ scoped_ptr<base::SharedMemory> memory(new base::SharedMemory);
+ memory->CreateAndMapAnonymous(size.GetArea() * 4);
+ cc::SharedBitmapId id = cc::SharedBitmap::GenerateId();
+ bitmap_map_[id] = memory.get();
+ return scoped_ptr<cc::SharedBitmap>(
+ new cc::SharedBitmap(memory.release(), id,
+ base::Bind(&FreeSharedBitmap)));
+ }
+
+ virtual scoped_ptr<cc::SharedBitmap> GetSharedBitmapFromId(
+ const gfx::Size&,
+ const cc::SharedBitmapId& id) OVERRIDE {
+ base::AutoLock lock(lock_);
+ if (bitmap_map_.find(id) == bitmap_map_.end())
+ return scoped_ptr<cc::SharedBitmap>();
+ return scoped_ptr<cc::SharedBitmap>(
+ new cc::SharedBitmap(bitmap_map_[id], id,
+ base::Bind(&IgnoreSharedBitmap)));
+ }
+
+ virtual scoped_ptr<cc::SharedBitmap> GetBitmapForSharedMemory(
+ base::SharedMemory* memory) OVERRIDE {
+ base::AutoLock lock(lock_);
+ cc::SharedBitmapId id = cc::SharedBitmap::GenerateId();
+ bitmap_map_[id] = memory;
+ return scoped_ptr<cc::SharedBitmap>(
+ new cc::SharedBitmap(memory, id, base::Bind(&IgnoreSharedBitmap)));
+ }
+
+ private:
+ base::Lock lock_;
+ std::map<cc::SharedBitmapId, base::SharedMemory*> bitmap_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestSharedBitmapManager);
+};
+
+} // namespace
+
+ContextFactoryMojo::ContextFactoryMojo()
+ : shared_bitmap_manager_(new TestSharedBitmapManager()) {
+}
+
+ContextFactoryMojo::~ContextFactoryMojo() {}
+
+scoped_ptr<cc::OutputSurface> ContextFactoryMojo::CreateOutputSurface(
+ ui::Compositor* compositor,
+ bool software_fallback) {
+ scoped_ptr<cc::SoftwareOutputDevice> output_device(
+ new SoftwareOutputDeviceViewManager(compositor));
+ return make_scoped_ptr(new cc::OutputSurface(output_device.Pass()));
+}
+
+scoped_refptr<ui::Reflector> ContextFactoryMojo::CreateReflector(
+ ui::Compositor* mirroed_compositor,
+ ui::Layer* mirroring_layer) {
+ return new ui::Reflector();
+}
+
+void ContextFactoryMojo::RemoveReflector(
+ scoped_refptr<ui::Reflector> reflector) {
+}
+
+scoped_refptr<cc::ContextProvider>
+ContextFactoryMojo::SharedMainThreadContextProvider() {
+ return scoped_refptr<cc::ContextProvider>(NULL);
+}
+
+void ContextFactoryMojo::RemoveCompositor(ui::Compositor* compositor) {}
+
+bool ContextFactoryMojo::DoesCreateTestContexts() { return false; }
+
+cc::SharedBitmapManager* ContextFactoryMojo::GetSharedBitmapManager() {
+ return shared_bitmap_manager_.get();
+}
+
+base::MessageLoopProxy* ContextFactoryMojo::GetCompositorMessageLoop() {
+ return NULL;
+}
+
+} // namespace mojo
diff --git a/chromium/mojo/aura/context_factory_mojo.h b/chromium/mojo/aura/context_factory_mojo.h
new file mode 100644
index 00000000000..800afa7bd6d
--- /dev/null
+++ b/chromium/mojo/aura/context_factory_mojo.h
@@ -0,0 +1,40 @@
+// Copyright 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.
+
+#ifndef MOJO_AURA_CONTEXT_FACTORY_MOJO_H_
+#define MOJO_AURA_CONTEXT_FACTORY_MOJO_H_
+
+#include "ui/compositor/compositor.h"
+
+namespace mojo {
+
+class ContextFactoryMojo : public ui::ContextFactory {
+ public:
+ ContextFactoryMojo();
+ virtual ~ContextFactoryMojo();
+
+ private:
+ // ContextFactory:
+ virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
+ ui::Compositor* compositor,
+ bool software_fallback) OVERRIDE;
+ virtual scoped_refptr<ui::Reflector> CreateReflector(
+ ui::Compositor* mirrored_compositor,
+ ui::Layer* mirroring_layer) OVERRIDE;
+ virtual void RemoveReflector(scoped_refptr<ui::Reflector> reflector) OVERRIDE;
+ virtual scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider()
+ OVERRIDE;
+ virtual void RemoveCompositor(ui::Compositor* compositor) OVERRIDE;
+ virtual bool DoesCreateTestContexts() OVERRIDE;
+ virtual cc::SharedBitmapManager* GetSharedBitmapManager() OVERRIDE;
+ virtual base::MessageLoopProxy* GetCompositorMessageLoop() OVERRIDE;
+
+ scoped_ptr<cc::SharedBitmapManager> shared_bitmap_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContextFactoryMojo);
+};
+
+} // namespace mojo
+
+#endif // MOJO_AURA_CONTEXT_FACTORY_MOJO_H_
diff --git a/chromium/mojo/aura/screen_mojo.cc b/chromium/mojo/aura/screen_mojo.cc
new file mode 100644
index 00000000000..b07c320a601
--- /dev/null
+++ b/chromium/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/chromium/mojo/aura/screen_mojo.h b/chromium/mojo/aura/screen_mojo.h
new file mode 100644
index 00000000000..ad50c1cee71
--- /dev/null
+++ b/chromium/mojo/aura/screen_mojo.h
@@ -0,0 +1,54 @@
+// 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.
+
+#ifndef MOJO_AURA_SCREEN_MOJO_H_
+#define MOJO_AURA_SCREEN_MOJO_H_
+
+#include "base/compiler_specific.h"
+#include "ui/gfx/display.h"
+#include "ui/gfx/screen.h"
+
+namespace gfx {
+class Rect;
+class Transform;
+}
+
+namespace mojo {
+
+// A minimal implementation of gfx::Screen for mojo.
+class ScreenMojo : public gfx::Screen {
+ public:
+ static ScreenMojo* Create();
+ virtual ~ScreenMojo();
+
+ protected:
+ // gfx::Screen overrides:
+ virtual bool IsDIPEnabled() OVERRIDE;
+ virtual gfx::Point GetCursorScreenPoint() OVERRIDE;
+ virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE;
+ virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point)
+ OVERRIDE;
+ virtual int GetNumDisplays() const OVERRIDE;
+ virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE;
+ virtual gfx::Display GetDisplayNearestWindow(
+ gfx::NativeView view) const OVERRIDE;
+ virtual gfx::Display GetDisplayNearestPoint(
+ const gfx::Point& point) const OVERRIDE;
+ virtual gfx::Display GetDisplayMatching(
+ const gfx::Rect& match_rect) const OVERRIDE;
+ virtual gfx::Display GetPrimaryDisplay() const OVERRIDE;
+ virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE;
+ virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE;
+
+ private:
+ explicit ScreenMojo(const gfx::Rect& screen_bounds);
+
+ gfx::Display display_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScreenMojo);
+};
+
+} // namespace mojo
+
+#endif // MOJO_AURA_SCREEN_MOJO_H_
diff --git a/chromium/mojo/aura/window_tree_host_mojo.cc b/chromium/mojo/aura/window_tree_host_mojo.cc
new file mode 100644
index 00000000000..75fdb7dff93
--- /dev/null
+++ b/chromium/mojo/aura/window_tree_host_mojo.cc
@@ -0,0 +1,179 @@
+// Copyright 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/window_tree_host_mojo.h"
+
+#include <vector>
+
+#include "mojo/aura/window_tree_host_mojo_delegate.h"
+#include "ui/aura/env.h"
+#include "ui/aura/window.h"
+#include "ui/aura/window_event_dispatcher.h"
+#include "ui/events/event.h"
+#include "ui/events/event_constants.h"
+
+namespace mojo {
+namespace {
+
+const char kTreeHostsKey[] = "tree_hosts";
+
+typedef std::vector<WindowTreeHostMojo*> Managers;
+
+class TreeHosts : public base::SupportsUserData::Data {
+ public:
+ TreeHosts() {}
+ virtual ~TreeHosts() {}
+
+ static TreeHosts* Get() {
+ TreeHosts* hosts = static_cast<TreeHosts*>(
+ aura::Env::GetInstance()->GetUserData(kTreeHostsKey));
+ if (!hosts) {
+ hosts = new TreeHosts;
+ aura::Env::GetInstance()->SetUserData(kTreeHostsKey, hosts);
+ }
+ return hosts;
+ }
+
+ void Add(WindowTreeHostMojo* manager) {
+ managers_.push_back(manager);
+ }
+
+ void Remove(WindowTreeHostMojo* manager) {
+ Managers::iterator i = std::find(managers_.begin(), managers_.end(),
+ manager);
+ DCHECK(i != managers_.end());
+ managers_.erase(i);
+ }
+
+ const std::vector<WindowTreeHostMojo*> managers() const {
+ return managers_;
+ }
+
+ private:
+ Managers managers_;
+
+ DISALLOW_COPY_AND_ASSIGN(TreeHosts);
+};
+
+} // namespace
+
+////////////////////////////////////////////////////////////////////////////////
+// WindowTreeHostMojo, public:
+
+WindowTreeHostMojo::WindowTreeHostMojo(view_manager::Node* node,
+ WindowTreeHostMojoDelegate* delegate)
+ : node_(node),
+ bounds_(node->bounds()),
+ delegate_(delegate) {
+ node_->AddObserver(this);
+ CreateCompositor(GetAcceleratedWidget());
+
+ TreeHosts::Get()->Add(this);
+}
+
+WindowTreeHostMojo::~WindowTreeHostMojo() {
+ node_->RemoveObserver(this);
+ TreeHosts::Get()->Remove(this);
+ DestroyCompositor();
+ DestroyDispatcher();
+}
+
+// static
+WindowTreeHostMojo* WindowTreeHostMojo::ForCompositor(
+ ui::Compositor* compositor) {
+ const Managers& managers = TreeHosts::Get()->managers();
+ for (size_t i = 0; i < managers.size(); ++i) {
+ if (managers[i]->compositor() == compositor)
+ return managers[i];
+ }
+ return NULL;
+}
+
+void WindowTreeHostMojo::SetContents(const SkBitmap& contents) {
+ delegate_->CompositorContentsChanged(contents);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// WindowTreeHostMojo, aura::WindowTreeHost implementation:
+
+ui::EventSource* WindowTreeHostMojo::GetEventSource() {
+ return this;
+}
+
+gfx::AcceleratedWidget WindowTreeHostMojo::GetAcceleratedWidget() {
+ return gfx::kNullAcceleratedWidget;
+}
+
+void WindowTreeHostMojo::Show() {
+ window()->Show();
+}
+
+void WindowTreeHostMojo::Hide() {
+}
+
+gfx::Rect WindowTreeHostMojo::GetBounds() const {
+ return bounds_;
+}
+
+void WindowTreeHostMojo::SetBounds(const gfx::Rect& bounds) {
+ window()->SetBounds(gfx::Rect(bounds.size()));
+}
+
+gfx::Point WindowTreeHostMojo::GetLocationOnNativeScreen() const {
+ return gfx::Point(0, 0);
+}
+
+void WindowTreeHostMojo::SetCapture() {
+ NOTIMPLEMENTED();
+}
+
+void WindowTreeHostMojo::ReleaseCapture() {
+ NOTIMPLEMENTED();
+}
+
+void WindowTreeHostMojo::PostNativeEvent(
+ const base::NativeEvent& native_event) {
+ NOTIMPLEMENTED();
+}
+
+void WindowTreeHostMojo::OnDeviceScaleFactorChanged(
+ float device_scale_factor) {
+ NOTIMPLEMENTED();
+}
+
+void WindowTreeHostMojo::SetCursorNative(gfx::NativeCursor cursor) {
+ NOTIMPLEMENTED();
+}
+
+void WindowTreeHostMojo::MoveCursorToNative(const gfx::Point& location) {
+ NOTIMPLEMENTED();
+}
+
+void WindowTreeHostMojo::OnCursorVisibilityChangedNative(bool show) {
+ NOTIMPLEMENTED();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// WindowTreeHostMojo, ui::EventSource implementation:
+
+ui::EventProcessor* WindowTreeHostMojo::GetEventProcessor() {
+ return dispatcher();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// WindowTreeHostMojo, view_manager::NodeObserver implementation:
+
+void WindowTreeHostMojo::OnNodeBoundsChange(
+ view_manager::Node* node,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds,
+ view_manager::NodeObserver::DispositionChangePhase phase) {
+ bounds_ = new_bounds;
+ if (old_bounds.origin() != new_bounds.origin())
+ OnHostMoved(bounds_.origin());
+ if (old_bounds.size() != new_bounds.size())
+ OnHostResized(bounds_.size());
+}
+
+} // namespace mojo
diff --git a/chromium/mojo/aura/window_tree_host_mojo.h b/chromium/mojo/aura/window_tree_host_mojo.h
new file mode 100644
index 00000000000..993c4b1a02c
--- /dev/null
+++ b/chromium/mojo/aura/window_tree_host_mojo.h
@@ -0,0 +1,82 @@
+// Copyright 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.
+
+#ifndef MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_
+#define MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_
+
+#include "mojo/services/public/cpp/view_manager/node_observer.h"
+#include "ui/aura/window_tree_host.h"
+#include "ui/events/event_source.h"
+#include "ui/gfx/geometry/rect.h"
+
+class SkBitmap;
+
+namespace ui {
+class Compositor;
+}
+
+namespace mojo {
+
+class WindowTreeHostMojoDelegate;
+
+class WindowTreeHostMojo : public aura::WindowTreeHost,
+ public ui::EventSource,
+ public view_manager::NodeObserver {
+ public:
+ WindowTreeHostMojo(view_manager::Node* node,
+ WindowTreeHostMojoDelegate* delegate);
+ virtual ~WindowTreeHostMojo();
+
+ // Returns the WindowTreeHostMojo for the specified compositor.
+ static WindowTreeHostMojo* ForCompositor(ui::Compositor* compositor);
+
+ const gfx::Rect& bounds() const { return bounds_; }
+
+ // Sets the contents to show in this WindowTreeHost. This forwards to the
+ // delegate.
+ void SetContents(const SkBitmap& contents);
+
+ ui::EventDispatchDetails SendEventToProcessor(ui::Event* event) {
+ return ui::EventSource::SendEventToProcessor(event);
+ }
+
+ private:
+ // WindowTreeHost:
+ virtual ui::EventSource* GetEventSource() OVERRIDE;
+ virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
+ virtual void Show() OVERRIDE;
+ virtual void Hide() OVERRIDE;
+ virtual gfx::Rect GetBounds() const OVERRIDE;
+ virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
+ virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE;
+ virtual void SetCapture() OVERRIDE;
+ virtual void ReleaseCapture() OVERRIDE;
+ virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE;
+ virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
+ virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE;
+ virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE;
+ virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE;
+
+ // ui::EventSource:
+ virtual ui::EventProcessor* GetEventProcessor() OVERRIDE;
+
+ // view_manager::NodeObserver:
+ virtual void OnNodeBoundsChange(
+ view_manager::Node* node,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds,
+ view_manager::NodeObserver::DispositionChangePhase phase) OVERRIDE;
+
+ view_manager::Node* node_;
+
+ gfx::Rect bounds_;
+
+ WindowTreeHostMojoDelegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMojo);
+};
+
+} // namespace mojo
+
+#endif // MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_H_
diff --git a/chromium/mojo/aura/window_tree_host_mojo_delegate.h b/chromium/mojo/aura/window_tree_host_mojo_delegate.h
new file mode 100644
index 00000000000..9ab13b27d25
--- /dev/null
+++ b/chromium/mojo/aura/window_tree_host_mojo_delegate.h
@@ -0,0 +1,24 @@
+// Copyright 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.
+
+#ifndef MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_DELEGATE_H_
+#define MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_DELEGATE_H_
+
+class SkBitmap;
+
+namespace mojo {
+
+class WindowTreeHostMojoDelegate {
+ public:
+ // Invoked when the contents of the composite associated with the
+ // WindowTreeHostMojo are updated.
+ virtual void CompositorContentsChanged(const SkBitmap& bitmap) = 0;
+
+ protected:
+ virtual ~WindowTreeHostMojoDelegate() {}
+};
+
+} // namespace mojo
+
+#endif // MOJO_EXAMPLES_AURA_DEMO_WINDOW_TREE_HOST_VIEW_MANAGER_DELEGATE_H_