summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mojo/mojo.gyp7
-rw-r--r--mojo/mojo_examples.gypi1
-rw-r--r--mojo/mojo_services.gypi37
-rw-r--r--mojo/services/native_viewport/native_viewport_service.cc6
-rw-r--r--mojo/services/public/cpp/view_manager/lib/DEPS5
-rw-r--r--mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.cc26
-rw-r--r--mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.h30
-rw-r--r--mojo/services/public/cpp/view_manager/lib/view_manager_unittests.cc14
-rw-r--r--mojo/services/public/interfaces/view_manager/view_manager.mojom5
-rw-r--r--mojo/services/view_manager/DEPS2
-rw-r--r--mojo/services/view_manager/node.cc74
-rw-r--r--mojo/services/view_manager/node.h27
-rw-r--r--mojo/services/view_manager/root_node_manager.cc31
-rw-r--r--mojo/services/view_manager/root_node_manager.h36
-rw-r--r--mojo/services/view_manager/root_view_manager.cc90
-rw-r--r--mojo/services/view_manager/root_view_manager.h66
-rw-r--r--mojo/services/view_manager/view.cc8
-rw-r--r--mojo/services/view_manager/view.h5
-rw-r--r--mojo/services/view_manager/view_manager.cc (renamed from mojo/services/view_manager/main.cc)6
-rw-r--r--mojo/services/view_manager/view_manager_connection.cc21
-rw-r--r--mojo/services/view_manager/view_manager_connection.h3
-rw-r--r--mojo/shell/context.cc32
-rw-r--r--mojo/shell/view_manager_loader.cc40
-rw-r--r--mojo/shell/view_manager_loader.h46
-rw-r--r--ui/aura/window_tree_host.cc1
25 files changed, 72 insertions, 547 deletions
diff --git a/mojo/mojo.gyp b/mojo/mojo.gyp
index 79acf65..34322a2 100644
--- a/mojo/mojo.gyp
+++ b/mojo/mojo.gyp
@@ -504,8 +504,6 @@
'shell/test_child_process.h',
'shell/url_request_context_getter.cc',
'shell/url_request_context_getter.h',
- 'shell/view_manager_loader.cc',
- 'shell/view_manager_loader.h',
],
'conditions': [
['OS=="linux"', {
@@ -521,11 +519,6 @@
'mojo_shell_client',
'mojo_view_manager',
],
- }, { # use_aura==0
- 'sources!': [
- 'shell/view_manager_loader.cc',
- 'shell/view_manager_loader.h',
- ],
}],
],
},
diff --git a/mojo/mojo_examples.gypi b/mojo/mojo_examples.gypi
index 6b49474..5212fe7 100644
--- a/mojo/mojo_examples.gypi
+++ b/mojo/mojo_examples.gypi
@@ -244,7 +244,6 @@
'type': 'shared_library',
'dependencies': [
'../base/base.gyp:base',
- '../skia/skia.gyp:skia',
'../ui/gfx/gfx.gyp:gfx',
'../ui/gfx/gfx.gyp:gfx_geometry',
'../ui/gl/gl.gyp:gl',
diff --git a/mojo/mojo_services.gypi b/mojo/mojo_services.gypi
index 5710e06..5ed5059 100644
--- a/mojo/mojo_services.gypi
+++ b/mojo/mojo_services.gypi
@@ -179,6 +179,7 @@
'../base/base.gyp:test_support_base',
'../testing/gtest.gyp:gtest',
'mojo_environment_chromium',
+ 'mojo_run_all_unittests',
'mojo_shell_test_support',
'mojo_view_manager_bindings',
'mojo_view_manager_lib',
@@ -189,17 +190,6 @@
'services/public/cpp/view_manager/tests/view_tree_host_unittest.cc',
'services/public/cpp/view_manager/tests/view_tree_node_unittest.cc',
],
- 'conditions': [
- ['use_aura==1', {
- 'dependencies': [
- 'mojo_view_manager_run_unittests'
- ],
- }, { # use_aura==0
- 'dependencies': [
- 'mojo_run_all_unittests',
- ],
- }]
- ],
},
],
'conditions': [
@@ -212,10 +202,7 @@
'../base/base.gyp:base',
'../skia/skia.gyp:skia',
'../ui/aura/aura.gyp:aura',
- '../ui/base/ui_base.gyp:ui_base',
- '../ui/gfx/gfx.gyp:gfx',
'../ui/gfx/gfx.gyp:gfx_geometry',
- 'mojo_aura_support',
'mojo_common_lib',
'mojo_environment_chromium',
'mojo_launcher_bindings',
@@ -227,16 +214,14 @@
],
'sources': [
'services/view_manager/ids.h',
- 'services/view_manager/main.cc',
'services/view_manager/node.cc',
'services/view_manager/node.h',
'services/view_manager/node_delegate.h',
'services/view_manager/root_node_manager.cc',
'services/view_manager/root_node_manager.h',
- 'services/view_manager/root_view_manager.cc',
- 'services/view_manager/root_view_manager.h',
'services/view_manager/view.cc',
'services/view_manager/view.h',
+ 'services/view_manager/view_manager.cc',
'services/view_manager/view_manager_connection.cc',
'services/view_manager/view_manager_connection.h',
'services/view_manager/view_manager_export.h',
@@ -246,36 +231,20 @@
],
},
{
- 'target_name': 'mojo_view_manager_run_unittests',
- 'type': 'static_library',
- 'dependencies': [
- '../base/base.gyp:base',
- '../base/base.gyp:test_support_base',
- '../ui/gl/gl.gyp:gl',
- ],
- 'sources': [
- 'services/public/cpp/view_manager/lib/view_manager_test_suite.cc',
- 'services/public/cpp/view_manager/lib/view_manager_test_suite.h',
- 'services/public/cpp/view_manager/lib/view_manager_unittests.cc',
- ],
- },
- {
'target_name': 'mojo_view_manager_unittests',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
- '../base/base.gyp:test_support_base',
+ '../base/base.gyp:run_all_unittests',
'../skia/skia.gyp:skia',
'../testing/gtest.gyp:gtest',
'../ui/aura/aura.gyp:aura',
- '../ui/gl/gl.gyp:gl',
'mojo_environment_chromium',
'mojo_shell_client',
'mojo_shell_test_support',
'mojo_system_impl',
'mojo_view_manager_bindings',
'mojo_view_manager_common',
- 'mojo_view_manager_run_unittests',
],
'sources': [
'services/view_manager/view_manager_connection_unittest.cc',
diff --git a/mojo/services/native_viewport/native_viewport_service.cc b/mojo/services/native_viewport/native_viewport_service.cc
index 9585ae7..5625aa1 100644
--- a/mojo/services/native_viewport/native_viewport_service.cc
+++ b/mojo/services/native_viewport/native_viewport_service.cc
@@ -36,11 +36,7 @@ class NativeViewportImpl
NativeViewportImpl()
: widget_(gfx::kNullAcceleratedWidget),
waiting_for_event_ack_(false) {}
- virtual ~NativeViewportImpl() {
- // Destroy the NativeViewport early on as it may call us back during
- // destruction and we want to be in a known state.
- native_viewport_.reset();
- }
+ virtual ~NativeViewportImpl() {}
virtual void Create(const Rect& bounds) OVERRIDE {
native_viewport_ =
diff --git a/mojo/services/public/cpp/view_manager/lib/DEPS b/mojo/services/public/cpp/view_manager/lib/DEPS
deleted file mode 100644
index 2661b64..0000000
--- a/mojo/services/public/cpp/view_manager/lib/DEPS
+++ /dev/null
@@ -1,5 +0,0 @@
-specific_include_rules = {
- "view_manager_test_suite.cc": [
- "+ui/gl",
- ],
-}
diff --git a/mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.cc b/mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.cc
deleted file mode 100644
index fdd4efd..0000000
--- a/mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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/services/public/cpp/view_manager/lib/view_manager_test_suite.h"
-
-#include "ui/gl/gl_surface.h"
-
-namespace mojo {
-namespace services {
-namespace view_manager {
-
-ViewManagerTestSuite::ViewManagerTestSuite(int argc, char** argv)
- : TestSuite(argc, argv) {}
-
-ViewManagerTestSuite::~ViewManagerTestSuite() {
-}
-
-void ViewManagerTestSuite::Initialize() {
- base::TestSuite::Initialize();
- gfx::GLSurface::InitializeOneOffForTests();
-}
-
-} // namespace view_manager
-} // namespace services
-} // namespace mojo
diff --git a/mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.h b/mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.h
deleted file mode 100644
index 5fea707..0000000
--- a/mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_TEST_SUITE_H_
-#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_TEST_SUITE_H_
-
-#include "base/test/test_suite.h"
-
-namespace mojo {
-namespace services {
-namespace view_manager {
-
-class ViewManagerTestSuite : public base::TestSuite {
- public:
- ViewManagerTestSuite(int argc, char** argv);
- virtual ~ViewManagerTestSuite();
-
- protected:
- virtual void Initialize() OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ViewManagerTestSuite);
-};
-
-} // namespace view_manager
-} // namespace services
-} // namespace mojo
-
-#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_TEST_SUITE_H_
diff --git a/mojo/services/public/cpp/view_manager/lib/view_manager_unittests.cc b/mojo/services/public/cpp/view_manager/lib/view_manager_unittests.cc
deleted file mode 100644
index 03f7919..0000000
--- a/mojo/services/public/cpp/view_manager/lib/view_manager_unittests.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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 "base/bind.h"
-#include "base/test/launcher/unit_test_launcher.h"
-#include "mojo/services/public/cpp/view_manager/lib/view_manager_test_suite.h"
-
-int main(int argc, char** argv) {
- mojo::services::view_manager::ViewManagerTestSuite test_suite(argc, argv);
-
- return base::LaunchUnitTests(
- argc, argv, base::Bind(&TestSuite::Run, base::Unretained(&test_suite)));
-}
diff --git a/mojo/services/public/interfaces/view_manager/view_manager.mojom b/mojo/services/public/interfaces/view_manager/view_manager.mojom
index 1636a6a..173fa31 100644
--- a/mojo/services/public/interfaces/view_manager/view_manager.mojom
+++ b/mojo/services/public/interfaces/view_manager/view_manager.mojom
@@ -53,11 +53,6 @@ interface IViewManager {
// Sets the view a node is showing.
SetView(uint32 node_id, uint32 view_id, uint32 change_id) => (bool success);
-
- // Shows the specified image (png encoded) in the specified view.
- SetViewContents(uint32 view_id,
- handle<shared_buffer> buffer,
- uint32 buffer_size);
};
[Peer=IViewManager]
diff --git a/mojo/services/view_manager/DEPS b/mojo/services/view_manager/DEPS
index 248384f..38c3d5e 100644
--- a/mojo/services/view_manager/DEPS
+++ b/mojo/services/view_manager/DEPS
@@ -1,9 +1,7 @@
include_rules = [
"+mojo/aura",
"+mojo/services",
- "+third_party/skia",
"+ui/aura",
- "+ui/base/cursor/cursor.h",
"+ui/base/hit_test.h",
"+ui/events",
"+ui/gfx",
diff --git a/mojo/services/view_manager/node.cc b/mojo/services/view_manager/node.cc
index 5f5af51..e2436da 100644
--- a/mojo/services/view_manager/node.cc
+++ b/mojo/services/view_manager/node.cc
@@ -7,11 +7,6 @@
#include "mojo/services/view_manager/node_delegate.h"
#include "mojo/services/view_manager/view.h"
#include "ui/aura/window_property.h"
-#include "ui/base/cursor/cursor.h"
-#include "ui/base/hit_test.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/image/image_skia.h"
-#include "ui/gfx/native_widget_types.h"
DECLARE_WINDOW_PROPERTY_TYPE(mojo::services::view_manager::Node*);
@@ -25,15 +20,11 @@ Node::Node(NodeDelegate* delegate, const NodeId& id)
: delegate_(delegate),
id_(id),
view_(NULL),
- window_(this) {
+ window_(NULL) {
DCHECK(delegate); // Must provide a delegate.
window_.set_owned_by_parent(false);
window_.AddObserver(this);
window_.SetProperty(kNodeKey, this);
- window_.Init(aura::WINDOW_LAYER_TEXTURED);
-
- // TODO(sky): this likely needs to be false and add a visibility API.
- window_.Show();
}
Node::~Node() {
@@ -89,73 +80,14 @@ void Node::OnWindowHierarchyChanged(
if (params.target != &window_ || params.receiver != &window_)
return;
NodeId new_parent_id;
- if (params.new_parent && params.new_parent->GetProperty(kNodeKey))
+ if (params.new_parent)
new_parent_id = params.new_parent->GetProperty(kNodeKey)->id();
NodeId old_parent_id;
- if (params.old_parent && params.old_parent->GetProperty(kNodeKey))
+ if (params.old_parent)
old_parent_id = params.old_parent->GetProperty(kNodeKey)->id();
delegate_->OnNodeHierarchyChanged(id_, new_parent_id, old_parent_id);
}
-gfx::Size Node::GetMinimumSize() const {
- return gfx::Size();
-}
-
-gfx::Size Node::GetMaximumSize() const {
- return gfx::Size();
-}
-
-void Node::OnBoundsChanged(const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
-}
-
-gfx::NativeCursor Node::GetCursor(const gfx::Point& point) {
- return gfx::kNullCursor;
-}
-
-int Node::GetNonClientComponent(const gfx::Point& point) const {
- return HTCAPTION;
-}
-
-bool Node::ShouldDescendIntoChildForEventHandling(
- aura::Window* child,
- const gfx::Point& location) {
- return true;
-}
-
-bool Node::CanFocus() {
- return true;
-}
-
-void Node::OnCaptureLost() {
-}
-
-void Node::OnPaint(gfx::Canvas* canvas) {
- if (view_) {
- canvas->DrawImageInt(
- gfx::ImageSkia::CreateFrom1xBitmap(view_->bitmap()), 0, 0);
- }
-}
-
-void Node::OnDeviceScaleFactorChanged(float device_scale_factor) {
-}
-
-void Node::OnWindowDestroying(aura::Window* window) {
-}
-
-void Node::OnWindowDestroyed(aura::Window* window) {
-}
-
-void Node::OnWindowTargetVisibilityChanged(bool visible) {
-}
-
-bool Node::HasHitTestMask() const {
- return false;
-}
-
-void Node::GetHitTestMask(gfx::Path* mask) const {
-}
-
} // namespace view_manager
} // namespace services
} // namespace mojo
diff --git a/mojo/services/view_manager/node.h b/mojo/services/view_manager/node.h
index d1b65ae..ed68874 100644
--- a/mojo/services/view_manager/node.h
+++ b/mojo/services/view_manager/node.h
@@ -11,7 +11,6 @@
#include "mojo/services/view_manager/ids.h"
#include "mojo/services/view_manager/view_manager_export.h"
#include "ui/aura/window.h"
-#include "ui/aura/window_delegate.h"
#include "ui/aura/window_observer.h"
namespace mojo {
@@ -22,9 +21,7 @@ class NodeDelegate;
class View;
// Represents a node in the graph. Delegate is informed of interesting events.
-class MOJO_VIEW_MANAGER_EXPORT Node
- : public aura::WindowObserver,
- public aura::WindowDelegate {
+class MOJO_VIEW_MANAGER_EXPORT Node : public aura::WindowObserver {
public:
Node(NodeDelegate* delegate, const NodeId& id);
virtual ~Node();
@@ -37,8 +34,6 @@ class MOJO_VIEW_MANAGER_EXPORT Node
void Add(Node* child);
void Remove(Node* child);
- aura::Window* window() { return &window_; }
-
Node* GetParent();
std::vector<Node*> GetChildren();
@@ -52,26 +47,6 @@ class MOJO_VIEW_MANAGER_EXPORT Node
virtual void OnWindowHierarchyChanged(
const aura::WindowObserver::HierarchyChangeParams& params) OVERRIDE;
- // WindowDelegate overrides:
- virtual gfx::Size GetMinimumSize() const OVERRIDE;
- virtual gfx::Size GetMaximumSize() const OVERRIDE;
- virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) OVERRIDE;
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE;
- virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
- virtual bool ShouldDescendIntoChildForEventHandling(
- aura::Window* child,
- const gfx::Point& location) OVERRIDE;
- virtual bool CanFocus() OVERRIDE;
- virtual void OnCaptureLost() OVERRIDE;
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
- virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
- virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
- virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
- virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE;
- virtual bool HasHitTestMask() const OVERRIDE;
- virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE;
-
NodeDelegate* delegate_;
const NodeId id_;
diff --git a/mojo/services/view_manager/root_node_manager.cc b/mojo/services/view_manager/root_node_manager.cc
index 529306d..1a17ebd 100644
--- a/mojo/services/view_manager/root_node_manager.cc
+++ b/mojo/services/view_manager/root_node_manager.cc
@@ -6,7 +6,6 @@
#include "base/logging.h"
#include "mojo/services/view_manager/view_manager_connection.h"
-#include "ui/aura/env.h"
namespace mojo {
namespace services {
@@ -18,14 +17,6 @@ const TransportConnectionSpecificNodeId kRootId = 1;
} // namespace
-RootNodeManager::Context::Context() {
- // Pass in false as native viewport creates the PlatformEventSource.
- aura::Env::CreateInstance(false);
-}
-
-RootNodeManager::Context::~Context() {
-}
-
RootNodeManager::ScopedChange::ScopedChange(ViewManagerConnection* connection,
RootNodeManager* root,
TransportChangeId change_id)
@@ -37,15 +28,12 @@ RootNodeManager::ScopedChange::~ScopedChange() {
root_->FinishChange();
}
-RootNodeManager::RootNodeManager(Shell* shell)
+RootNodeManager::RootNodeManager()
: next_connection_id_(1),
- root_view_manager_(shell, this),
root_(this, NodeId(0, kRootId)) {
}
RootNodeManager::~RootNodeManager() {
- // All the connections should have been destroyed.
- DCHECK(connection_map_.empty());
}
TransportConnectionId RootNodeManager::GetAndAdvanceNextConnectionId() {
@@ -119,11 +107,24 @@ void RootNodeManager::FinishChange() {
change_.reset();
}
+void RootNodeManager::OnCreated() {
+}
+
+void RootNodeManager::OnDestroyed() {
+}
+
+void RootNodeManager::OnBoundsChanged(const Rect& bounds) {
+}
+
+void RootNodeManager::OnEvent(const Event& event,
+ const mojo::Callback<void()>& callback) {
+ callback.Run();
+}
+
void RootNodeManager::OnNodeHierarchyChanged(const NodeId& node,
const NodeId& new_parent,
const NodeId& old_parent) {
- if (!root_view_manager_.in_setup())
- NotifyNodeHierarchyChanged(node, new_parent, old_parent);
+ NotifyNodeHierarchyChanged(node, new_parent, old_parent);
}
void RootNodeManager::OnNodeViewReplaced(const NodeId& node,
diff --git a/mojo/services/view_manager/root_node_manager.h b/mojo/services/view_manager/root_node_manager.h
index 91aa8e7..eee4c8c 100644
--- a/mojo/services/view_manager/root_node_manager.h
+++ b/mojo/services/view_manager/root_node_manager.h
@@ -8,16 +8,13 @@
#include <map>
#include "base/basictypes.h"
+#include "mojo/services/native_viewport/native_viewport.mojom.h"
#include "mojo/services/view_manager/ids.h"
#include "mojo/services/view_manager/node.h"
#include "mojo/services/view_manager/node_delegate.h"
-#include "mojo/services/view_manager/root_view_manager.h"
#include "mojo/services/view_manager/view_manager_export.h"
namespace mojo {
-
-class Shell;
-
namespace services {
namespace view_manager {
@@ -26,7 +23,9 @@ class ViewManagerConnection;
// RootNodeManager is responsible for managing the set of ViewManagerConnections
// as well as providing the root of the node hierarchy.
-class MOJO_VIEW_MANAGER_EXPORT RootNodeManager : public NodeDelegate {
+class MOJO_VIEW_MANAGER_EXPORT RootNodeManager
+ : public NativeViewportClient,
+ public NodeDelegate {
public:
// Create when a ViewManagerConnection is about to make a change. Ensures
// clients are notified of the correct change id.
@@ -43,7 +42,7 @@ class MOJO_VIEW_MANAGER_EXPORT RootNodeManager : public NodeDelegate {
DISALLOW_COPY_AND_ASSIGN(ScopedChange);
};
- explicit RootNodeManager(Shell* shell);
+ RootNodeManager();
virtual ~RootNodeManager();
// Returns the id for the next ViewManagerConnection.
@@ -61,8 +60,6 @@ class MOJO_VIEW_MANAGER_EXPORT RootNodeManager : public NodeDelegate {
// Returns the View identified by |id|.
View* GetView(const ViewId& id);
- Node* root() { return &root_; }
-
// These functions trivially delegate to all ViewManagerConnections, which in
// term notify their clients.
void NotifyNodeHierarchyChanged(const NodeId& node,
@@ -73,12 +70,6 @@ class MOJO_VIEW_MANAGER_EXPORT RootNodeManager : public NodeDelegate {
const ViewId& old_view_id);
private:
- // Used to setup any static state needed by RootNodeManager.
- struct Context {
- Context();
- ~Context();
- };
-
// Tracks a change.
struct Change {
Change(TransportConnectionId connection_id, TransportChangeId change_id)
@@ -104,6 +95,13 @@ class MOJO_VIEW_MANAGER_EXPORT RootNodeManager : public NodeDelegate {
// Balances a call to PrepareForChange().
void FinishChange();
+ // Overridden from NativeViewportClient:
+ virtual void OnCreated() OVERRIDE;
+ virtual void OnDestroyed() OVERRIDE;
+ virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE;
+ virtual void OnEvent(const Event& event,
+ const mojo::Callback<void()>& callback) OVERRIDE;
+
// Overriden from NodeDelegate:
virtual void OnNodeHierarchyChanged(const NodeId& node,
const NodeId& new_parent,
@@ -112,22 +110,18 @@ class MOJO_VIEW_MANAGER_EXPORT RootNodeManager : public NodeDelegate {
const ViewId& new_view_id,
const ViewId& old_view_id) OVERRIDE;
- Context context_;
-
// ID to use for next ViewManagerConnection.
TransportConnectionId next_connection_id_;
// Set of ViewManagerConnections.
ConnectionMap connection_map_;
- // If non-null we're processing a change.
- scoped_ptr<Change> change_;
-
- RootViewManager root_view_manager_;
-
// Root node.
Node root_;
+ // If non-null we're processing a change.
+ scoped_ptr<Change> change_;
+
DISALLOW_COPY_AND_ASSIGN(RootNodeManager);
};
diff --git a/mojo/services/view_manager/root_view_manager.cc b/mojo/services/view_manager/root_view_manager.cc
deleted file mode 100644
index 791d1b9..0000000
--- a/mojo/services/view_manager/root_view_manager.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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/services/view_manager/root_view_manager.h"
-
-#include "base/auto_reset.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/interfaces/shell/shell.mojom.h"
-#include "mojo/services/view_manager/root_node_manager.h"
-#include "ui/aura/client/default_capture_client.h"
-#include "ui/aura/client/window_tree_client.h"
-#include "ui/aura/window.h"
-
-namespace mojo {
-namespace services {
-namespace view_manager {
-
-class WindowTreeClientImpl : public aura::client::WindowTreeClient {
- public:
- explicit WindowTreeClientImpl(aura::Window* window) : window_(window) {
- aura::client::SetWindowTreeClient(window_, this);
- }
-
- virtual ~WindowTreeClientImpl() {
- aura::client::SetWindowTreeClient(window_, NULL);
- }
-
- // Overridden from aura::client::WindowTreeClient:
- virtual aura::Window* GetDefaultParent(aura::Window* context,
- aura::Window* window,
- const gfx::Rect& bounds) OVERRIDE {
- if (!capture_client_) {
- capture_client_.reset(
- new aura::client::DefaultCaptureClient(window_->GetRootWindow()));
- }
- return window_;
- }
-
- private:
- aura::Window* window_;
-
- scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTreeClientImpl);
-};
-
-RootViewManager::RootViewManager(Shell* shell, RootNodeManager* root_node)
- : shell_(shell),
- root_node_manager_(root_node),
- in_setup_(false) {
- screen_.reset(ScreenMojo::Create());
- gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
- InterfacePipe<NativeViewport, AnyInterface> pipe;
- mojo::AllocationScope scope;
- shell_->Connect("mojo:mojo_native_viewport_service",
- pipe.handle_to_peer.Pass());
- window_tree_host_.reset(new WindowTreeHostMojo(
- pipe.handle_to_self.Pass(),
- gfx::Rect(800, 600),
- base::Bind(&RootViewManager::OnCompositorCreated,
- base::Unretained(this))));
-}
-
-RootViewManager::~RootViewManager() {
- window_tree_client_.reset();
- window_tree_host_.reset();
- gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL);
-}
-
-void RootViewManager::OnCompositorCreated() {
- base::AutoReset<bool> resetter(&in_setup_, true);
- window_tree_host_->InitHost();
-
- aura::Window* root = root_node_manager_->root()->window();
- window_tree_host_->window()->AddChild(root);
- root->SetBounds(gfx::Rect(window_tree_host_->window()->bounds().size()));
- root_node_manager_->root()->window()->Show();
-
- window_tree_client_.reset(
- new WindowTreeClientImpl(window_tree_host_->window()));
-
- window_tree_host_->Show();
-}
-
-} // namespace view_manager
-} // namespace services
-} // namespace mojo
diff --git a/mojo/services/view_manager/root_view_manager.h b/mojo/services/view_manager/root_view_manager.h
deleted file mode 100644
index 049faa8..0000000
--- a/mojo/services/view_manager/root_view_manager.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// 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_SERVICES_VIEW_MANAGER_ROOT_VIEW_MANAGER_H_
-#define MOJO_SERVICES_VIEW_MANAGER_ROOT_VIEW_MANAGER_H_
-
-#include <map>
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "mojo/public/cpp/gles2/gles2.h"
-#include "mojo/services/view_manager/view_manager_export.h"
-
-namespace aura {
-namespace client {
-class WindowTreeClient;
-}
-class WindowTreeHost;
-}
-
-namespace gfx {
-class Screen;
-}
-
-namespace mojo {
-
-class Shell;
-
-namespace services {
-namespace view_manager {
-
-class RootNodeManager;
-
-// RootViewManager binds the root node to an actual display.
-class MOJO_VIEW_MANAGER_EXPORT RootViewManager {
- public:
- RootViewManager(Shell* shell, RootNodeManager* root_node);
- virtual ~RootViewManager();
-
- // See description above field for details.
- bool in_setup() const { return in_setup_; }
-
- private:
- void OnCompositorCreated();
-
- Shell* shell_;
- RootNodeManager* root_node_manager_;
-
- GLES2Initializer gles_initializer_;
-
- // Returns true if adding the root node's window to |window_tree_host_|.
- bool in_setup_;
-
- scoped_ptr<gfx::Screen> screen_;
- scoped_ptr<aura::WindowTreeHost> window_tree_host_;
- scoped_ptr<aura::client::WindowTreeClient> window_tree_client_;
-
- DISALLOW_COPY_AND_ASSIGN(RootViewManager);
-};
-
-} // namespace view_manager
-} // namespace services
-} // namespace mojo
-
-#endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_VIEW_MANAGER_H_
diff --git a/mojo/services/view_manager/view.cc b/mojo/services/view_manager/view.cc
index 18c98d1..0e9fc13 100644
--- a/mojo/services/view_manager/view.cc
+++ b/mojo/services/view_manager/view.cc
@@ -15,14 +15,6 @@ View::View(const ViewId& id) : id_(id), node_(NULL) {}
View::~View() {
}
-void View::SetBitmap(const SkBitmap& bitmap) {
- bitmap_ = bitmap;
- if (node_) {
- node_->window()->SchedulePaintInRect(
- gfx::Rect(node_->window()->bounds().size()));
- }
-}
-
} // namespace view_manager
} // namespace services
} // namespace mojo
diff --git a/mojo/services/view_manager/view.h b/mojo/services/view_manager/view.h
index 32b7e03..83251c0 100644
--- a/mojo/services/view_manager/view.h
+++ b/mojo/services/view_manager/view.h
@@ -10,7 +10,6 @@
#include "base/logging.h"
#include "mojo/services/view_manager/ids.h"
#include "mojo/services/view_manager/view_manager_export.h"
-#include "third_party/skia/include/core/SkBitmap.h"
namespace mojo {
namespace services {
@@ -28,9 +27,6 @@ class MOJO_VIEW_MANAGER_EXPORT View {
Node* node() { return node_; }
- void SetBitmap(const SkBitmap& contents);
- const SkBitmap& bitmap() const { return bitmap_; }
-
private:
// Node is responsible for maintaining |node_|.
friend class Node;
@@ -39,7 +35,6 @@ class MOJO_VIEW_MANAGER_EXPORT View {
const ViewId id_;
Node* node_;
- SkBitmap bitmap_;
DISALLOW_COPY_AND_ASSIGN(View);
};
diff --git a/mojo/services/view_manager/main.cc b/mojo/services/view_manager/view_manager.cc
index 1fd4528..e2e09f5 100644
--- a/mojo/services/view_manager/main.cc
+++ b/mojo/services/view_manager/view_manager.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/at_exit.h"
-#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "mojo/public/cpp/shell/application.h"
#include "mojo/services/view_manager/root_node_manager.h"
@@ -21,11 +19,9 @@
extern "C" VIEW_MANAGER_EXPORT MojoResult CDECL MojoMain(
MojoHandle shell_handle) {
- CommandLine::Init(0, NULL);
- base::AtExitManager at_exit;
base::MessageLoop loop;
mojo::Application app(shell_handle);
- mojo::services::view_manager::RootNodeManager root_node_manager(app.shell());
+ mojo::services::view_manager::RootNodeManager root_node_manager;
app.AddServiceConnector(new mojo::ServiceConnector
<mojo::services::view_manager::ViewManagerConnection,
mojo::services::view_manager::RootNodeManager>(
diff --git a/mojo/services/view_manager/view_manager_connection.cc b/mojo/services/view_manager/view_manager_connection.cc
index b11badd..37e5f05 100644
--- a/mojo/services/view_manager/view_manager_connection.cc
+++ b/mojo/services/view_manager/view_manager_connection.cc
@@ -9,8 +9,6 @@
#include "mojo/services/view_manager/node.h"
#include "mojo/services/view_manager/root_node_manager.h"
#include "mojo/services/view_manager/view.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/gfx/codec/png_codec.h"
namespace mojo {
namespace services {
@@ -273,25 +271,6 @@ void ViewManagerConnection::SetView(
change_id));
}
-void ViewManagerConnection::SetViewContents(
- TransportViewId view_id,
- ScopedSharedBufferHandle buffer,
- uint32_t buffer_size) {
- View* view = GetView(ViewIdFromTransportId(view_id));
- if (!view)
- return;
- void* handle_data;
- if (MapBuffer(buffer.get(), 0, buffer_size, &handle_data,
- MOJO_MAP_BUFFER_FLAG_NONE) != MOJO_RESULT_OK) {
- return;
- }
- SkBitmap bitmap;
- gfx::PNGCodec::Decode(static_cast<const unsigned char*>(handle_data),
- buffer_size, &bitmap);
- view->SetBitmap(bitmap);
- UnmapBuffer(handle_data);
-}
-
void ViewManagerConnection::OnNodeHierarchyChanged(const NodeId& node,
const NodeId& new_parent,
const NodeId& old_parent) {
diff --git a/mojo/services/view_manager/view_manager_connection.h b/mojo/services/view_manager/view_manager_connection.h
index ebb7a25..3dc79a3 100644
--- a/mojo/services/view_manager/view_manager_connection.h
+++ b/mojo/services/view_manager/view_manager_connection.h
@@ -101,9 +101,6 @@ class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection
TransportViewId transport_view_id,
TransportChangeId change_id,
const Callback<void(bool)>& callback) OVERRIDE;
- virtual void SetViewContents(TransportViewId view_id,
- ScopedSharedBufferHandle buffer,
- uint32_t buffer_size) OVERRIDE;
// Overridden from NodeDelegate:
virtual void OnNodeHierarchyChanged(const NodeId& node,
diff --git a/mojo/shell/context.cc b/mojo/shell/context.cc
index 9879a17..f5d405f 100644
--- a/mojo/shell/context.cc
+++ b/mojo/shell/context.cc
@@ -27,7 +27,8 @@
#endif // defined(OS_LINUX)
#if defined(USE_AURA)
-#include "mojo/shell/view_manager_loader.h"
+#include "mojo/services/view_manager/root_node_manager.h"
+#include "mojo/services/view_manager/view_manager_connection.h"
#endif
namespace mojo {
@@ -51,6 +52,35 @@ class Setup {
static base::LazyInstance<Setup> setup = LAZY_INSTANCE_INITIALIZER;
+#if defined(USE_AURA)
+class ViewManagerLoader : public ServiceLoader {
+ public:
+ ViewManagerLoader() {}
+ virtual ~ViewManagerLoader() {}
+
+ private:
+ virtual void LoadService(ServiceManager* manager,
+ const GURL& url,
+ ScopedShellHandle shell_handle) OVERRIDE {
+ scoped_ptr<Application> app(new Application(shell_handle.Pass()));
+ app->AddServiceConnector(
+ new ServiceConnector<services::view_manager::ViewManagerConnection,
+ services::view_manager::RootNodeManager>(
+ &root_node_manager_));
+ apps_.push_back(app.release());
+ }
+
+ virtual void OnServiceError(ServiceManager* manager,
+ const GURL& url) OVERRIDE {
+ }
+
+ services::view_manager::RootNodeManager root_node_manager_;
+ ScopedVector<Application> apps_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewManagerLoader);
+};
+#endif
+
} // namespace
class Context::NativeViewportServiceLoader : public ServiceLoader {
diff --git a/mojo/shell/view_manager_loader.cc b/mojo/shell/view_manager_loader.cc
deleted file mode 100644
index a3d0cbd..0000000
--- a/mojo/shell/view_manager_loader.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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/shell/view_manager_loader.h"
-
-#include "mojo/public/cpp/shell/application.h"
-#include "mojo/services/view_manager/root_node_manager.h"
-#include "mojo/services/view_manager/view_manager_connection.h"
-
-namespace mojo {
-namespace shell {
-
-ViewManagerLoader::ViewManagerLoader() {
-}
-
-ViewManagerLoader::~ViewManagerLoader() {
-}
-
-void ViewManagerLoader::LoadService(ServiceManager* manager,
- const GURL& url,
- ScopedShellHandle shell_handle) {
- scoped_ptr<Application> app(new Application(shell_handle.Pass()));
- if (!root_node_manager_.get()) {
- root_node_manager_.reset(
- new services::view_manager::RootNodeManager(app->shell()));
- }
- app->AddServiceConnector(
- new ServiceConnector<services::view_manager::ViewManagerConnection,
- services::view_manager::RootNodeManager>(
- root_node_manager_.get()));
- apps_.push_back(app.release());
-}
-
-void ViewManagerLoader::OnServiceError(ServiceManager* manager,
- const GURL& url) {
-}
-
-} // namespace shell
-} // namespace mojo
diff --git a/mojo/shell/view_manager_loader.h b/mojo/shell/view_manager_loader.h
deleted file mode 100644
index 021f2a4..0000000
--- a/mojo/shell/view_manager_loader.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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_SHELL_VIEW_MANAGER_LOADER_H_
-#define MOJO_SHELL_VIEW_MANAGER_LOADER_H_
-
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/scoped_vector.h"
-#include "mojo/service_manager/service_loader.h"
-
-namespace mojo {
-namespace services {
-namespace view_manager {
-class RootNodeManager;
-}
-}
-
-class Application;
-
-namespace shell {
-
-// ServiceLoader responsible for creating connections to the ViewManager.
-class ViewManagerLoader : public ServiceLoader {
- public:
- ViewManagerLoader();
- virtual ~ViewManagerLoader();
-
- private:
- // ServiceLoader overrides:
- virtual void LoadService(ServiceManager* manager,
- const GURL& url,
- ScopedShellHandle shell_handle) OVERRIDE;
- virtual void OnServiceError(ServiceManager* manager,
- const GURL& url) OVERRIDE;
-
- scoped_ptr<services::view_manager::RootNodeManager> root_node_manager_;
- ScopedVector<Application> apps_;
-
- DISALLOW_COPY_AND_ASSIGN(ViewManagerLoader);
-};
-
-} // namespace shell
-} // namespace mojo
-
-#endif // MOJO_SHELL_VIEW_MANAGER_LOADER_H_
diff --git a/ui/aura/window_tree_host.cc b/ui/aura/window_tree_host.cc
index 2118c2e..39f4c95 100644
--- a/ui/aura/window_tree_host.cc
+++ b/ui/aura/window_tree_host.cc
@@ -178,6 +178,7 @@ WindowTreeHost::WindowTreeHost()
}
void WindowTreeHost::DestroyCompositor() {
+ DCHECK(GetAcceleratedWidget());
compositor_.reset();
}