summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-17 16:09:19 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-17 16:09:19 +0000
commit80b36533b7985789b606b8c4278dc0674c72e188 (patch)
tree482c19e80f50867019aef4a242d5b45b84d5f461
parent4851dd2968902ea74086c1e3bb10a17713c7d7ab (diff)
downloadchromium_src-80b36533b7985789b606b8c4278dc0674c72e188.zip
chromium_src-80b36533b7985789b606b8c4278dc0674c72e188.tar.gz
chromium_src-80b36533b7985789b606b8c4278dc0674c72e188.tar.bz2
Client side name cleanup
ViewTreeNode*->Node* ViewManagerSynchcronizer->ViewManagerClientImpl R=sky@chromium.org TBR=sky@chromium.org http://crbug.com/384443 Review URL: https://codereview.chromium.org/338093008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277775 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--mojo/examples/browser/browser.cc14
-rw-r--r--mojo/examples/embedded_app/embedded_app.cc29
-rw-r--r--mojo/examples/html_viewer/html_viewer.cc6
-rw-r--r--mojo/examples/image_viewer/image_viewer.cc6
-rw-r--r--mojo/examples/nesting_app/nesting_app.cc18
-rw-r--r--mojo/examples/window_manager/window_manager.cc17
-rw-r--r--mojo/mojo_services.gypi24
-rw-r--r--mojo/services/launcher/launcher.cc2
-rw-r--r--mojo/services/public/cpp/view_manager/lib/node.cc (renamed from mojo/services/public/cpp/view_manager/lib/view_tree_node.cc)226
-rw-r--r--mojo/services/public/cpp/view_manager/lib/node_observer.cc (renamed from mojo/services/public/cpp/view_manager/lib/view_tree_node_observer.cc)8
-rw-r--r--mojo/services/public/cpp/view_manager/lib/node_private.cc (renamed from mojo/services/public/cpp/view_manager/lib/view_tree_node_private.cc)10
-rw-r--r--mojo/services/public/cpp/view_manager/lib/node_private.h (renamed from mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h)28
-rw-r--r--mojo/services/public/cpp/view_manager/lib/view.cc18
-rw-r--r--mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc (renamed from mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.cc)281
-rw-r--r--mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h (renamed from mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h)40
-rw-r--r--mojo/services/public/cpp/view_manager/lib/view_private.h2
-rw-r--r--mojo/services/public/cpp/view_manager/lib/view_tree_host.cc0
-rw-r--r--mojo/services/public/cpp/view_manager/node.h (renamed from mojo/services/public/cpp/view_manager/view_tree_node.h)60
-rw-r--r--mojo/services/public/cpp/view_manager/node_observer.h (renamed from mojo/services/public/cpp/view_manager/view_tree_node_observer.h)33
-rw-r--r--mojo/services/public/cpp/view_manager/tests/node_unittest.cc (renamed from mojo/services/public/cpp/view_manager/tests/view_tree_node_unittest.cc)210
-rw-r--r--mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc188
-rw-r--r--mojo/services/public/cpp/view_manager/tests/view_tree_host_unittest.cc0
-rw-r--r--mojo/services/public/cpp/view_manager/types.h (renamed from mojo/services/public/cpp/view_manager/view_manager_types.h)6
-rw-r--r--mojo/services/public/cpp/view_manager/util.h2
-rw-r--r--mojo/services/public/cpp/view_manager/view.h8
-rw-r--r--mojo/services/public/cpp/view_manager/view_manager.h8
-rw-r--r--mojo/services/public/cpp/view_manager/view_manager_delegate.h6
-rw-r--r--mojo/services/public/cpp/view_manager/view_tree_host.h22
-rw-r--r--mojo/services/view_manager/ids.h2
-rw-r--r--mojo/services/view_manager/test_change_tracker.h2
-rw-r--r--mojo/services/view_manager/view_manager_unittest.cc2
31 files changed, 615 insertions, 663 deletions
diff --git a/mojo/examples/browser/browser.cc b/mojo/examples/browser/browser.cc
index 35162c9..dbe5a8f 100644
--- a/mojo/examples/browser/browser.cc
+++ b/mojo/examples/browser/browser.cc
@@ -4,11 +4,11 @@
#include "base/basictypes.h"
#include "mojo/public/cpp/application/application.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
#include "mojo/services/public/cpp/view_manager/view_observer.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node.h"
#include "mojo/services/public/interfaces/launcher/launcher.mojom.h"
#include "mojo/views/native_widget_view_manager.h"
#include "mojo/views/views_init.h"
@@ -24,7 +24,7 @@ namespace examples {
class NodeView : public views::View {
public:
- explicit NodeView(view_manager::ViewTreeNode* node) : node_(node) {
+ explicit NodeView(view_manager::Node* node) : node_(node) {
// This class is provisional and assumes that the node has already been
// added to a parent. I suspect we'll want to make an improved version of
// this that lives in ui/views akin to NativeViewHost that properly
@@ -39,7 +39,7 @@ class NodeView : public views::View {
}
private:
- view_manager::ViewTreeNode* node_;
+ view_manager::Node* node_;
DISALLOW_COPY_AND_ASSIGN(NodeView);
};
@@ -114,13 +114,13 @@ class Browser : public Application,
// view_manager::ViewManagerDelegate:
virtual void OnRootAdded(view_manager::ViewManager* view_manager,
- view_manager::ViewTreeNode* root) OVERRIDE {
+ view_manager::Node* root) OVERRIDE {
// TODO: deal with OnRootAdded() being invoked multiple times.
view_manager_ = view_manager;
view_ = view_manager::View::Create(view_manager_);
view_manager_->GetRoots().front()->SetActiveView(view_);
- content_node_ = view_manager::ViewTreeNode::Create(view_manager_);
+ content_node_ = view_manager::Node::Create(view_manager_);
root->AddChild(content_node_);
root->SetFocus();
@@ -128,7 +128,7 @@ class Browser : public Application,
CreateWidget(root->bounds().size());
}
virtual void OnRootRemoved(view_manager::ViewManager* view_manager,
- view_manager::ViewTreeNode* root) OVERRIDE {
+ view_manager::Node* root) OVERRIDE {
}
// views::TextfieldController:
@@ -160,7 +160,7 @@ class Browser : public Application,
view_manager::ViewManager* view_manager_;
view_manager::View* view_;
- view_manager::ViewTreeNode* content_node_;
+ view_manager::Node* content_node_;
launcher::LauncherPtr launcher_;
DISALLOW_COPY_AND_ASSIGN(Browser);
diff --git a/mojo/examples/embedded_app/embedded_app.cc b/mojo/examples/embedded_app/embedded_app.cc
index 003cb82..1a620b4 100644
--- a/mojo/examples/embedded_app/embedded_app.cc
+++ b/mojo/examples/embedded_app/embedded_app.cc
@@ -9,22 +9,22 @@
#include "mojo/examples/window_manager/window_manager.mojom.h"
#include "mojo/public/cpp/application/application.h"
#include "mojo/services/navigation/navigation.mojom.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
+#include "mojo/services/public/cpp/view_manager/node_observer.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
#include "mojo/services/public/cpp/view_manager/view_observer.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node_observer.h"
#include "ui/events/event_constants.h"
#include "url/gurl.h"
#include "url/url_util.h"
+using mojo::view_manager::Node;
+using mojo::view_manager::NodeObserver;
using mojo::view_manager::View;
using mojo::view_manager::ViewManager;
using mojo::view_manager::ViewManagerDelegate;
using mojo::view_manager::ViewObserver;
-using mojo::view_manager::ViewTreeNode;
-using mojo::view_manager::ViewTreeNodeObserver;
namespace mojo {
namespace examples {
@@ -32,7 +32,7 @@ namespace examples {
class EmbeddedApp : public Application,
public ViewManagerDelegate,
public ViewObserver,
- public ViewTreeNodeObserver {
+ public NodeObserver {
public:
EmbeddedApp() : view_manager_(NULL) {
url::AddStandardScheme("mojo");
@@ -79,8 +79,7 @@ class EmbeddedApp : public Application,
}
// Overridden from ViewManagerDelegate:
- virtual void OnRootAdded(ViewManager* view_manager,
- ViewTreeNode* root) OVERRIDE {
+ virtual void OnRootAdded(ViewManager* view_manager, Node* root) OVERRIDE {
View* view = View::Create(view_manager);
view->AddObserver(this);
root->SetActiveView(view);
@@ -89,12 +88,10 @@ class EmbeddedApp : public Application,
roots_[root->id()] = root;
ProcessPendingNodeColor(root->id());
}
- virtual void OnRootRemoved(ViewManager* view_manager,
- ViewTreeNode* root) OVERRIDE {
+ virtual void OnRootRemoved(ViewManager* view_manager, Node* root) OVERRIDE {
roots_.erase(root->id());
- std::map<ViewTreeNode*, View*>::const_iterator it =
- views_to_reap_.find(root);
+ std::map<Node*, View*>::const_iterator it = views_to_reap_.find(root);
if (it != views_to_reap_.end())
it->second->Destroy();
}
@@ -105,12 +102,12 @@ class EmbeddedApp : public Application,
window_manager_->CloseWindow(view->node()->id());
}
- // Overridden from ViewTreeNodeObserver:
+ // Overridden from NodeObserver:
virtual void OnNodeActiveViewChange(
- ViewTreeNode* node,
+ Node* node,
View* old_view,
View* new_view,
- ViewTreeNodeObserver::DispositionChangePhase phase) OVERRIDE {
+ NodeObserver::DispositionChangePhase phase) OVERRIDE {
if (new_view == 0)
views_to_reap_[node] = old_view;
}
@@ -131,9 +128,9 @@ class EmbeddedApp : public Application,
view_manager::ViewManager* view_manager_;
IWindowManagerPtr window_manager_;
- std::map<ViewTreeNode*, View*> views_to_reap_;
+ std::map<Node*, View*> views_to_reap_;
- typedef std::map<uint32, ViewTreeNode*> RootMap;
+ typedef std::map<uint32, Node*> RootMap;
RootMap roots_;
// We can receive navigations for nodes we don't have yet.
diff --git a/mojo/examples/html_viewer/html_viewer.cc b/mojo/examples/html_viewer/html_viewer.cc
index de37c51..a1a44d2 100644
--- a/mojo/examples/html_viewer/html_viewer.cc
+++ b/mojo/examples/html_viewer/html_viewer.cc
@@ -3,11 +3,11 @@
// found in the LICENSE file.
#include "mojo/public/cpp/application/application.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
+#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
-#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node.h"
#include "mojo/services/public/interfaces/launcher/launcher.mojom.h"
namespace mojo {
@@ -75,7 +75,7 @@ class HTMLViewer : public Application,
// Overridden from view_manager::ViewManagerDelegate:
virtual void OnRootAdded(view_manager::ViewManager* view_manager,
- view_manager::ViewTreeNode* root) OVERRIDE {
+ view_manager::Node* root) OVERRIDE {
content_view_ = view_manager::View::Create(view_manager);
root->SetActiveView(content_view_);
content_view_->SetColor(SK_ColorRED);
diff --git a/mojo/examples/image_viewer/image_viewer.cc b/mojo/examples/image_viewer/image_viewer.cc
index 73c4c12..51afd8f 100644
--- a/mojo/examples/image_viewer/image_viewer.cc
+++ b/mojo/examples/image_viewer/image_viewer.cc
@@ -6,11 +6,11 @@
#include "base/strings/string_tokenizer.h"
#include "mojo/public/cpp/application/application.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
+#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
-#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node.h"
#include "mojo/services/public/interfaces/launcher/launcher.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/codec/png_codec.h"
@@ -103,7 +103,7 @@ class ImageViewer : public Application,
// Overridden from view_manager::ViewManagerDelegate:
virtual void OnRootAdded(view_manager::ViewManager* view_manager,
- view_manager::ViewTreeNode* root) OVERRIDE {
+ view_manager::Node* root) OVERRIDE {
content_view_ = view_manager::View::Create(view_manager);
root->SetActiveView(content_view_);
content_view_->SetColor(SK_ColorRED);
diff --git a/mojo/examples/nesting_app/nesting_app.cc b/mojo/examples/nesting_app/nesting_app.cc
index b882f4a..dee9497 100644
--- a/mojo/examples/nesting_app/nesting_app.cc
+++ b/mojo/examples/nesting_app/nesting_app.cc
@@ -8,21 +8,21 @@
#include "mojo/examples/window_manager/window_manager.mojom.h"
#include "mojo/public/cpp/application/application.h"
#include "mojo/services/navigation/navigation.mojom.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
+#include "mojo/services/public/cpp/view_manager/node_observer.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
#include "mojo/services/public/cpp/view_manager/view_observer.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node_observer.h"
#include "ui/events/event_constants.h"
#include "url/gurl.h"
+using mojo::view_manager::Node;
+using mojo::view_manager::NodeObserver;
using mojo::view_manager::View;
using mojo::view_manager::ViewManager;
using mojo::view_manager::ViewManagerDelegate;
using mojo::view_manager::ViewObserver;
-using mojo::view_manager::ViewTreeNode;
-using mojo::view_manager::ViewTreeNodeObserver;
namespace mojo {
namespace examples {
@@ -66,14 +66,13 @@ class NestingApp : public Application,
}
// Overridden from ViewManagerDelegate:
- virtual void OnRootAdded(ViewManager* view_manager,
- ViewTreeNode* root) OVERRIDE {
+ virtual void OnRootAdded(ViewManager* view_manager, Node* root) OVERRIDE {
View* view = View::Create(view_manager);
root->SetActiveView(view);
view->SetColor(SK_ColorCYAN);
view->AddObserver(this);
- nested_ = ViewTreeNode::Create(view_manager);
+ nested_ = Node::Create(view_manager);
root->AddChild(nested_);
nested_->SetBounds(gfx::Rect(20, 20, 50, 50));
nested_->Embed(kEmbeddedAppURL);
@@ -84,8 +83,7 @@ class NestingApp : public Application,
NavigateChild();
}
- virtual void OnRootRemoved(ViewManager* view_manager,
- ViewTreeNode* root) OVERRIDE {
+ virtual void OnRootRemoved(ViewManager* view_manager, Node* root) OVERRIDE {
// TODO(beng): reap views & child nodes.
nested_ = NULL;
}
@@ -107,7 +105,7 @@ class NestingApp : public Application,
}
std::string color_;
- ViewTreeNode* nested_;
+ Node* nested_;
navigation::NavigatorPtr navigator_;
IWindowManagerPtr window_manager_;
diff --git a/mojo/examples/window_manager/window_manager.cc b/mojo/examples/window_manager/window_manager.cc
index a385873..a96bece 100644
--- a/mojo/examples/window_manager/window_manager.cc
+++ b/mojo/examples/window_manager/window_manager.cc
@@ -8,11 +8,11 @@
#include "mojo/examples/window_manager/window_manager.mojom.h"
#include "mojo/public/cpp/application/application.h"
#include "mojo/services/navigation/navigation.mojom.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
#include "mojo/services/public/cpp/view_manager/view_observer.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node.h"
#include "ui/events/event_constants.h"
#if defined CreateWindow
@@ -20,12 +20,12 @@
#endif
using mojo::view_manager::Id;
+using mojo::view_manager::Node;
+using mojo::view_manager::NodeObserver;
using mojo::view_manager::View;
using mojo::view_manager::ViewManager;
using mojo::view_manager::ViewManagerDelegate;
using mojo::view_manager::ViewObserver;
-using mojo::view_manager::ViewTreeNode;
-using mojo::view_manager::ViewTreeNodeObserver;
namespace mojo {
namespace examples {
@@ -68,7 +68,7 @@ class WindowManager : public Application,
virtual ~WindowManager() {}
void CloseWindow(Id node_id) {
- ViewTreeNode* node = view_manager_->GetNodeById(node_id);
+ Node* node = view_manager_->GetNodeById(node_id);
DCHECK(node);
node->Destroy();
}
@@ -93,12 +93,11 @@ class WindowManager : public Application,
}
// Overridden from ViewManagerDelegate:
- virtual void OnRootAdded(ViewManager* view_manager,
- ViewTreeNode* root) OVERRIDE {
+ virtual void OnRootAdded(ViewManager* view_manager, Node* root) OVERRIDE {
DCHECK(!view_manager_);
view_manager_ = view_manager;
- ViewTreeNode* node = ViewTreeNode::Create(view_manager);
+ Node* node = Node::Create(view_manager);
view_manager->GetRoots().front()->AddChild(node);
node->SetBounds(gfx::Rect(800, 600));
parent_node_id_ = node->id();
@@ -110,7 +109,7 @@ class WindowManager : public Application,
}
void CreateWindow(const std::string& url) {
- ViewTreeNode* node = view_manager_->GetNodeById(parent_node_id_);
+ Node* node = view_manager_->GetNodeById(parent_node_id_);
gfx::Rect bounds(50, 50, 400, 400);
if (!node->children().empty()) {
@@ -119,7 +118,7 @@ class WindowManager : public Application,
bounds.set_origin(position);
}
- ViewTreeNode* embedded = ViewTreeNode::Create(view_manager_);
+ Node* embedded = Node::Create(view_manager_);
node->AddChild(embedded);
embedded->SetBounds(bounds);
embedded->Embed(url);
diff --git a/mojo/mojo_services.gypi b/mojo/mojo_services.gypi
index a0bd0a5..856f18e 100644
--- a/mojo/mojo_services.gypi
+++ b/mojo/mojo_services.gypi
@@ -242,7 +242,7 @@
'target_name': 'mojo_view_manager_common',
'type': 'static_library',
'sources': [
- 'services/public/cpp/view_manager/view_manager_types.h',
+ 'services/public/cpp/view_manager/types.h',
],
},
{
@@ -311,24 +311,21 @@
'mojo_view_manager_common',
],
'sources': [
+ 'services/public/cpp/view_manager/lib/node.cc',
+ 'services/public/cpp/view_manager/lib/node_observer.cc',
+ 'services/public/cpp/view_manager/lib/node_private.cc',
+ 'services/public/cpp/view_manager/lib/node_private.h',
'services/public/cpp/view_manager/lib/view.cc',
'services/public/cpp/view_manager/lib/view_private.cc',
'services/public/cpp/view_manager/lib/view_private.h',
- 'services/public/cpp/view_manager/lib/view_manager_synchronizer.cc',
- 'services/public/cpp/view_manager/lib/view_manager_synchronizer.h',
- 'services/public/cpp/view_manager/lib/view_tree_host.cc',
- 'services/public/cpp/view_manager/lib/view_tree_node.cc',
- 'services/public/cpp/view_manager/lib/view_tree_node_observer.cc',
- 'services/public/cpp/view_manager/lib/view_tree_node_private.cc',
- 'services/public/cpp/view_manager/lib/view_tree_node_private.h',
+ 'services/public/cpp/view_manager/lib/view_manager_client_impl.cc',
+ 'services/public/cpp/view_manager/lib/view_manager_client_impl.h',
+ 'services/public/cpp/view_manager/node.h',
+ 'services/public/cpp/view_manager/node_observer.h',
'services/public/cpp/view_manager/view.h',
'services/public/cpp/view_manager/view_manager.h',
'services/public/cpp/view_manager/view_manager_delegate.h',
- 'services/public/cpp/view_manager/view_manager_types.h',
'services/public/cpp/view_manager/view_observer.h',
- 'services/public/cpp/view_manager/view_tree_host.h',
- 'services/public/cpp/view_manager/view_tree_node.h',
- 'services/public/cpp/view_manager/view_tree_node_observer.h',
],
},
{
@@ -346,10 +343,9 @@
'mojo_view_manager_lib',
],
'sources': [
+ 'services/public/cpp/view_manager/tests/node_unittest.cc',
'services/public/cpp/view_manager/tests/view_unittest.cc',
'services/public/cpp/view_manager/tests/view_manager_unittest.cc',
- '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', {
diff --git a/mojo/services/launcher/launcher.cc b/mojo/services/launcher/launcher.cc
index b3a34a8..01a4983 100644
--- a/mojo/services/launcher/launcher.cc
+++ b/mojo/services/launcher/launcher.cc
@@ -6,7 +6,7 @@
#include "base/message_loop/message_loop.h"
#include "base/strings/string_tokenizer.h"
#include "mojo/public/cpp/application/application.h"
-#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
+#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/interfaces/launcher/launcher.mojom.h"
#include "mojo/services/public/interfaces/network/network_service.mojom.h"
#include "mojo/services/public/interfaces/network/url_loader.mojom.h"
diff --git a/mojo/services/public/cpp/view_manager/lib/view_tree_node.cc b/mojo/services/public/cpp/view_manager/lib/node.cc
index 65857c9..e3ce2c9 100644
--- a/mojo/services/public/cpp/view_manager/lib/view_tree_node.cc
+++ b/mojo/services/public/cpp/view_manager/lib/node.cc
@@ -2,13 +2,13 @@
// 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/view_tree_node.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
-#include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h"
+#include "mojo/services/public/cpp/view_manager/lib/node_private.h"
+#include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h"
#include "mojo/services/public/cpp/view_manager/lib/view_private.h"
-#include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h"
+#include "mojo/services/public/cpp/view_manager/node_observer.h"
#include "mojo/services/public/cpp/view_manager/view.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node_observer.h"
namespace mojo {
namespace view_manager {
@@ -16,33 +16,33 @@ namespace view_manager {
namespace {
void NotifyViewTreeChangeAtReceiver(
- ViewTreeNode* receiver,
- const ViewTreeNodeObserver::TreeChangeParams& params) {
- ViewTreeNodeObserver::TreeChangeParams local_params = params;
+ Node* receiver,
+ const NodeObserver::TreeChangeParams& params) {
+ NodeObserver::TreeChangeParams local_params = params;
local_params.receiver = receiver;
- FOR_EACH_OBSERVER(ViewTreeNodeObserver,
- *ViewTreeNodePrivate(receiver).observers(),
+ FOR_EACH_OBSERVER(NodeObserver,
+ *NodePrivate(receiver).observers(),
OnTreeChange(local_params));
}
void NotifyViewTreeChangeUp(
- ViewTreeNode* start_at,
- const ViewTreeNodeObserver::TreeChangeParams& params) {
- for (ViewTreeNode* current = start_at; current; current = current->parent())
+ Node* start_at,
+ const NodeObserver::TreeChangeParams& params) {
+ for (Node* current = start_at; current; current = current->parent())
NotifyViewTreeChangeAtReceiver(current, params);
}
void NotifyViewTreeChangeDown(
- ViewTreeNode* start_at,
- const ViewTreeNodeObserver::TreeChangeParams& params) {
+ Node* start_at,
+ const NodeObserver::TreeChangeParams& params) {
NotifyViewTreeChangeAtReceiver(start_at, params);
- ViewTreeNode::Children::const_iterator it = start_at->children().begin();
+ Node::Children::const_iterator it = start_at->children().begin();
for (; it != start_at->children().end(); ++it)
NotifyViewTreeChangeDown(*it, params);
}
void NotifyViewTreeChange(
- const ViewTreeNodeObserver::TreeChangeParams& params) {
+ const NodeObserver::TreeChangeParams& params) {
NotifyViewTreeChangeDown(params.target, params);
if (params.old_parent)
NotifyViewTreeChangeUp(params.old_parent, params);
@@ -52,73 +52,71 @@ void NotifyViewTreeChange(
class ScopedTreeNotifier {
public:
- ScopedTreeNotifier(ViewTreeNode* target,
- ViewTreeNode* old_parent,
- ViewTreeNode* new_parent) {
+ ScopedTreeNotifier(Node* target, Node* old_parent, Node* new_parent) {
params_.target = target;
params_.old_parent = old_parent;
params_.new_parent = new_parent;
NotifyViewTreeChange(params_);
}
~ScopedTreeNotifier() {
- params_.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ params_.phase = NodeObserver::DISPOSITION_CHANGED;
NotifyViewTreeChange(params_);
}
private:
- ViewTreeNodeObserver::TreeChangeParams params_;
+ NodeObserver::TreeChangeParams params_;
DISALLOW_COPY_AND_ASSIGN(ScopedTreeNotifier);
};
-void RemoveChildImpl(ViewTreeNode* child, ViewTreeNode::Children* children) {
- ViewTreeNode::Children::iterator it =
+void RemoveChildImpl(Node* child, Node::Children* children) {
+ Node::Children::iterator it =
std::find(children->begin(), children->end(), child);
if (it != children->end()) {
children->erase(it);
- ViewTreeNodePrivate(child).ClearParent();
+ NodePrivate(child).ClearParent();
}
}
class ScopedOrderChangedNotifier {
public:
- ScopedOrderChangedNotifier(ViewTreeNode* node,
- ViewTreeNode* relative_node,
+ ScopedOrderChangedNotifier(Node* node,
+ Node* relative_node,
OrderDirection direction)
: node_(node),
relative_node_(relative_node),
direction_(direction) {
FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node_).observers(),
+ NodeObserver,
+ *NodePrivate(node_).observers(),
OnNodeReordered(node_,
relative_node_,
direction_,
- ViewTreeNodeObserver::DISPOSITION_CHANGING));
+ NodeObserver::DISPOSITION_CHANGING));
}
~ScopedOrderChangedNotifier() {
FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node_).observers(),
+ NodeObserver,
+ *NodePrivate(node_).observers(),
OnNodeReordered(node_,
relative_node_,
direction_,
- ViewTreeNodeObserver::DISPOSITION_CHANGED));
+ NodeObserver::DISPOSITION_CHANGED));
}
private:
- ViewTreeNode* node_;
- ViewTreeNode* relative_node_;
+ Node* node_;
+ Node* relative_node_;
OrderDirection direction_;
DISALLOW_COPY_AND_ASSIGN(ScopedOrderChangedNotifier);
};
// Returns true if the order actually changed.
-bool ReorderImpl(ViewTreeNode::Children* children,
- ViewTreeNode* node,
- ViewTreeNode* relative,
+bool ReorderImpl(Node::Children* children,
+ Node* node,
+ Node* relative,
OrderDirection direction) {
DCHECK(relative);
DCHECK_NE(node, relative);
@@ -148,32 +146,30 @@ bool ReorderImpl(ViewTreeNode::Children* children,
class ScopedSetActiveViewNotifier {
public:
- ScopedSetActiveViewNotifier(ViewTreeNode* node,
- View* old_view,
- View* new_view)
+ ScopedSetActiveViewNotifier(Node* node, View* old_view, View* new_view)
: node_(node),
old_view_(old_view),
new_view_(new_view) {
FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node).observers(),
+ NodeObserver,
+ *NodePrivate(node).observers(),
OnNodeActiveViewChange(node_,
old_view_,
new_view_,
- ViewTreeNodeObserver::DISPOSITION_CHANGING));
+ NodeObserver::DISPOSITION_CHANGING));
}
~ScopedSetActiveViewNotifier() {
FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node_).observers(),
+ NodeObserver,
+ *NodePrivate(node_).observers(),
OnNodeActiveViewChange(node_,
old_view_,
new_view_,
- ViewTreeNodeObserver::DISPOSITION_CHANGED));
+ NodeObserver::DISPOSITION_CHANGED));
}
private:
- ViewTreeNode* node_;
+ Node* node_;
View* old_view_;
View* new_view_;
@@ -182,32 +178,32 @@ class ScopedSetActiveViewNotifier {
class ScopedSetBoundsNotifier {
public:
- ScopedSetBoundsNotifier(ViewTreeNode* node,
+ ScopedSetBoundsNotifier(Node* node,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds)
: node_(node),
old_bounds_(old_bounds),
new_bounds_(new_bounds) {
FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node_).observers(),
+ NodeObserver,
+ *NodePrivate(node_).observers(),
OnNodeBoundsChange(node_,
old_bounds_,
new_bounds_,
- ViewTreeNodeObserver::DISPOSITION_CHANGING));
+ NodeObserver::DISPOSITION_CHANGING));
}
~ScopedSetBoundsNotifier() {
FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node_).observers(),
+ NodeObserver,
+ *NodePrivate(node_).observers(),
OnNodeBoundsChange(node_,
old_bounds_,
new_bounds_,
- ViewTreeNodeObserver::DISPOSITION_CHANGED));
+ NodeObserver::DISPOSITION_CHANGED));
}
private:
- ViewTreeNode* node_;
+ Node* node_;
const gfx::Rect old_bounds_;
const gfx::Rect new_bounds_;
@@ -216,190 +212,189 @@ class ScopedSetBoundsNotifier {
class ScopedDestructionNotifier {
public:
- explicit ScopedDestructionNotifier(ViewTreeNode* node)
+ explicit ScopedDestructionNotifier(Node* node)
: node_(node) {
FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node_).observers(),
- OnNodeDestroy(node_, ViewTreeNodeObserver::DISPOSITION_CHANGING));
+ NodeObserver,
+ *NodePrivate(node_).observers(),
+ OnNodeDestroy(node_, NodeObserver::DISPOSITION_CHANGING));
}
~ScopedDestructionNotifier() {
FOR_EACH_OBSERVER(
- ViewTreeNodeObserver,
- *ViewTreeNodePrivate(node_).observers(),
- OnNodeDestroy(node_, ViewTreeNodeObserver::DISPOSITION_CHANGED));
+ NodeObserver,
+ *NodePrivate(node_).observers(),
+ OnNodeDestroy(node_, NodeObserver::DISPOSITION_CHANGED));
}
private:
- ViewTreeNode* node_;
+ Node* node_;
DISALLOW_COPY_AND_ASSIGN(ScopedDestructionNotifier);
};
// Some operations are only permitted in the connection that created the node.
-bool OwnsNode(ViewManager* manager, ViewTreeNode* node) {
+bool OwnsNode(ViewManager* manager, Node* node) {
return !manager ||
- static_cast<ViewManagerSynchronizer*>(manager)->OwnsNode(node->id());
+ static_cast<ViewManagerClientImpl*>(manager)->OwnsNode(node->id());
}
} // namespace
////////////////////////////////////////////////////////////////////////////////
-// ViewTreeNode, public:
+// Node, public:
// static
-ViewTreeNode* ViewTreeNode::Create(ViewManager* view_manager) {
- ViewTreeNode* node = new ViewTreeNode(view_manager);
- static_cast<ViewManagerSynchronizer*>(view_manager)->AddNode(node);
+Node* Node::Create(ViewManager* view_manager) {
+ Node* node = new Node(view_manager);
+ static_cast<ViewManagerClientImpl*>(view_manager)->AddNode(node);
return node;
}
-void ViewTreeNode::Destroy() {
+void Node::Destroy() {
if (!OwnsNode(manager_, this))
return;
if (manager_)
- static_cast<ViewManagerSynchronizer*>(manager_)->DestroyViewTreeNode(id_);
+ static_cast<ViewManagerClientImpl*>(manager_)->DestroyNode(id_);
while (!children_.empty())
children_.front()->Destroy();
LocalDestroy();
}
-void ViewTreeNode::SetBounds(const gfx::Rect& bounds) {
+void Node::SetBounds(const gfx::Rect& bounds) {
if (!OwnsNode(manager_, this))
return;
if (manager_)
- static_cast<ViewManagerSynchronizer*>(manager_)->SetBounds(id_, bounds);
+ static_cast<ViewManagerClientImpl*>(manager_)->SetBounds(id_, bounds);
LocalSetBounds(bounds_, bounds);
}
-void ViewTreeNode::AddObserver(ViewTreeNodeObserver* observer) {
+void Node::AddObserver(NodeObserver* observer) {
observers_.AddObserver(observer);
}
-void ViewTreeNode::RemoveObserver(ViewTreeNodeObserver* observer) {
+void Node::RemoveObserver(NodeObserver* observer) {
observers_.RemoveObserver(observer);
}
-void ViewTreeNode::AddChild(ViewTreeNode* child) {
+void Node::AddChild(Node* child) {
// TODO(beng): not necessarily valid to all connections, but possibly to the
// embeddee in an embedder-embeddee relationship.
if (manager_)
- CHECK_EQ(ViewTreeNodePrivate(child).view_manager(), manager_);
+ CHECK_EQ(NodePrivate(child).view_manager(), manager_);
LocalAddChild(child);
if (manager_)
- static_cast<ViewManagerSynchronizer*>(manager_)->AddChild(child->id(), id_);
+ static_cast<ViewManagerClientImpl*>(manager_)->AddChild(child->id(), id_);
}
-void ViewTreeNode::RemoveChild(ViewTreeNode* child) {
+void Node::RemoveChild(Node* child) {
// TODO(beng): not necessarily valid to all connections, but possibly to the
// embeddee in an embedder-embeddee relationship.
if (manager_)
- CHECK_EQ(ViewTreeNodePrivate(child).view_manager(), manager_);
+ CHECK_EQ(NodePrivate(child).view_manager(), manager_);
LocalRemoveChild(child);
if (manager_) {
- static_cast<ViewManagerSynchronizer*>(manager_)->RemoveChild(child->id(),
- id_);
+ static_cast<ViewManagerClientImpl*>(manager_)->RemoveChild(child->id(),
+ id_);
}
}
-void ViewTreeNode::MoveToFront() {
+void Node::MoveToFront() {
Reorder(parent_->children_.back(), ORDER_ABOVE);
}
-void ViewTreeNode::MoveToBack() {
+void Node::MoveToBack() {
Reorder(parent_->children_.front(), ORDER_BELOW);
}
-void ViewTreeNode::Reorder(ViewTreeNode* relative, OrderDirection direction) {
+void Node::Reorder(Node* relative, OrderDirection direction) {
if (!LocalReorder(relative, direction))
return;
if (manager_) {
- static_cast<ViewManagerSynchronizer*>(manager_)->Reorder(id_,
- relative->id(),
- direction);
+ static_cast<ViewManagerClientImpl*>(manager_)->Reorder(id_,
+ relative->id(),
+ direction);
}
}
-bool ViewTreeNode::Contains(ViewTreeNode* child) const {
+bool Node::Contains(Node* child) const {
if (manager_)
- CHECK_EQ(ViewTreeNodePrivate(child).view_manager(), manager_);
- for (ViewTreeNode* p = child->parent(); p; p = p->parent()) {
+ CHECK_EQ(NodePrivate(child).view_manager(), manager_);
+ for (Node* p = child->parent(); p; p = p->parent()) {
if (p == this)
return true;
}
return false;
}
-ViewTreeNode* ViewTreeNode::GetChildById(Id id) {
+Node* Node::GetChildById(Id id) {
if (id == id_)
return this;
// TODO(beng): this could be improved depending on how we decide to own nodes.
Children::const_iterator it = children_.begin();
for (; it != children_.end(); ++it) {
- ViewTreeNode* node = (*it)->GetChildById(id);
+ Node* node = (*it)->GetChildById(id);
if (node)
return node;
}
return NULL;
}
-void ViewTreeNode::SetActiveView(View* view) {
+void Node::SetActiveView(View* view) {
// TODO(beng): not necessarily valid to all connections, but possibly to the
// embeddee in an embedder-embeddee relationship.
if (manager_)
CHECK_EQ(ViewPrivate(view).view_manager(), manager_);
LocalSetActiveView(view);
if (manager_) {
- static_cast<ViewManagerSynchronizer*>(manager_)->SetActiveView(
+ static_cast<ViewManagerClientImpl*>(manager_)->SetActiveView(
id_, active_view_->id());
}
}
-void ViewTreeNode::SetFocus() {
+void Node::SetFocus() {
if (manager_)
- static_cast<ViewManagerSynchronizer*>(manager_)->SetFocus(id_);
+ static_cast<ViewManagerClientImpl*>(manager_)->SetFocus(id_);
}
-void ViewTreeNode::Embed(const String& url) {
- static_cast<ViewManagerSynchronizer*>(manager_)->Embed(url, id_);
+void Node::Embed(const String& url) {
+ static_cast<ViewManagerClientImpl*>(manager_)->Embed(url, id_);
}
////////////////////////////////////////////////////////////////////////////////
-// ViewTreeNode, protected:
+// Node, protected:
-ViewTreeNode::ViewTreeNode()
+Node::Node()
: manager_(NULL),
id_(-1),
parent_(NULL),
active_view_(NULL) {}
-ViewTreeNode::~ViewTreeNode() {
+Node::~Node() {
ScopedDestructionNotifier notifier(this);
if (parent_)
parent_->LocalRemoveChild(this);
// TODO(beng): It'd be better to do this via a destruction observer in the
- // synchronizer.
+ // ViewManagerClientImpl.
if (manager_)
- static_cast<ViewManagerSynchronizer*>(manager_)->RemoveNode(id_);
+ static_cast<ViewManagerClientImpl*>(manager_)->RemoveNode(id_);
}
////////////////////////////////////////////////////////////////////////////////
-// ViewTreeNode, private:
+// Node, private:
-ViewTreeNode::ViewTreeNode(ViewManager* manager)
+Node::Node(ViewManager* manager)
: manager_(manager),
- id_(static_cast<ViewManagerSynchronizer*>(
- manager_)->CreateViewTreeNode()),
+ id_(static_cast<ViewManagerClientImpl*>(manager_)->CreateNode()),
parent_(NULL),
active_view_(NULL) {}
-void ViewTreeNode::LocalDestroy() {
+void Node::LocalDestroy() {
delete this;
}
-void ViewTreeNode::LocalAddChild(ViewTreeNode* child) {
+void Node::LocalAddChild(Node* child) {
ScopedTreeNotifier notifier(child, child->parent(), this);
if (child->parent())
RemoveChildImpl(child, &child->parent_->children_);
@@ -407,18 +402,17 @@ void ViewTreeNode::LocalAddChild(ViewTreeNode* child) {
child->parent_ = this;
}
-void ViewTreeNode::LocalRemoveChild(ViewTreeNode* child) {
+void Node::LocalRemoveChild(Node* child) {
DCHECK_EQ(this, child->parent());
ScopedTreeNotifier notifier(child, this, NULL);
RemoveChildImpl(child, &children_);
}
-bool ViewTreeNode::LocalReorder(ViewTreeNode* relative,
- OrderDirection direction) {
+bool Node::LocalReorder(Node* relative, OrderDirection direction) {
return ReorderImpl(&parent_->children_, this, relative, direction);
}
-void ViewTreeNode::LocalSetActiveView(View* view) {
+void Node::LocalSetActiveView(View* view) {
ScopedSetActiveViewNotifier notifier(this, active_view_, view);
if (active_view_)
ViewPrivate(active_view_).set_node(NULL);
@@ -427,8 +421,8 @@ void ViewTreeNode::LocalSetActiveView(View* view) {
ViewPrivate(active_view_).set_node(this);
}
-void ViewTreeNode::LocalSetBounds(const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
+void Node::LocalSetBounds(const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) {
DCHECK(old_bounds == bounds_);
ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds);
bounds_ = new_bounds;
diff --git a/mojo/services/public/cpp/view_manager/lib/view_tree_node_observer.cc b/mojo/services/public/cpp/view_manager/lib/node_observer.cc
index eee5745..a0f9f4e 100644
--- a/mojo/services/public/cpp/view_manager/lib/view_tree_node_observer.cc
+++ b/mojo/services/public/cpp/view_manager/lib/node_observer.cc
@@ -2,7 +2,7 @@
// 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/view_tree_node_observer.h"
+#include "mojo/services/public/cpp/view_manager/node_observer.h"
#include "base/basictypes.h"
@@ -10,14 +10,14 @@ namespace mojo {
namespace view_manager {
////////////////////////////////////////////////////////////////////////////////
-// ViewTreeNodeObserver, public:
+// NodeObserver, public:
-ViewTreeNodeObserver::TreeChangeParams::TreeChangeParams()
+NodeObserver::TreeChangeParams::TreeChangeParams()
: target(NULL),
old_parent(NULL),
new_parent(NULL),
receiver(NULL),
- phase(ViewTreeNodeObserver::DISPOSITION_CHANGING) {}
+ phase(NodeObserver::DISPOSITION_CHANGING) {}
} // namespace view_manager
} // namespace mojo
diff --git a/mojo/services/public/cpp/view_manager/lib/view_tree_node_private.cc b/mojo/services/public/cpp/view_manager/lib/node_private.cc
index 4e49967..92dfb53 100644
--- a/mojo/services/public/cpp/view_manager/lib/view_tree_node_private.cc
+++ b/mojo/services/public/cpp/view_manager/lib/node_private.cc
@@ -2,21 +2,21 @@
// 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_tree_node_private.h"
+#include "mojo/services/public/cpp/view_manager/lib/node_private.h"
namespace mojo {
namespace view_manager {
-ViewTreeNodePrivate::ViewTreeNodePrivate(ViewTreeNode* node)
+NodePrivate::NodePrivate(Node* node)
: node_(node) {
}
-ViewTreeNodePrivate::~ViewTreeNodePrivate() {
+NodePrivate::~NodePrivate() {
}
// static
-ViewTreeNode* ViewTreeNodePrivate::LocalCreate() {
- return new ViewTreeNode;
+Node* NodePrivate::LocalCreate() {
+ return new Node;
}
} // namespace view_manager
diff --git a/mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h b/mojo/services/public/cpp/view_manager/lib/node_private.h
index e3b84d6..6f634b3 100644
--- a/mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h
+++ b/mojo/services/public/cpp/view_manager/lib/node_private.h
@@ -2,24 +2,24 @@
// 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_TREE_NODE_PRIVATE_H_
-#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_TREE_NODE_PRIVATE_H_
+#ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_NODE_PRIVATE_H_
+#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_NODE_PRIVATE_H_
#include "base/basictypes.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
namespace mojo {
namespace view_manager {
-class ViewTreeNodePrivate {
+class NodePrivate {
public:
- explicit ViewTreeNodePrivate(ViewTreeNode* node);
- ~ViewTreeNodePrivate();
+ explicit NodePrivate(Node* node);
+ ~NodePrivate();
- static ViewTreeNode* LocalCreate();
+ static Node* LocalCreate();
- ObserverList<ViewTreeNodeObserver>* observers() { return &node_->observers_; }
+ ObserverList<NodeObserver>* observers() { return &node_->observers_; }
void ClearParent() { node_->parent_ = NULL; }
@@ -33,13 +33,13 @@ class ViewTreeNodePrivate {
void LocalDestroy() {
node_->LocalDestroy();
}
- void LocalAddChild(ViewTreeNode* child) {
+ void LocalAddChild(Node* child) {
node_->LocalAddChild(child);
}
- void LocalRemoveChild(ViewTreeNode* child) {
+ void LocalRemoveChild(Node* child) {
node_->LocalRemoveChild(child);
}
- void LocalReorder(ViewTreeNode* relative, OrderDirection direction) {
+ void LocalReorder(Node* relative, OrderDirection direction) {
node_->LocalReorder(relative, direction);
}
void LocalSetActiveView(View* view) {
@@ -51,12 +51,12 @@ class ViewTreeNodePrivate {
}
private:
- ViewTreeNode* node_;
+ Node* node_;
- DISALLOW_COPY_AND_ASSIGN(ViewTreeNodePrivate);
+ DISALLOW_COPY_AND_ASSIGN(NodePrivate);
};
} // namespace view_manager
} // namespace mojo
-#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_TREE_NODE_PRIVATE_H_
+#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_NODE_PRIVATE_H_
diff --git a/mojo/services/public/cpp/view_manager/lib/view.cc b/mojo/services/public/cpp/view_manager/lib/view.cc
index db5bbc0..4bcedfc 100644
--- a/mojo/services/public/cpp/view_manager/lib/view.cc
+++ b/mojo/services/public/cpp/view_manager/lib/view.cc
@@ -4,10 +4,10 @@
#include "mojo/services/public/cpp/view_manager/view.h"
-#include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h"
+#include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h"
#include "mojo/services/public/cpp/view_manager/lib/view_private.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
#include "mojo/services/public/cpp/view_manager/view_observer.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node.h"
#include "ui/gfx/canvas.h"
namespace mojo {
@@ -40,13 +40,13 @@ class ScopedDestructionNotifier {
// static
View* View::Create(ViewManager* manager) {
View* view = new View(manager);
- static_cast<ViewManagerSynchronizer*>(manager)->AddView(view);
+ static_cast<ViewManagerClientImpl*>(manager)->AddView(view);
return view;
}
void View::Destroy() {
if (manager_)
- static_cast<ViewManagerSynchronizer*>(manager_)->DestroyView(id_);
+ static_cast<ViewManagerClientImpl*>(manager_)->DestroyView(id_);
LocalDestroy();
}
@@ -60,8 +60,8 @@ void View::RemoveObserver(ViewObserver* observer) {
void View::SetContents(const SkBitmap& contents) {
if (manager_) {
- static_cast<ViewManagerSynchronizer*>(manager_)->SetViewContents(id_,
- contents);
+ static_cast<ViewManagerClientImpl*>(manager_)->SetViewContents(id_,
+ contents);
}
}
@@ -72,7 +72,7 @@ void View::SetColor(SkColor color) {
}
View::View(ViewManager* manager)
- : id_(static_cast<ViewManagerSynchronizer*>(manager)->CreateView()),
+ : id_(static_cast<ViewManagerClientImpl*>(manager)->CreateView()),
node_(NULL),
manager_(manager) {}
@@ -84,9 +84,9 @@ View::View()
View::~View() {
ScopedDestructionNotifier notifier(this);
// TODO(beng): It'd be better to do this via a destruction observer in the
- // synchronizer.
+ // ViewManagerClientImpl.
if (manager_)
- static_cast<ViewManagerSynchronizer*>(manager_)->RemoveView(id_);
+ static_cast<ViewManagerClientImpl*>(manager_)->RemoveView(id_);
}
void View::LocalDestroy() {
diff --git a/mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.cc b/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc
index 49c03aa..772b1d6 100644
--- a/mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.cc
+++ b/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc
@@ -2,19 +2,19 @@
// 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_synchronizer.h"
+#include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "mojo/public/cpp/application/application.h"
#include "mojo/public/cpp/application/connect.h"
#include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
+#include "mojo/services/public/cpp/view_manager/lib/node_private.h"
#include "mojo/services/public/cpp/view_manager/lib/view_private.h"
-#include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h"
+#include "mojo/services/public/cpp/view_manager/node_observer.h"
#include "mojo/services/public/cpp/view_manager/util.h"
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
#include "mojo/services/public/cpp/view_manager/view_observer.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node_observer.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/codec/png_codec.h"
@@ -27,42 +27,42 @@ Id MakeTransportId(ConnectionSpecificId connection_id,
}
// Helper called to construct a local node/view object from transport data.
-ViewTreeNode* AddNodeToViewManager(ViewManagerSynchronizer* synchronizer,
- ViewTreeNode* parent,
- Id node_id,
- Id view_id,
- const gfx::Rect& bounds) {
+Node* AddNodeToViewManager(ViewManagerClientImpl* client,
+ Node* parent,
+ Id node_id,
+ Id view_id,
+ const gfx::Rect& bounds) {
// We don't use the ctor that takes a ViewManager here, since it will call
// back to the service and attempt to create a new node.
- ViewTreeNode* node = ViewTreeNodePrivate::LocalCreate();
- ViewTreeNodePrivate private_node(node);
- private_node.set_view_manager(synchronizer);
+ Node* node = NodePrivate::LocalCreate();
+ NodePrivate private_node(node);
+ private_node.set_view_manager(client);
private_node.set_id(node_id);
private_node.LocalSetBounds(gfx::Rect(), bounds);
if (parent)
- ViewTreeNodePrivate(parent).LocalAddChild(node);
- synchronizer->AddNode(node);
+ NodePrivate(parent).LocalAddChild(node);
+ client->AddNode(node);
// View.
if (view_id != 0) {
View* view = ViewPrivate::LocalCreate();
ViewPrivate private_view(view);
- private_view.set_view_manager(synchronizer);
+ private_view.set_view_manager(client);
private_view.set_id(view_id);
private_view.set_node(node);
// TODO(beng): this broadcasts notifications locally... do we want this? I
// don't think so. same story for LocalAddChild above!
private_node.LocalSetActiveView(view);
- synchronizer->AddView(view);
+ client->AddView(view);
}
return node;
}
-ViewTreeNode* BuildNodeTree(ViewManagerSynchronizer* synchronizer,
- const Array<NodeDataPtr>& nodes) {
- std::vector<ViewTreeNode*> parents;
- ViewTreeNode* root = NULL;
- ViewTreeNode* last_node = NULL;
+Node* BuildNodeTree(ViewManagerClientImpl* client,
+ const Array<NodeDataPtr>& nodes) {
+ std::vector<Node*> parents;
+ Node* root = NULL;
+ Node* last_node = NULL;
for (size_t i = 0; i < nodes.size(); ++i) {
if (last_node && nodes[i]->parent_id == last_node->id()) {
parents.push_back(last_node);
@@ -70,8 +70,8 @@ ViewTreeNode* BuildNodeTree(ViewManagerSynchronizer* synchronizer,
while (parents.back()->id() != nodes[i]->parent_id)
parents.pop_back();
}
- ViewTreeNode* node = AddNodeToViewManager(
- synchronizer,
+ Node* node = AddNodeToViewManager(
+ client,
!parents.empty() ? parents.back() : NULL,
nodes[i]->node_id,
nodes[i]->view_id,
@@ -85,24 +85,24 @@ ViewTreeNode* BuildNodeTree(ViewManagerSynchronizer* synchronizer,
// Responsible for removing a root from the ViewManager when that node is
// destroyed.
-class RootObserver : public ViewTreeNodeObserver {
+class RootObserver : public NodeObserver {
public:
- explicit RootObserver(ViewTreeNode* root) : root_(root) {}
+ explicit RootObserver(Node* root) : root_(root) {}
virtual ~RootObserver() {}
private:
- // Overridden from ViewTreeNodeObserver:
- virtual void OnNodeDestroy(ViewTreeNode* node,
+ // Overridden from NodeObserver:
+ virtual void OnNodeDestroy(Node* node,
DispositionChangePhase phase) OVERRIDE {
DCHECK_EQ(node, root_);
- if (phase != ViewTreeNodeObserver::DISPOSITION_CHANGED)
+ if (phase != NodeObserver::DISPOSITION_CHANGED)
return;
- static_cast<ViewManagerSynchronizer*>(
- ViewTreeNodePrivate(root_).view_manager())->RemoveRoot(root_);
+ static_cast<ViewManagerClientImpl*>(
+ NodePrivate(root_).view_manager())->RemoveRoot(root_);
delete this;
}
- ViewTreeNode* root_;
+ Node* root_;
DISALLOW_COPY_AND_ASSIGN(RootObserver);
};
@@ -120,9 +120,9 @@ class ViewManagerTransaction {
bool committed() const { return committed_; }
protected:
- explicit ViewManagerTransaction(ViewManagerSynchronizer* synchronizer)
+ explicit ViewManagerTransaction(ViewManagerClientImpl* client)
: committed_(false),
- synchronizer_(synchronizer) {
+ client_(client) {
}
// Overridden to perform transaction-specific commit actions.
@@ -132,10 +132,10 @@ class ViewManagerTransaction {
// service.
virtual void DoActionCompleted(bool success) = 0;
- ViewManagerService* service() { return synchronizer_->service_; }
+ ViewManagerService* service() { return client_->service_; }
Id GetAndAdvanceNextServerChangeId() {
- return synchronizer_->next_server_change_id_++;
+ return client_->next_server_change_id_++;
}
base::Callback<void(bool)> ActionCompletedCallback() {
@@ -148,19 +148,19 @@ class ViewManagerTransaction {
void OnActionCompleted(bool success) {
DCHECK(success);
DoActionCompleted(success);
- synchronizer_->RemoveFromPendingQueue(this);
+ client_->RemoveFromPendingQueue(this);
}
bool committed_;
- ViewManagerSynchronizer* synchronizer_;
+ ViewManagerClientImpl* client_;
DISALLOW_COPY_AND_ASSIGN(ViewManagerTransaction);
};
class CreateViewTransaction : public ViewManagerTransaction {
public:
- CreateViewTransaction(Id view_id, ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ CreateViewTransaction(Id view_id, ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
view_id_(view_id) {}
virtual ~CreateViewTransaction() {}
@@ -180,8 +180,8 @@ class CreateViewTransaction : public ViewManagerTransaction {
class DestroyViewTransaction : public ViewManagerTransaction {
public:
- DestroyViewTransaction(Id view_id, ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ DestroyViewTransaction(Id view_id, ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
view_id_(view_id) {}
virtual ~DestroyViewTransaction() {}
@@ -199,13 +199,12 @@ class DestroyViewTransaction : public ViewManagerTransaction {
DISALLOW_COPY_AND_ASSIGN(DestroyViewTransaction);
};
-class CreateViewTreeNodeTransaction : public ViewManagerTransaction {
+class CreateNodeTransaction : public ViewManagerTransaction {
public:
- CreateViewTreeNodeTransaction(Id node_id,
- ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ CreateNodeTransaction(Id node_id, ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
node_id_(node_id) {}
- virtual ~CreateViewTreeNodeTransaction() {}
+ virtual ~CreateNodeTransaction() {}
private:
// Overridden from ViewManagerTransaction:
@@ -221,16 +220,15 @@ class CreateViewTreeNodeTransaction : public ViewManagerTransaction {
const Id node_id_;
- DISALLOW_COPY_AND_ASSIGN(CreateViewTreeNodeTransaction);
+ DISALLOW_COPY_AND_ASSIGN(CreateNodeTransaction);
};
-class DestroyViewTreeNodeTransaction : public ViewManagerTransaction {
+class DestroyNodeTransaction : public ViewManagerTransaction {
public:
- DestroyViewTreeNodeTransaction(Id node_id,
- ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ DestroyNodeTransaction(Id node_id, ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
node_id_(node_id) {}
- virtual ~DestroyViewTreeNodeTransaction() {}
+ virtual ~DestroyNodeTransaction() {}
private:
// Overridden from ViewManagerTransaction:
@@ -243,15 +241,15 @@ class DestroyViewTreeNodeTransaction : public ViewManagerTransaction {
}
const Id node_id_;
- DISALLOW_COPY_AND_ASSIGN(DestroyViewTreeNodeTransaction);
+ DISALLOW_COPY_AND_ASSIGN(DestroyNodeTransaction);
};
class AddChildTransaction : public ViewManagerTransaction {
public:
AddChildTransaction(Id child_id,
Id parent_id,
- ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
child_id_(child_id),
parent_id_(parent_id) {}
virtual ~AddChildTransaction() {}
@@ -277,9 +275,8 @@ class AddChildTransaction : public ViewManagerTransaction {
class RemoveChildTransaction : public ViewManagerTransaction {
public:
- RemoveChildTransaction(Id child_id,
- ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ RemoveChildTransaction(Id child_id, ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
child_id_(child_id) {}
virtual ~RemoveChildTransaction() {}
@@ -306,8 +303,8 @@ class ReorderNodeTransaction : public ViewManagerTransaction {
ReorderNodeTransaction(Id node_id,
Id relative_id,
OrderDirection direction,
- ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
node_id_(node_id),
relative_id_(relative_id),
direction_(direction) {}
@@ -338,8 +335,8 @@ class SetActiveViewTransaction : public ViewManagerTransaction {
public:
SetActiveViewTransaction(Id node_id,
Id view_id,
- ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
node_id_(node_id),
view_id_(view_id) {}
virtual ~SetActiveViewTransaction() {}
@@ -363,8 +360,8 @@ class SetBoundsTransaction : public ViewManagerTransaction {
public:
SetBoundsTransaction(Id node_id,
const gfx::Rect& bounds,
- ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
node_id_(node_id),
bounds_(bounds) {}
virtual ~SetBoundsTransaction() {}
@@ -389,8 +386,8 @@ class SetViewContentsTransaction : public ViewManagerTransaction {
public:
SetViewContentsTransaction(Id view_id,
const SkBitmap& contents,
- ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
view_id_(view_id),
contents_(contents) {}
virtual ~SetViewContentsTransaction() {}
@@ -454,8 +451,8 @@ class EmbedTransaction : public ViewManagerTransaction {
public:
EmbedTransaction(const String& url,
Id node_id,
- ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
url_(url),
node_id_(node_id) {}
virtual ~EmbedTransaction() {}
@@ -479,8 +476,8 @@ class EmbedTransaction : public ViewManagerTransaction {
class SetFocusTransaction : public ViewManagerTransaction {
public:
- SetFocusTransaction(Id node_id, ViewManagerSynchronizer* synchronizer)
- : ViewManagerTransaction(synchronizer),
+ SetFocusTransaction(Id node_id, ViewManagerClientImpl* client)
+ : ViewManagerTransaction(client),
node_id_(node_id) {}
virtual ~SetFocusTransaction() {}
@@ -498,14 +495,14 @@ class SetFocusTransaction : public ViewManagerTransaction {
DISALLOW_COPY_AND_ASSIGN(SetFocusTransaction);
};
-ViewManagerSynchronizer::ViewManagerSynchronizer(ViewManagerDelegate* delegate)
+ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate)
: connected_(false),
connection_id_(0),
next_id_(1),
next_server_change_id_(0),
delegate_(delegate) {}
-ViewManagerSynchronizer::~ViewManagerSynchronizer() {
+ViewManagerClientImpl::~ViewManagerClientImpl() {
while (!nodes_.empty()) {
IdToNodeMap::iterator it = nodes_.begin();
if (OwnsNode(it->second->id()))
@@ -522,23 +519,21 @@ ViewManagerSynchronizer::~ViewManagerSynchronizer() {
}
}
-Id ViewManagerSynchronizer::CreateViewTreeNode() {
+Id ViewManagerClientImpl::CreateNode() {
DCHECK(connected_);
const Id node_id(MakeTransportId(connection_id_, ++next_id_));
- pending_transactions_.push_back(
- new CreateViewTreeNodeTransaction(node_id, this));
+ pending_transactions_.push_back(new CreateNodeTransaction(node_id, this));
Sync();
return node_id;
}
-void ViewManagerSynchronizer::DestroyViewTreeNode(Id node_id) {
+void ViewManagerClientImpl::DestroyNode(Id node_id) {
DCHECK(connected_);
- pending_transactions_.push_back(
- new DestroyViewTreeNodeTransaction(node_id, this));
+ pending_transactions_.push_back(new DestroyNodeTransaction(node_id, this));
Sync();
}
-Id ViewManagerSynchronizer::CreateView() {
+Id ViewManagerClientImpl::CreateView() {
DCHECK(connected_);
const Id view_id(MakeTransportId(connection_id_, ++next_id_));
pending_transactions_.push_back(new CreateViewTransaction(view_id, this));
@@ -546,27 +541,27 @@ Id ViewManagerSynchronizer::CreateView() {
return view_id;
}
-void ViewManagerSynchronizer::DestroyView(Id view_id) {
+void ViewManagerClientImpl::DestroyView(Id view_id) {
DCHECK(connected_);
pending_transactions_.push_back(new DestroyViewTransaction(view_id, this));
Sync();
}
-void ViewManagerSynchronizer::AddChild(Id child_id,
- Id parent_id) {
+void ViewManagerClientImpl::AddChild(Id child_id,
+ Id parent_id) {
DCHECK(connected_);
pending_transactions_.push_back(
new AddChildTransaction(child_id, parent_id, this));
Sync();
}
-void ViewManagerSynchronizer::RemoveChild(Id child_id, Id parent_id) {
+void ViewManagerClientImpl::RemoveChild(Id child_id, Id parent_id) {
DCHECK(connected_);
pending_transactions_.push_back(new RemoveChildTransaction(child_id, this));
Sync();
}
-void ViewManagerSynchronizer::Reorder(
+void ViewManagerClientImpl::Reorder(
Id node_id,
Id relative_node_id,
OrderDirection direction) {
@@ -576,102 +571,102 @@ void ViewManagerSynchronizer::Reorder(
Sync();
}
-bool ViewManagerSynchronizer::OwnsNode(Id id) const {
+bool ViewManagerClientImpl::OwnsNode(Id id) const {
return HiWord(id) == connection_id_;
}
-bool ViewManagerSynchronizer::OwnsView(Id id) const {
+bool ViewManagerClientImpl::OwnsView(Id id) const {
return HiWord(id) == connection_id_;
}
-void ViewManagerSynchronizer::SetActiveView(Id node_id, Id view_id) {
+void ViewManagerClientImpl::SetActiveView(Id node_id, Id view_id) {
DCHECK(connected_);
pending_transactions_.push_back(
new SetActiveViewTransaction(node_id, view_id, this));
Sync();
}
-void ViewManagerSynchronizer::SetBounds(Id node_id, const gfx::Rect& bounds) {
+void ViewManagerClientImpl::SetBounds(Id node_id, const gfx::Rect& bounds) {
DCHECK(connected_);
pending_transactions_.push_back(
new SetBoundsTransaction(node_id, bounds, this));
Sync();
}
-void ViewManagerSynchronizer::SetViewContents(Id view_id,
- const SkBitmap& contents) {
+void ViewManagerClientImpl::SetViewContents(Id view_id,
+ const SkBitmap& contents) {
DCHECK(connected_);
pending_transactions_.push_back(
new SetViewContentsTransaction(view_id, contents, this));
Sync();
}
-void ViewManagerSynchronizer::SetFocus(Id node_id) {
+void ViewManagerClientImpl::SetFocus(Id node_id) {
DCHECK(connected_);
pending_transactions_.push_back(new SetFocusTransaction(node_id, this));
Sync();
}
-void ViewManagerSynchronizer::Embed(const String& url, Id node_id) {
+void ViewManagerClientImpl::Embed(const String& url, Id node_id) {
DCHECK(connected_);
pending_transactions_.push_back(new EmbedTransaction(url, node_id, this));
Sync();
}
-void ViewManagerSynchronizer::AddNode(ViewTreeNode* node) {
+void ViewManagerClientImpl::AddNode(Node* node) {
DCHECK(nodes_.find(node->id()) == nodes_.end());
nodes_[node->id()] = node;
}
-void ViewManagerSynchronizer::RemoveNode(Id node_id) {
+void ViewManagerClientImpl::RemoveNode(Id node_id) {
IdToNodeMap::iterator it = nodes_.find(node_id);
if (it != nodes_.end())
nodes_.erase(it);
}
-void ViewManagerSynchronizer::AddView(View* view) {
+void ViewManagerClientImpl::AddView(View* view) {
DCHECK(views_.find(view->id()) == views_.end());
views_[view->id()] = view;
}
-void ViewManagerSynchronizer::RemoveView(Id view_id) {
+void ViewManagerClientImpl::RemoveView(Id view_id) {
IdToViewMap::iterator it = views_.find(view_id);
if (it != views_.end())
views_.erase(it);
}
////////////////////////////////////////////////////////////////////////////////
-// ViewManagerSynchronizer, ViewManager implementation:
+// ViewManagerClientImpl, ViewManager implementation:
-const std::string& ViewManagerSynchronizer::GetEmbedderURL() const {
+const std::string& ViewManagerClientImpl::GetEmbedderURL() const {
return creator_url_;
}
-const std::vector<ViewTreeNode*>& ViewManagerSynchronizer::GetRoots() const {
+const std::vector<Node*>& ViewManagerClientImpl::GetRoots() const {
return roots_;
}
-ViewTreeNode* ViewManagerSynchronizer::GetNodeById(Id id) {
+Node* ViewManagerClientImpl::GetNodeById(Id id) {
IdToNodeMap::const_iterator it = nodes_.find(id);
return it != nodes_.end() ? it->second : NULL;
}
-View* ViewManagerSynchronizer::GetViewById(Id id) {
+View* ViewManagerClientImpl::GetViewById(Id id) {
IdToViewMap::const_iterator it = views_.find(id);
return it != views_.end() ? it->second : NULL;
}
////////////////////////////////////////////////////////////////////////////////
-// ViewManagerSynchronizer, InterfaceImpl overrides:
+// ViewManagerClientImpl, InterfaceImpl overrides:
-void ViewManagerSynchronizer::OnConnectionEstablished() {
+void ViewManagerClientImpl::OnConnectionEstablished() {
service_ = client();
}
////////////////////////////////////////////////////////////////////////////////
-// ViewManagerSynchronizer, ViewManagerClient implementation:
+// ViewManagerClientImpl, ViewManagerClient implementation:
-void ViewManagerSynchronizer::OnViewManagerConnectionEstablished(
+void ViewManagerClientImpl::OnViewManagerConnectionEstablished(
ConnectionSpecificId connection_id,
const String& creator_url,
Id next_server_change_id,
@@ -685,24 +680,24 @@ void ViewManagerSynchronizer::OnViewManagerConnectionEstablished(
AddRoot(BuildNodeTree(this, nodes));
}
-void ViewManagerSynchronizer::OnRootsAdded(Array<NodeDataPtr> nodes) {
+void ViewManagerClientImpl::OnRootsAdded(Array<NodeDataPtr> nodes) {
AddRoot(BuildNodeTree(this, nodes));
}
-void ViewManagerSynchronizer::OnServerChangeIdAdvanced(
+void ViewManagerClientImpl::OnServerChangeIdAdvanced(
Id next_server_change_id) {
next_server_change_id_ = next_server_change_id;
}
-void ViewManagerSynchronizer::OnNodeBoundsChanged(Id node_id,
- RectPtr old_bounds,
- RectPtr new_bounds) {
- ViewTreeNode* node = GetNodeById(node_id);
- ViewTreeNodePrivate(node).LocalSetBounds(old_bounds.To<gfx::Rect>(),
- new_bounds.To<gfx::Rect>());
+void ViewManagerClientImpl::OnNodeBoundsChanged(Id node_id,
+ RectPtr old_bounds,
+ RectPtr new_bounds) {
+ Node* node = GetNodeById(node_id);
+ NodePrivate(node).LocalSetBounds(old_bounds.To<gfx::Rect>(),
+ new_bounds.To<gfx::Rect>());
}
-void ViewManagerSynchronizer::OnNodeHierarchyChanged(
+void ViewManagerClientImpl::OnNodeHierarchyChanged(
Id node_id,
Id new_parent_id,
Id old_parent_id,
@@ -712,40 +707,40 @@ void ViewManagerSynchronizer::OnNodeHierarchyChanged(
BuildNodeTree(this, nodes);
- ViewTreeNode* new_parent = GetNodeById(new_parent_id);
- ViewTreeNode* old_parent = GetNodeById(old_parent_id);
- ViewTreeNode* node = GetNodeById(node_id);
+ Node* new_parent = GetNodeById(new_parent_id);
+ Node* old_parent = GetNodeById(old_parent_id);
+ Node* node = GetNodeById(node_id);
if (new_parent)
- ViewTreeNodePrivate(new_parent).LocalAddChild(node);
+ NodePrivate(new_parent).LocalAddChild(node);
else
- ViewTreeNodePrivate(old_parent).LocalRemoveChild(node);
+ NodePrivate(old_parent).LocalRemoveChild(node);
}
-void ViewManagerSynchronizer::OnNodeReordered(Id node_id,
- Id relative_node_id,
- OrderDirection direction,
- Id server_change_id) {
+void ViewManagerClientImpl::OnNodeReordered(Id node_id,
+ Id relative_node_id,
+ OrderDirection direction,
+ Id server_change_id) {
next_server_change_id_ = server_change_id + 1;
- ViewTreeNode* node = GetNodeById(node_id);
- ViewTreeNode* relative_node = GetNodeById(relative_node_id);
+ Node* node = GetNodeById(node_id);
+ Node* relative_node = GetNodeById(relative_node_id);
if (node && relative_node) {
- ViewTreeNodePrivate(node).LocalReorder(relative_node, direction);
+ NodePrivate(node).LocalReorder(relative_node, direction);
}
}
-void ViewManagerSynchronizer::OnNodeDeleted(Id node_id, Id server_change_id) {
+void ViewManagerClientImpl::OnNodeDeleted(Id node_id, Id server_change_id) {
next_server_change_id_ = server_change_id + 1;
- ViewTreeNode* node = GetNodeById(node_id);
+ Node* node = GetNodeById(node_id);
if (node)
- ViewTreeNodePrivate(node).LocalDestroy();
+ NodePrivate(node).LocalDestroy();
}
-void ViewManagerSynchronizer::OnNodeViewReplaced(Id node_id,
- Id new_view_id,
- Id old_view_id) {
- ViewTreeNode* node = GetNodeById(node_id);
+void ViewManagerClientImpl::OnNodeViewReplaced(Id node_id,
+ Id new_view_id,
+ Id old_view_id) {
+ Node* node = GetNodeById(node_id);
View* new_view = GetViewById(new_view_id);
if (!new_view && new_view_id != 0) {
// This client wasn't aware of this View until now.
@@ -758,16 +753,16 @@ void ViewManagerSynchronizer::OnNodeViewReplaced(Id node_id,
}
View* old_view = GetViewById(old_view_id);
DCHECK_EQ(old_view, node->active_view());
- ViewTreeNodePrivate(node).LocalSetActiveView(new_view);
+ NodePrivate(node).LocalSetActiveView(new_view);
}
-void ViewManagerSynchronizer::OnViewDeleted(Id view_id) {
+void ViewManagerClientImpl::OnViewDeleted(Id view_id) {
View* view = GetViewById(view_id);
if (view)
ViewPrivate(view).LocalDestroy();
}
-void ViewManagerSynchronizer::OnViewInputEvent(
+void ViewManagerClientImpl::OnViewInputEvent(
Id view_id,
EventPtr event,
const Callback<void()>& ack_callback) {
@@ -781,9 +776,9 @@ void ViewManagerSynchronizer::OnViewInputEvent(
}
////////////////////////////////////////////////////////////////////////////////
-// ViewManagerSynchronizer, private:
+// ViewManagerClientImpl, private:
-void ViewManagerSynchronizer::Sync() {
+void ViewManagerClientImpl::Sync() {
// The service connection may not be set up yet. OnConnectionEstablished()
// will schedule another sync when it is.
if (!connected_)
@@ -796,7 +791,7 @@ void ViewManagerSynchronizer::Sync() {
}
}
-void ViewManagerSynchronizer::RemoveFromPendingQueue(
+void ViewManagerClientImpl::RemoveFromPendingQueue(
ViewManagerTransaction* transaction) {
DCHECK_EQ(transaction, pending_transactions_.front());
pending_transactions_.erase(pending_transactions_.begin());
@@ -804,10 +799,10 @@ void ViewManagerSynchronizer::RemoveFromPendingQueue(
changes_acked_callback_.Run();
}
-void ViewManagerSynchronizer::AddRoot(ViewTreeNode* root) {
+void ViewManagerClientImpl::AddRoot(Node* root) {
// A new root must not already exist as a root or be contained by an existing
// hierarchy visible to this view manager.
- std::vector<ViewTreeNode*>::const_iterator it = roots_.begin();
+ std::vector<Node*>::const_iterator it = roots_.begin();
for (; it != roots_.end(); ++it) {
if (*it == root || (*it)->Contains(root))
return;
@@ -817,8 +812,8 @@ void ViewManagerSynchronizer::AddRoot(ViewTreeNode* root) {
delegate_->OnRootAdded(this, root);
}
-void ViewManagerSynchronizer::RemoveRoot(ViewTreeNode* root) {
- std::vector<ViewTreeNode*>::iterator it =
+void ViewManagerClientImpl::RemoveRoot(Node* root) {
+ std::vector<Node*>::iterator it =
std::find(roots_.begin(), roots_.end(), root);
if (it != roots_.end()) {
roots_.erase(it);
@@ -832,7 +827,7 @@ void ViewManagerSynchronizer::RemoveRoot(ViewTreeNode* root) {
// static
void ViewManager::Create(Application* application,
ViewManagerDelegate* delegate) {
- application->AddService<ViewManagerSynchronizer>(delegate);
+ application->AddService<ViewManagerClientImpl>(delegate);
}
} // namespace view_manager
diff --git a/mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h b/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h
index 4de6b6c..cccdc08 100644
--- a/mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h
+++ b/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h
@@ -2,17 +2,17 @@
// 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_SYNCHRONIZER_H_
-#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H_
+#ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_
+#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
+#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
-#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node.h"
#include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
class SkBitmap;
@@ -24,19 +24,19 @@ class ViewManager;
class ViewManagerTransaction;
// Manages the connection with the View Manager service.
-class ViewManagerSynchronizer : public ViewManager,
- public InterfaceImpl<ViewManagerClient> {
+class ViewManagerClientImpl : public ViewManager,
+ public InterfaceImpl<ViewManagerClient> {
public:
- explicit ViewManagerSynchronizer(ViewManagerDelegate* delegate);
- virtual ~ViewManagerSynchronizer();
+ explicit ViewManagerClientImpl(ViewManagerDelegate* delegate);
+ virtual ~ViewManagerClientImpl();
bool connected() const { return connected_; }
ConnectionSpecificId connection_id() const { return connection_id_; }
// API exposed to the node/view implementations that pushes local changes to
// the service.
- Id CreateViewTreeNode();
- void DestroyViewTreeNode(Id node_id);
+ Id CreateNode();
+ void DestroyNode(Id node_id);
Id CreateView();
void DestroyView(Id view_id);
@@ -69,7 +69,7 @@ class ViewManagerSynchronizer : public ViewManager,
// Start/stop tracking nodes & views. While tracked, they can be retrieved via
// ViewManager::GetNode/ViewById.
- void AddNode(ViewTreeNode* node);
+ void AddNode(Node* node);
void RemoveNode(Id node_id);
void AddView(View* view);
@@ -80,15 +80,13 @@ class ViewManagerSynchronizer : public ViewManager,
friend class ViewManagerTransaction;
typedef ScopedVector<ViewManagerTransaction> Transactions;
- typedef std::map<Id, ViewTreeNode*> IdToNodeMap;
+ typedef std::map<Id, Node*> IdToNodeMap;
typedef std::map<Id, View*> IdToViewMap;
- typedef std::map<ConnectionSpecificId,
- ViewManagerSynchronizer*> SynchronizerMap;
// Overridden from ViewManager:
virtual const std::string& GetEmbedderURL() const OVERRIDE;
- virtual const std::vector<ViewTreeNode*>& GetRoots() const OVERRIDE;
- virtual ViewTreeNode* GetNodeById(Id id) OVERRIDE;
+ virtual const std::vector<Node*>& GetRoots() const OVERRIDE;
+ virtual Node* GetNodeById(Id id) OVERRIDE;
virtual View* GetViewById(Id id) OVERRIDE;
// Overridden from InterfaceImpl:
@@ -131,8 +129,8 @@ class ViewManagerSynchronizer : public ViewManager,
// front of the queue.
void RemoveFromPendingQueue(ViewManagerTransaction* transaction);
- void AddRoot(ViewTreeNode* root);
- void RemoveRoot(ViewTreeNode* root);
+ void AddRoot(Node* root);
+ void RemoveRoot(Node* root);
bool connected_;
ConnectionSpecificId connection_id_;
@@ -147,17 +145,17 @@ class ViewManagerSynchronizer : public ViewManager,
ViewManagerDelegate* delegate_;
- std::vector<ViewTreeNode*> roots_;
+ std::vector<Node*> roots_;
IdToNodeMap nodes_;
IdToViewMap views_;
ViewManagerService* service_;
- DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer);
+ DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl);
};
} // namespace view_manager
} // namespace mojo
-#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H_
+#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_
diff --git a/mojo/services/public/cpp/view_manager/lib/view_private.h b/mojo/services/public/cpp/view_manager/lib/view_private.h
index 0c8ea25..2e38613 100644
--- a/mojo/services/public/cpp/view_manager/lib/view_private.h
+++ b/mojo/services/public/cpp/view_manager/lib/view_private.h
@@ -23,7 +23,7 @@ class ViewPrivate {
}
void set_id(Id id) { view_->id_ = id; }
- void set_node(ViewTreeNode* node) { view_->node_ = node; }
+ void set_node(Node* node) { view_->node_ = node; }
ViewManager* view_manager() { return view_->manager_; }
void set_view_manager(ViewManager* manager) {
diff --git a/mojo/services/public/cpp/view_manager/lib/view_tree_host.cc b/mojo/services/public/cpp/view_manager/lib/view_tree_host.cc
deleted file mode 100644
index e69de29..0000000
--- a/mojo/services/public/cpp/view_manager/lib/view_tree_host.cc
+++ /dev/null
diff --git a/mojo/services/public/cpp/view_manager/view_tree_node.h b/mojo/services/public/cpp/view_manager/node.h
index b3f398e..03dbd37 100644
--- a/mojo/services/public/cpp/view_manager/view_tree_node.h
+++ b/mojo/services/public/cpp/view_manager/node.h
@@ -2,15 +2,15 @@
// 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_VIEW_TREE_NODE_H_
-#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_
+#ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_NODE_H_
+#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_NODE_H_
#include <vector>
#include "base/basictypes.h"
#include "base/observer_list.h"
#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
+#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/interfaces/view_manager/view_manager_constants.mojom.h"
#include "ui/gfx/geometry/rect.h"
@@ -19,17 +19,17 @@ namespace view_manager {
class View;
class ViewManager;
-class ViewTreeNodeObserver;
+class NodeObserver;
-// ViewTreeNodes are owned by the ViewManager.
-// TODO(beng): Right now, you'll have to implement a ViewTreeNodeObserver to
-// track destruction and NULL any pointers you have.
+// Nodes are owned by the ViewManager.
+// TODO(beng): Right now, you'll have to implement a NodeObserver to track
+// destruction and NULL any pointers you have.
// Investigate some kind of smart pointer or weak pointer for these.
-class ViewTreeNode {
+class Node {
public:
- typedef std::vector<ViewTreeNode*> Children;
+ typedef std::vector<Node*> Children;
- static ViewTreeNode* Create(ViewManager* view_manager);
+ static Node* Create(ViewManager* view_manager);
// Destroys this node and all its children.
void Destroy();
@@ -42,24 +42,24 @@ class ViewTreeNode {
void SetBounds(const gfx::Rect& bounds);
// Observation.
- void AddObserver(ViewTreeNodeObserver* observer);
- void RemoveObserver(ViewTreeNodeObserver* observer);
+ void AddObserver(NodeObserver* observer);
+ void RemoveObserver(NodeObserver* observer);
// Tree.
- ViewTreeNode* parent() { return parent_; }
- const ViewTreeNode* parent() const { return parent_; }
+ Node* parent() { return parent_; }
+ const Node* parent() const { return parent_; }
const Children& children() const { return children_; }
- void AddChild(ViewTreeNode* child);
- void RemoveChild(ViewTreeNode* child);
+ void AddChild(Node* child);
+ void RemoveChild(Node* child);
- void Reorder(ViewTreeNode* relative, OrderDirection direction);
+ void Reorder(Node* relative, OrderDirection direction);
void MoveToFront();
void MoveToBack();
- bool Contains(ViewTreeNode* child) const;
+ bool Contains(Node* child) const;
- ViewTreeNode* GetChildById(Id id);
+ Node* GetChildById(Id id);
// View.
void SetActiveView(View* view);
@@ -73,36 +73,36 @@ class ViewTreeNode {
protected:
// This class is subclassed only by test classes that provide a public ctor.
- ViewTreeNode();
- ~ViewTreeNode();
+ Node();
+ ~Node();
private:
- friend class ViewTreeNodePrivate;
+ friend class NodePrivate;
- explicit ViewTreeNode(ViewManager* manager);
+ explicit Node(ViewManager* manager);
void LocalDestroy();
- void LocalAddChild(ViewTreeNode* child);
- void LocalRemoveChild(ViewTreeNode* child);
+ void LocalAddChild(Node* child);
+ void LocalRemoveChild(Node* child);
// Returns true if the order actually changed.
- bool LocalReorder(ViewTreeNode* relative, OrderDirection direction);
+ bool LocalReorder(Node* relative, OrderDirection direction);
void LocalSetActiveView(View* view);
void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds);
ViewManager* manager_;
Id id_;
- ViewTreeNode* parent_;
+ Node* parent_;
Children children_;
- ObserverList<ViewTreeNodeObserver> observers_;
+ ObserverList<NodeObserver> observers_;
gfx::Rect bounds_;
View* active_view_;
- DISALLOW_COPY_AND_ASSIGN(ViewTreeNode);
+ DISALLOW_COPY_AND_ASSIGN(Node);
};
} // namespace view_manager
} // namespace mojo
-#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_
+#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_NODE_H_
diff --git a/mojo/services/public/cpp/view_manager/view_tree_node_observer.h b/mojo/services/public/cpp/view_manager/node_observer.h
index d39f748..7b0cdb0 100644
--- a/mojo/services/public/cpp/view_manager/view_tree_node_observer.h
+++ b/mojo/services/public/cpp/view_manager/node_observer.h
@@ -2,14 +2,14 @@
// 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_VIEW_TREE_NODE_OBSERVER_H_
-#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_OBSERVER_H_
+#ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_NODE_OBSERVER_H_
+#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_NODE_OBSERVER_H_
#include <vector>
#include "base/basictypes.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
namespace gfx {
class Rect;
@@ -18,10 +18,10 @@ class Rect;
namespace mojo {
namespace view_manager {
+class Node;
class View;
-class ViewTreeNode;
-class ViewTreeNodeObserver {
+class NodeObserver {
public:
enum DispositionChangePhase {
DISPOSITION_CHANGING,
@@ -30,38 +30,37 @@ class ViewTreeNodeObserver {
struct TreeChangeParams {
TreeChangeParams();
- ViewTreeNode* target;
- ViewTreeNode* old_parent;
- ViewTreeNode* new_parent;
- ViewTreeNode* receiver;
+ Node* target;
+ Node* old_parent;
+ Node* new_parent;
+ Node* receiver;
DispositionChangePhase phase;
};
virtual void OnTreeChange(const TreeChangeParams& params) {}
- virtual void OnNodeReordered(ViewTreeNode* node,
- ViewTreeNode* relative_node,
+ virtual void OnNodeReordered(Node* node,
+ Node* relative_node,
OrderDirection direction,
DispositionChangePhase phase) {}
- virtual void OnNodeDestroy(ViewTreeNode* node,
- DispositionChangePhase phase) {}
+ virtual void OnNodeDestroy(Node* node, DispositionChangePhase phase) {}
- virtual void OnNodeActiveViewChange(ViewTreeNode* node,
+ virtual void OnNodeActiveViewChange(Node* node,
View* old_view,
View* new_view,
DispositionChangePhase phase) {}
- virtual void OnNodeBoundsChange(ViewTreeNode* node,
+ virtual void OnNodeBoundsChange(Node* node,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds,
DispositionChangePhase phase) {}
protected:
- virtual ~ViewTreeNodeObserver() {}
+ virtual ~NodeObserver() {}
};
} // namespace view_manager
} // namespace mojo
-#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_OBSERVER_H_
+#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_NODE_OBSERVER_H_
diff --git a/mojo/services/public/cpp/view_manager/tests/view_tree_node_unittest.cc b/mojo/services/public/cpp/view_manager/tests/node_unittest.cc
index d2326dc..e38d48d 100644
--- a/mojo/services/public/cpp/view_manager/tests/view_tree_node_unittest.cc
+++ b/mojo/services/public/cpp/view_manager/tests/node_unittest.cc
@@ -2,54 +2,54 @@
// 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/view_tree_node.h"
+#include "mojo/services/public/cpp/view_manager/node.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
-#include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h"
+#include "mojo/services/public/cpp/view_manager/lib/node_private.h"
+#include "mojo/services/public/cpp/view_manager/node_observer.h"
#include "mojo/services/public/cpp/view_manager/util.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node_observer.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
namespace view_manager {
-// ViewTreeNode ----------------------------------------------------------------
+// Node ------------------------------------------------------------------------
-typedef testing::Test ViewTreeNodeTest;
+typedef testing::Test NodeTest;
// Subclass with public ctor/dtor.
-class TestViewTreeNode : public ViewTreeNode {
+class TestNode : public Node {
public:
- TestViewTreeNode() {
- ViewTreeNodePrivate(this).set_id(1);
+ TestNode() {
+ NodePrivate(this).set_id(1);
}
- ~TestViewTreeNode() {}
+ ~TestNode() {}
private:
- DISALLOW_COPY_AND_ASSIGN(TestViewTreeNode);
+ DISALLOW_COPY_AND_ASSIGN(TestNode);
};
-TEST_F(ViewTreeNodeTest, AddChild) {
- TestViewTreeNode v1;
- TestViewTreeNode v11;
+TEST_F(NodeTest, AddChild) {
+ TestNode v1;
+ TestNode v11;
v1.AddChild(&v11);
EXPECT_EQ(1U, v1.children().size());
}
-TEST_F(ViewTreeNodeTest, RemoveChild) {
- TestViewTreeNode v1;
- TestViewTreeNode v11;
+TEST_F(NodeTest, RemoveChild) {
+ TestNode v1;
+ TestNode v11;
v1.AddChild(&v11);
EXPECT_EQ(1U, v1.children().size());
v1.RemoveChild(&v11);
EXPECT_EQ(0U, v1.children().size());
}
-TEST_F(ViewTreeNodeTest, Reparent) {
- TestViewTreeNode v1;
- TestViewTreeNode v2;
- TestViewTreeNode v11;
+TEST_F(NodeTest, Reparent) {
+ TestNode v1;
+ TestNode v2;
+ TestNode v11;
v1.AddChild(&v11);
EXPECT_EQ(1U, v1.children().size());
v2.AddChild(&v11);
@@ -57,28 +57,28 @@ TEST_F(ViewTreeNodeTest, Reparent) {
EXPECT_EQ(0U, v1.children().size());
}
-TEST_F(ViewTreeNodeTest, Contains) {
- TestViewTreeNode v1;
+TEST_F(NodeTest, Contains) {
+ TestNode v1;
// Direct descendant.
- TestViewTreeNode v11;
+ TestNode v11;
v1.AddChild(&v11);
EXPECT_TRUE(v1.Contains(&v11));
// Indirect descendant.
- TestViewTreeNode v111;
+ TestNode v111;
v11.AddChild(&v111);
EXPECT_TRUE(v1.Contains(&v111));
}
-TEST_F(ViewTreeNodeTest, GetChildById) {
- TestViewTreeNode v1;
- ViewTreeNodePrivate(&v1).set_id(1);
- TestViewTreeNode v11;
- ViewTreeNodePrivate(&v11).set_id(11);
+TEST_F(NodeTest, GetChildById) {
+ TestNode v1;
+ NodePrivate(&v1).set_id(1);
+ TestNode v11;
+ NodePrivate(&v11).set_id(11);
v1.AddChild(&v11);
- TestViewTreeNode v111;
- ViewTreeNodePrivate(&v111).set_id(111);
+ TestNode v111;
+ NodePrivate(&v111).set_id(111);
v11.AddChild(&v111);
// Find direct & indirect descendents.
@@ -86,20 +86,20 @@ TEST_F(ViewTreeNodeTest, GetChildById) {
EXPECT_EQ(&v111, v1.GetChildById(v111.id()));
}
-// ViewTreeNodeObserver --------------------------------------------------------
+// NodeObserver --------------------------------------------------------
-typedef testing::Test ViewTreeNodeObserverTest;
+typedef testing::Test NodeObserverTest;
-bool TreeChangeParamsMatch(const ViewTreeNodeObserver::TreeChangeParams& lhs,
- const ViewTreeNodeObserver::TreeChangeParams& rhs) {
+bool TreeChangeParamsMatch(const NodeObserver::TreeChangeParams& lhs,
+ const NodeObserver::TreeChangeParams& rhs) {
return lhs.target == rhs.target && lhs.old_parent == rhs.old_parent &&
lhs.new_parent == rhs.new_parent && lhs.receiver == rhs.receiver &&
lhs.phase == rhs.phase;
}
-class TreeChangeObserver : public ViewTreeNodeObserver {
+class TreeChangeObserver : public NodeObserver {
public:
- explicit TreeChangeObserver(ViewTreeNode* observee) : observee_(observee) {
+ explicit TreeChangeObserver(Node* observee) : observee_(observee) {
observee_->AddObserver(this);
}
virtual ~TreeChangeObserver() {
@@ -115,24 +115,24 @@ class TreeChangeObserver : public ViewTreeNodeObserver {
}
private:
- // Overridden from ViewTreeNodeObserver:
+ // Overridden from NodeObserver:
virtual void OnTreeChange(const TreeChangeParams& params) OVERRIDE {
received_params_.push_back(params);
}
- ViewTreeNode* observee_;
+ Node* observee_;
std::vector<TreeChangeParams> received_params_;
DISALLOW_COPY_AND_ASSIGN(TreeChangeObserver);
};
// Adds/Removes v11 to v1.
-TEST_F(ViewTreeNodeObserverTest, TreeChange_SimpleAddRemove) {
- TestViewTreeNode v1;
+TEST_F(NodeObserverTest, TreeChange_SimpleAddRemove) {
+ TestNode v1;
TreeChangeObserver o1(&v1);
EXPECT_TRUE(o1.received_params().empty());
- TestViewTreeNode v11;
+ TestNode v11;
TreeChangeObserver o11(&v11);
EXPECT_TRUE(o11.received_params().empty());
@@ -141,20 +141,20 @@ TEST_F(ViewTreeNodeObserverTest, TreeChange_SimpleAddRemove) {
v1.AddChild(&v11);
EXPECT_EQ(2U, o1.received_params().size());
- ViewTreeNodeObserver::TreeChangeParams p1;
+ NodeObserver::TreeChangeParams p1;
p1.target = &v11;
p1.receiver = &v1;
p1.old_parent = NULL;
p1.new_parent = &v1;
- p1.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p1.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p1, o1.received_params().back()));
EXPECT_EQ(2U, o11.received_params().size());
- ViewTreeNodeObserver::TreeChangeParams p11 = p1;
+ NodeObserver::TreeChangeParams p11 = p1;
p11.receiver = &v11;
- p11.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p11.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p11, o11.received_params().front()));
- p11.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p11.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p11, o11.received_params().back()));
o1.Reset();
@@ -171,14 +171,14 @@ TEST_F(ViewTreeNodeObserverTest, TreeChange_SimpleAddRemove) {
p1.receiver = &v1;
p1.old_parent = &v1;
p1.new_parent = NULL;
- p1.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p1.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p1, o1.received_params().front()));
EXPECT_EQ(2U, o11.received_params().size());
p11 = p1;
p11.receiver = &v11;
EXPECT_TRUE(TreeChangeParamsMatch(p11, o11.received_params().front()));
- p11.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p11.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p11, o11.received_params().back()));
}
@@ -189,8 +189,8 @@ TEST_F(ViewTreeNodeObserverTest, TreeChange_SimpleAddRemove) {
// +- v1111
// +- v1112
// Then adds/removes v111 from v11.
-TEST_F(ViewTreeNodeObserverTest, TreeChange_NestedAddRemove) {
- TestViewTreeNode v1, v11, v111, v1111, v1112;
+TEST_F(NodeObserverTest, TreeChange_NestedAddRemove) {
+ TestNode v1, v11, v111, v1111, v1112;
// Root tree.
v1.AddChild(&v11);
@@ -201,7 +201,7 @@ TEST_F(ViewTreeNodeObserverTest, TreeChange_NestedAddRemove) {
TreeChangeObserver o1(&v1), o11(&v11), o111(&v111), o1111(&v1111),
o1112(&v1112);
- ViewTreeNodeObserver::TreeChangeParams p1, p11, p111, p1111, p1112;
+ NodeObserver::TreeChangeParams p1, p11, p111, p1111, p1112;
// Add.
@@ -212,7 +212,7 @@ TEST_F(ViewTreeNodeObserverTest, TreeChange_NestedAddRemove) {
p1.receiver = &v1;
p1.old_parent = NULL;
p1.new_parent = &v11;
- p1.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p1.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p1, o1.received_params().back()));
EXPECT_EQ(2U, o11.received_params().size());
@@ -223,25 +223,25 @@ TEST_F(ViewTreeNodeObserverTest, TreeChange_NestedAddRemove) {
EXPECT_EQ(2U, o111.received_params().size());
p111 = p11;
p111.receiver = &v111;
- p111.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p111.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p111, o111.received_params().front()));
- p111.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p111.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p111, o111.received_params().back()));
EXPECT_EQ(2U, o1111.received_params().size());
p1111 = p111;
p1111.receiver = &v1111;
- p1111.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p1111.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p1111, o1111.received_params().front()));
- p1111.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p1111.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p1111, o1111.received_params().back()));
EXPECT_EQ(2U, o1112.received_params().size());
p1112 = p111;
p1112.receiver = &v1112;
- p1112.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p1112.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p1112, o1112.received_params().front()));
- p1112.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p1112.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p1112, o1112.received_params().back()));
// Remove.
@@ -263,7 +263,7 @@ TEST_F(ViewTreeNodeObserverTest, TreeChange_NestedAddRemove) {
p1.receiver = &v1;
p1.old_parent = &v11;
p1.new_parent = NULL;
- p1.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p1.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p1, o1.received_params().front()));
EXPECT_EQ(2U, o11.received_params().size());
@@ -274,30 +274,30 @@ TEST_F(ViewTreeNodeObserverTest, TreeChange_NestedAddRemove) {
EXPECT_EQ(2U, o111.received_params().size());
p111 = p11;
p111.receiver = &v111;
- p111.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p111.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p111, o111.received_params().front()));
- p111.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p111.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p111, o111.received_params().back()));
EXPECT_EQ(2U, o1111.received_params().size());
p1111 = p111;
p1111.receiver = &v1111;
- p1111.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p1111.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p1111, o1111.received_params().front()));
- p1111.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p1111.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p1111, o1111.received_params().back()));
EXPECT_EQ(2U, o1112.received_params().size());
p1112 = p111;
p1112.receiver = &v1112;
- p1112.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p1112.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p1112, o1112.received_params().front()));
- p1112.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p1112.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p1112, o1112.received_params().back()));
}
-TEST_F(ViewTreeNodeObserverTest, TreeChange_Reparent) {
- TestViewTreeNode v1, v11, v12, v111;
+TEST_F(NodeObserverTest, TreeChange_Reparent) {
+ TestNode v1, v11, v12, v111;
v1.AddChild(&v11);
v1.AddChild(&v12);
v11.AddChild(&v111);
@@ -309,56 +309,56 @@ TEST_F(ViewTreeNodeObserverTest, TreeChange_Reparent) {
// v1 (root) should see both changing and changed notifications.
EXPECT_EQ(4U, o1.received_params().size());
- ViewTreeNodeObserver::TreeChangeParams p1;
+ NodeObserver::TreeChangeParams p1;
p1.target = &v111;
p1.receiver = &v1;
p1.old_parent = &v11;
p1.new_parent = &v12;
- p1.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p1.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p1, o1.received_params().front()));
- p1.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p1.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p1, o1.received_params().back()));
// v11 should see changing notifications.
EXPECT_EQ(2U, o11.received_params().size());
- ViewTreeNodeObserver::TreeChangeParams p11;
+ NodeObserver::TreeChangeParams p11;
p11 = p1;
p11.receiver = &v11;
- p11.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p11.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p11, o11.received_params().front()));
// v12 should see changed notifications.
EXPECT_EQ(2U, o12.received_params().size());
- ViewTreeNodeObserver::TreeChangeParams p12;
+ NodeObserver::TreeChangeParams p12;
p12 = p1;
p12.receiver = &v12;
- p12.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p12.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p12, o12.received_params().back()));
// v111 should see both changing and changed notifications.
EXPECT_EQ(2U, o111.received_params().size());
- ViewTreeNodeObserver::TreeChangeParams p111;
+ NodeObserver::TreeChangeParams p111;
p111 = p1;
p111.receiver = &v111;
- p111.phase = ViewTreeNodeObserver::DISPOSITION_CHANGING;
+ p111.phase = NodeObserver::DISPOSITION_CHANGING;
EXPECT_TRUE(TreeChangeParamsMatch(p111, o111.received_params().front()));
- p111.phase = ViewTreeNodeObserver::DISPOSITION_CHANGED;
+ p111.phase = NodeObserver::DISPOSITION_CHANGED;
EXPECT_TRUE(TreeChangeParamsMatch(p111, o111.received_params().back()));
}
namespace {
-class OrderChangeObserver : public ViewTreeNodeObserver {
+class OrderChangeObserver : public NodeObserver {
public:
struct Change {
- ViewTreeNode* node;
- ViewTreeNode* relative_node;
+ Node* node;
+ Node* relative_node;
OrderDirection direction;
DispositionChangePhase phase;
};
typedef std::vector<Change> Changes;
- explicit OrderChangeObserver(ViewTreeNode* observee) : observee_(observee) {
+ explicit OrderChangeObserver(Node* observee) : observee_(observee) {
observee_->AddObserver(this);
}
virtual ~OrderChangeObserver() {
@@ -372,9 +372,9 @@ class OrderChangeObserver : public ViewTreeNodeObserver {
}
private:
- // Overridden from ViewTreeNodeObserver:
- virtual void OnNodeReordered(ViewTreeNode* node,
- ViewTreeNode* relative_node,
+ // Overridden from NodeObserver:
+ virtual void OnNodeReordered(Node* node,
+ Node* relative_node,
OrderDirection direction,
DispositionChangePhase phase) OVERRIDE {
Change change;
@@ -385,7 +385,7 @@ class OrderChangeObserver : public ViewTreeNodeObserver {
changes_.push_back(change);
}
- ViewTreeNode* observee_;
+ Node* observee_;
Changes changes_;
DISALLOW_COPY_AND_ASSIGN(OrderChangeObserver);
@@ -393,8 +393,8 @@ class OrderChangeObserver : public ViewTreeNodeObserver {
} // namespace
-TEST_F(ViewTreeNodeObserverTest, Order) {
- TestViewTreeNode v1, v11, v12, v13;
+TEST_F(NodeObserverTest, Order) {
+ TestNode v1, v11, v12, v13;
v1.AddChild(&v11);
v1.AddChild(&v12);
v1.AddChild(&v13);
@@ -418,12 +418,12 @@ TEST_F(ViewTreeNodeObserverTest, Order) {
EXPECT_EQ(&v11, changes[0].node);
EXPECT_EQ(&v13, changes[0].relative_node);
EXPECT_EQ(ORDER_ABOVE, changes[0].direction);
- EXPECT_EQ(ViewTreeNodeObserver::DISPOSITION_CHANGING, changes[0].phase);
+ EXPECT_EQ(NodeObserver::DISPOSITION_CHANGING, changes[0].phase);
EXPECT_EQ(&v11, changes[1].node);
EXPECT_EQ(&v13, changes[1].relative_node);
EXPECT_EQ(ORDER_ABOVE, changes[1].direction);
- EXPECT_EQ(ViewTreeNodeObserver::DISPOSITION_CHANGED, changes[1].phase);
+ EXPECT_EQ(NodeObserver::DISPOSITION_CHANGED, changes[1].phase);
}
{
@@ -440,12 +440,12 @@ TEST_F(ViewTreeNodeObserverTest, Order) {
EXPECT_EQ(&v11, changes[0].node);
EXPECT_EQ(&v12, changes[0].relative_node);
EXPECT_EQ(ORDER_BELOW, changes[0].direction);
- EXPECT_EQ(ViewTreeNodeObserver::DISPOSITION_CHANGING, changes[0].phase);
+ EXPECT_EQ(NodeObserver::DISPOSITION_CHANGING, changes[0].phase);
EXPECT_EQ(&v11, changes[1].node);
EXPECT_EQ(&v12, changes[1].relative_node);
EXPECT_EQ(ORDER_BELOW, changes[1].direction);
- EXPECT_EQ(ViewTreeNodeObserver::DISPOSITION_CHANGED, changes[1].phase);
+ EXPECT_EQ(NodeObserver::DISPOSITION_CHANGED, changes[1].phase);
}
{
@@ -462,12 +462,12 @@ TEST_F(ViewTreeNodeObserverTest, Order) {
EXPECT_EQ(&v11, changes[0].node);
EXPECT_EQ(&v12, changes[0].relative_node);
EXPECT_EQ(ORDER_ABOVE, changes[0].direction);
- EXPECT_EQ(ViewTreeNodeObserver::DISPOSITION_CHANGING, changes[0].phase);
+ EXPECT_EQ(NodeObserver::DISPOSITION_CHANGING, changes[0].phase);
EXPECT_EQ(&v11, changes[1].node);
EXPECT_EQ(&v12, changes[1].relative_node);
EXPECT_EQ(ORDER_ABOVE, changes[1].direction);
- EXPECT_EQ(ViewTreeNodeObserver::DISPOSITION_CHANGED, changes[1].phase);
+ EXPECT_EQ(NodeObserver::DISPOSITION_CHANGED, changes[1].phase);
}
{
@@ -484,12 +484,12 @@ TEST_F(ViewTreeNodeObserverTest, Order) {
EXPECT_EQ(&v11, changes[0].node);
EXPECT_EQ(&v12, changes[0].relative_node);
EXPECT_EQ(ORDER_BELOW, changes[0].direction);
- EXPECT_EQ(ViewTreeNodeObserver::DISPOSITION_CHANGING, changes[0].phase);
+ EXPECT_EQ(NodeObserver::DISPOSITION_CHANGING, changes[0].phase);
EXPECT_EQ(&v11, changes[1].node);
EXPECT_EQ(&v12, changes[1].relative_node);
EXPECT_EQ(ORDER_BELOW, changes[1].direction);
- EXPECT_EQ(ViewTreeNodeObserver::DISPOSITION_CHANGED, changes[1].phase);
+ EXPECT_EQ(NodeObserver::DISPOSITION_CHANGED, changes[1].phase);
}
}
@@ -507,14 +507,14 @@ std::string RectToString(const gfx::Rect& rect) {
rect.x(), rect.y(), rect.width(), rect.height());
}
-std::string PhaseToString(ViewTreeNodeObserver::DispositionChangePhase phase) {
- return phase == ViewTreeNodeObserver::DISPOSITION_CHANGING ?
+std::string PhaseToString(NodeObserver::DispositionChangePhase phase) {
+ return phase == NodeObserver::DISPOSITION_CHANGING ?
"changing" : "changed";
}
-class BoundsChangeObserver : public ViewTreeNodeObserver {
+class BoundsChangeObserver : public NodeObserver {
public:
- explicit BoundsChangeObserver(ViewTreeNode* node) : node_(node) {
+ explicit BoundsChangeObserver(Node* node) : node_(node) {
node_->AddObserver(this);
}
virtual ~BoundsChangeObserver() {
@@ -528,8 +528,8 @@ class BoundsChangeObserver : public ViewTreeNodeObserver {
}
private:
- // Overridden from ViewTreeNodeObserver:
- virtual void OnNodeBoundsChange(ViewTreeNode* node,
+ // Overridden from NodeObserver:
+ virtual void OnNodeBoundsChange(Node* node,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds,
DispositionChangePhase phase) OVERRIDE {
@@ -542,7 +542,7 @@ class BoundsChangeObserver : public ViewTreeNodeObserver {
PhaseToString(phase).c_str()));
}
- ViewTreeNode* node_;
+ Node* node_;
Changes changes_;
DISALLOW_COPY_AND_ASSIGN(BoundsChangeObserver);
@@ -550,8 +550,8 @@ class BoundsChangeObserver : public ViewTreeNodeObserver {
} // namespace
-TEST_F(ViewTreeNodeObserverTest, SetBounds) {
- TestViewTreeNode v1;
+TEST_F(NodeObserverTest, SetBounds) {
+ TestNode v1;
{
BoundsChangeObserver observer(&v1);
v1.SetBounds(gfx::Rect(0, 0, 100, 100));
diff --git a/mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc b/mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc
index f526879..d9e152b 100644
--- a/mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc
+++ b/mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc
@@ -9,13 +9,13 @@
#include "base/logging.h"
#include "mojo/public/cpp/application/application.h"
#include "mojo/service_manager/service_manager.h"
-#include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h"
-#include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h"
+#include "mojo/services/public/cpp/view_manager/lib/node_private.h"
+#include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h"
+#include "mojo/services/public/cpp/view_manager/node_observer.h"
#include "mojo/services/public/cpp/view_manager/util.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
#include "mojo/services/public/cpp/view_manager/view_observer.h"
-#include "mojo/services/public/cpp/view_manager/view_tree_node_observer.h"
#include "mojo/shell/shell_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -39,16 +39,16 @@ void QuitRunLoop() {
current_run_loop->Quit();
}
-void WaitForAllChangesToBeAcked(ViewManagerSynchronizer* synchronizer) {
- synchronizer->set_changes_acked_callback(base::Bind(&QuitRunLoop));
+void WaitForAllChangesToBeAcked(ViewManagerClientImpl* client) {
+ client->set_changes_acked_callback(base::Bind(&QuitRunLoop));
DoRunLoop();
- synchronizer->ClearChangesAckedCallback();
+ client->ClearChangesAckedCallback();
}
class ConnectServiceLoader : public ServiceLoader,
public ViewManagerDelegate {
public:
- typedef base::Callback<void(ViewManager*, ViewTreeNode*)> LoadedCallback;
+ typedef base::Callback<void(ViewManager*, Node*)> LoadedCallback;
explicit ConnectServiceLoader(const LoadedCallback& callback)
: callback_(callback) {
@@ -70,7 +70,7 @@ class ConnectServiceLoader : public ServiceLoader,
// Overridden from ViewManagerDelegate:
virtual void OnRootAdded(ViewManager* view_manager,
- ViewTreeNode* root) OVERRIDE {
+ Node* root) OVERRIDE {
callback_.Run(view_manager, root);
}
@@ -80,15 +80,15 @@ class ConnectServiceLoader : public ServiceLoader,
DISALLOW_COPY_AND_ASSIGN(ConnectServiceLoader);
};
-class ActiveViewChangedObserver : public ViewTreeNodeObserver {
+class ActiveViewChangedObserver : public NodeObserver {
public:
- explicit ActiveViewChangedObserver(ViewTreeNode* node)
+ explicit ActiveViewChangedObserver(Node* node)
: node_(node) {}
virtual ~ActiveViewChangedObserver() {}
private:
- // Overridden from ViewTreeNodeObserver:
- virtual void OnNodeActiveViewChange(ViewTreeNode* node,
+ // Overridden from NodeObserver:
+ virtual void OnNodeActiveViewChange(Node* node,
View* old_view,
View* new_view,
DispositionChangePhase phase) OVERRIDE {
@@ -96,43 +96,43 @@ class ActiveViewChangedObserver : public ViewTreeNodeObserver {
QuitRunLoop();
}
- ViewTreeNode* node_;
+ Node* node_;
DISALLOW_COPY_AND_ASSIGN(ActiveViewChangedObserver);
};
// Waits until the active view id of the supplied node changes.
-void WaitForActiveViewToChange(ViewTreeNode* node) {
+void WaitForActiveViewToChange(Node* node) {
ActiveViewChangedObserver observer(node);
node->AddObserver(&observer);
DoRunLoop();
node->RemoveObserver(&observer);
}
-class BoundsChangeObserver : public ViewTreeNodeObserver {
+class BoundsChangeObserver : public NodeObserver {
public:
- explicit BoundsChangeObserver(ViewTreeNode* node) : node_(node) {}
+ explicit BoundsChangeObserver(Node* node) : node_(node) {}
virtual ~BoundsChangeObserver() {}
private:
- // Overridden from ViewTreeNodeObserver:
- virtual void OnNodeBoundsChange(ViewTreeNode* node,
+ // Overridden from NodeObserver:
+ virtual void OnNodeBoundsChange(Node* node,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds,
DispositionChangePhase phase) OVERRIDE {
DCHECK_EQ(node, node_);
- if (phase != ViewTreeNodeObserver::DISPOSITION_CHANGED)
+ if (phase != NodeObserver::DISPOSITION_CHANGED)
return;
QuitRunLoop();
}
- ViewTreeNode* node_;
+ Node* node_;
DISALLOW_COPY_AND_ASSIGN(BoundsChangeObserver);
};
// Wait until the bounds of the supplied node change.
-void WaitForBoundsToChange(ViewTreeNode* node) {
+void WaitForBoundsToChange(Node* node) {
BoundsChangeObserver observer(node);
node->AddObserver(&observer);
DoRunLoop();
@@ -141,9 +141,9 @@ void WaitForBoundsToChange(ViewTreeNode* node) {
// Spins a runloop until the tree beginning at |root| has |tree_size| nodes
// (including |root|).
-class TreeSizeMatchesObserver : public ViewTreeNodeObserver {
+class TreeSizeMatchesObserver : public NodeObserver {
public:
- TreeSizeMatchesObserver(ViewTreeNode* tree, size_t tree_size)
+ TreeSizeMatchesObserver(Node* tree, size_t tree_size)
: tree_(tree),
tree_size_(tree_size) {}
virtual ~TreeSizeMatchesObserver() {}
@@ -153,27 +153,27 @@ class TreeSizeMatchesObserver : public ViewTreeNodeObserver {
}
private:
- // Overridden from ViewTreeNodeObserver:
+ // Overridden from NodeObserver:
virtual void OnTreeChange(const TreeChangeParams& params) OVERRIDE {
if (IsTreeCorrectSize())
QuitRunLoop();
}
- size_t CountNodes(const ViewTreeNode* node) const {
+ size_t CountNodes(const Node* node) const {
size_t count = 1;
- ViewTreeNode::Children::const_iterator it = node->children().begin();
+ Node::Children::const_iterator it = node->children().begin();
for (; it != node->children().end(); ++it)
count += CountNodes(*it);
return count;
}
- ViewTreeNode* tree_;
+ Node* tree_;
size_t tree_size_;
DISALLOW_COPY_AND_ASSIGN(TreeSizeMatchesObserver);
};
-void WaitForTreeSizeToMatch(ViewTreeNode* node, size_t tree_size) {
+void WaitForTreeSizeToMatch(Node* node, size_t tree_size) {
TreeSizeMatchesObserver observer(node, tree_size);
if (observer.IsTreeCorrectSize())
return;
@@ -185,8 +185,7 @@ void WaitForTreeSizeToMatch(ViewTreeNode* node, size_t tree_size) {
// Utility class that waits for the destruction of some number of nodes and
// views.
-class DestructionObserver : public ViewTreeNodeObserver,
- public ViewObserver {
+class DestructionObserver : public NodeObserver, public ViewObserver {
public:
// |nodes| or |views| can be NULL.
DestructionObserver(std::set<Id>* nodes, std::set<Id>* views)
@@ -194,11 +193,11 @@ class DestructionObserver : public ViewTreeNodeObserver,
views_(views) {}
private:
- // Overridden from ViewTreeNodeObserver:
+ // Overridden from NodeObserver:
virtual void OnNodeDestroy(
- ViewTreeNode* node,
- ViewTreeNodeObserver::DispositionChangePhase phase) OVERRIDE {
- if (phase != ViewTreeNodeObserver::DISPOSITION_CHANGED)
+ Node* node,
+ NodeObserver::DispositionChangePhase phase) OVERRIDE {
+ if (phase != NodeObserver::DISPOSITION_CHANGED)
return;
std::set<Id>::const_iterator it = nodes_->find(node->id());
if (it != nodes_->end())
@@ -250,9 +249,9 @@ void WaitForDestruction(ViewManager* view_manager,
DoRunLoop();
}
-class OrderChangeObserver : public ViewTreeNodeObserver {
+class OrderChangeObserver : public NodeObserver {
public:
- OrderChangeObserver(ViewTreeNode* node) : node_(node) {
+ OrderChangeObserver(Node* node) : node_(node) {
node_->AddObserver(this);
}
virtual ~OrderChangeObserver() {
@@ -260,33 +259,32 @@ class OrderChangeObserver : public ViewTreeNodeObserver {
}
private:
- // Overridden from ViewTreeNodeObserver:
- virtual void OnNodeReordered(ViewTreeNode* node,
- ViewTreeNode* relative_node,
+ // Overridden from NodeObserver:
+ virtual void OnNodeReordered(Node* node,
+ Node* relative_node,
OrderDirection direction,
DispositionChangePhase phase) OVERRIDE {
- if (phase != ViewTreeNodeObserver::DISPOSITION_CHANGED)
+ if (phase != NodeObserver::DISPOSITION_CHANGED)
return;
DCHECK_EQ(node, node_);
QuitRunLoop();
}
- ViewTreeNode* node_;
+ Node* node_;
DISALLOW_COPY_AND_ASSIGN(OrderChangeObserver);
};
-void WaitForOrderChange(ViewManager* view_manager,
- ViewTreeNode* node) {
+void WaitForOrderChange(ViewManager* view_manager, Node* node) {
OrderChangeObserver observer(node);
DoRunLoop();
}
// Tracks a node's destruction. Query is_valid() for current state.
-class NodeTracker : public ViewTreeNodeObserver {
+class NodeTracker : public NodeObserver {
public:
- explicit NodeTracker(ViewTreeNode* node) : node_(node) {
+ explicit NodeTracker(Node* node) : node_(node) {
node_->AddObserver(this);
}
virtual ~NodeTracker() {
@@ -297,18 +295,18 @@ class NodeTracker : public ViewTreeNodeObserver {
bool is_valid() const { return !!node_; }
private:
- // Overridden from ViewTreeNodeObserver:
+ // Overridden from NodeObserver:
virtual void OnNodeDestroy(
- ViewTreeNode* node,
- ViewTreeNodeObserver::DispositionChangePhase phase) OVERRIDE {
- if (phase != ViewTreeNodeObserver::DISPOSITION_CHANGED)
+ Node* node,
+ NodeObserver::DispositionChangePhase phase) OVERRIDE {
+ if (phase != NodeObserver::DISPOSITION_CHANGED)
return;
DCHECK_EQ(node, node_);
node_ = NULL;
}
int id_;
- ViewTreeNode* node_;
+ Node* node_;
DISALLOW_COPY_AND_ASSIGN(NodeTracker);
};
@@ -331,16 +329,16 @@ class ViewManagerTest : public testing::Test {
protected:
ViewManager* window_manager() { return window_manager_; }
- ViewTreeNode* CreateNodeInParent(ViewTreeNode* parent) {
- ViewManager* parent_manager = ViewTreeNodePrivate(parent).view_manager();
- ViewTreeNode* node = ViewTreeNode::Create(parent_manager);
+ Node* CreateNodeInParent(Node* parent) {
+ ViewManager* parent_manager = NodePrivate(parent).view_manager();
+ Node* node = Node::Create(parent_manager);
parent->AddChild(node);
return node;
}
// Embeds another version of the test app @ node.
- ViewManager* Embed(ViewManager* view_manager, ViewTreeNode* node) {
- DCHECK_EQ(view_manager, ViewTreeNodePrivate(node).view_manager());
+ ViewManager* Embed(ViewManager* view_manager, Node* node) {
+ DCHECK_EQ(view_manager, NodePrivate(node).view_manager());
node->Embed(kEmbeddedApp1URL);
RunRunLoop();
return GetLoadedViewManager();
@@ -397,7 +395,7 @@ class ViewManagerTest : public testing::Test {
return result;
}
- void OnViewManagerLoaded(ViewManager* view_manager, ViewTreeNode* root) {
+ void OnViewManagerLoaded(ViewManager* view_manager, Node* root) {
loaded_view_manager_ = view_manager;
connect_loop_->Quit();
}
@@ -426,12 +424,12 @@ class ViewManagerTest : public testing::Test {
TEST_F(ViewManagerTest, SetUp) {}
TEST_F(ViewManagerTest, Embed) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
EXPECT_TRUE(NULL != embedded);
- ViewTreeNode* node_in_embedded = embedded->GetRoots().front();
+ Node* node_in_embedded = embedded->GetRoots().front();
EXPECT_EQ(node->parent(), window_manager()->GetRoots().front());
EXPECT_EQ(NULL, node_in_embedded->parent());
}
@@ -440,10 +438,10 @@ TEST_F(ViewManagerTest, Embed) {
// visible to A.
// TODO(beng): verify whether or not this is a policy we like.
TEST_F(ViewManagerTest, HierarchyChanged_NodeAdded) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
- ViewTreeNode* nested = ViewTreeNode::Create(window_manager());
+ Node* nested = Node::Create(window_manager());
node->AddChild(nested);
WaitForTreeSizeToMatch(embedded->GetRoots().front(), 2);
EXPECT_EQ(embedded->GetRoots().front()->children().front()->id(),
@@ -454,17 +452,17 @@ TEST_F(ViewManagerTest, HierarchyChanged_NodeAdded) {
// a child of N2. Reparents N2 to N1. N1 should become visible to A.
// TODO(beng): verify whether or not this is a policy we like.
TEST_F(ViewManagerTest, HierarchyChanged_NodeMoved) {
- ViewTreeNode* node1 = ViewTreeNode::Create(window_manager());
+ Node* node1 = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node1);
ViewManager* embedded = Embed(window_manager(), node1);
WaitForTreeSizeToMatch(embedded->GetRoots().front(), 1);
- ViewTreeNode* node2 = ViewTreeNode::Create(window_manager());
+ Node* node2 = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node2);
WaitForTreeSizeToMatch(embedded->GetRoots().front(), 1);
EXPECT_TRUE(embedded->GetRoots().front()->children().empty());
- ViewTreeNode* node21 = ViewTreeNode::Create(window_manager());
+ Node* node21 = Node::Create(window_manager());
node2->AddChild(node21);
WaitForTreeSizeToMatch(embedded->GetRoots().front(), 1);
EXPECT_TRUE(embedded->GetRoots().front()->children().empty());
@@ -481,9 +479,9 @@ TEST_F(ViewManagerTest, HierarchyChanged_NodeMoved) {
// N1. N11 should disappear from A.
// TODO(beng): verify whether or not this is a policy we like.
TEST_F(ViewManagerTest, HierarchyChanged_NodeRemoved) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
- ViewTreeNode* nested = ViewTreeNode::Create(window_manager());
+ Node* nested = Node::Create(window_manager());
node->AddChild(nested);
ViewManager* embedded = Embed(window_manager(), node);
@@ -499,9 +497,9 @@ TEST_F(ViewManagerTest, HierarchyChanged_NodeRemoved) {
// N11 should disappear from A.
// TODO(beng): verify whether or not this is a policy we like.
TEST_F(ViewManagerTest, NodeDestroyed) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
- ViewTreeNode* nested = ViewTreeNode::Create(window_manager());
+ Node* nested = Node::Create(window_manager());
node->AddChild(nested);
ViewManager* embedded = Embed(window_manager(), node);
@@ -521,7 +519,7 @@ TEST_F(ViewManagerTest, NodeDestroyed) {
}
TEST_F(ViewManagerTest, ViewManagerDestroyed_CleanupNode) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
@@ -537,28 +535,28 @@ TEST_F(ViewManagerTest, ViewManagerDestroyed_CleanupNode) {
}
TEST_F(ViewManagerTest, SetActiveView) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
View* view = View::Create(window_manager());
node->SetActiveView(view);
- ViewTreeNode* node_in_embedded = embedded->GetNodeById(node->id());
+ Node* node_in_embedded = embedded->GetNodeById(node->id());
WaitForActiveViewToChange(node_in_embedded);
EXPECT_EQ(node_in_embedded->active_view()->id(), view->id());
}
TEST_F(ViewManagerTest, DestroyView) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
View* view = View::Create(window_manager());
node->SetActiveView(view);
- ViewTreeNode* node_in_embedded = embedded->GetNodeById(node->id());
+ Node* node_in_embedded = embedded->GetNodeById(node->id());
WaitForActiveViewToChange(node_in_embedded);
EXPECT_EQ(node_in_embedded->active_view()->id(), view->id());
@@ -576,7 +574,7 @@ TEST_F(ViewManagerTest, DestroyView) {
// Destroying the connection that created a node and view should result in that
// node and view disappearing from all connections that see them.
TEST_F(ViewManagerTest, ViewManagerDestroyed_CleanupNodeAndView) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
View* view = View::Create(window_manager());
node->SetActiveView(view);
@@ -606,11 +604,11 @@ TEST_F(ViewManagerTest, ViewManagerDestroyed_CleanupNodeAndView) {
// should be disconnected from any nodes.
TEST_F(ViewManagerTest,
ViewManagerDestroyed_CleanupNodeAndViewFromDifferentConnections) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
View* view_in_embedded = View::Create(embedded);
- ViewTreeNode* node_in_embedded = embedded->GetNodeById(node->id());
+ Node* node_in_embedded = embedded->GetNodeById(node->id());
node_in_embedded->SetActiveView(view_in_embedded);
WaitForActiveViewToChange(node);
@@ -634,10 +632,10 @@ TEST_F(ViewManagerTest,
// This test verifies that it is not possible to set the active view to a view
// defined in a different connection.
-// TODO(beng): write these tests for ViewTreeNode::AddChild(), RemoveChild() and
+// TODO(beng): write these tests for Node::AddChild(), RemoveChild() and
// Contains().
TEST_F(ViewManagerTest, SetActiveViewAcrossConnection) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
@@ -649,27 +647,27 @@ TEST_F(ViewManagerTest, SetActiveViewAcrossConnection) {
// becomes entirely visible to the second connection when the hierarchy is
// attached.
TEST_F(ViewManagerTest, MapSubtreeOnAttach) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
// Create a subtree private to the window manager and make some changes to it.
- ViewTreeNode* child1 = ViewTreeNode::Create(window_manager());
- ViewTreeNode* child11 = ViewTreeNode::Create(window_manager());
+ Node* child1 = Node::Create(window_manager());
+ Node* child11 = Node::Create(window_manager());
child1->AddChild(child11);
gfx::Rect child11_bounds(800, 600);
child11->SetBounds(child11_bounds);
View* view11 = View::Create(window_manager());
child11->SetActiveView(view11);
WaitForAllChangesToBeAcked(
- static_cast<ViewManagerSynchronizer*>(window_manager()));
+ static_cast<ViewManagerClientImpl*>(window_manager()));
// When added to the shared node, the entire hierarchy and all property
// changes should become visible to the embedded app.
node->AddChild(child1);
WaitForTreeSizeToMatch(embedded->GetRoots().front(), 3);
- ViewTreeNode* child11_in_embedded = embedded->GetNodeById(child11->id());
+ Node* child11_in_embedded = embedded->GetNodeById(child11->id());
View* view11_in_embedded = embedded->GetViewById(view11->id());
EXPECT_TRUE(child11_in_embedded != NULL);
EXPECT_EQ(view11_in_embedded, child11_in_embedded->active_view());
@@ -679,11 +677,11 @@ TEST_F(ViewManagerTest, MapSubtreeOnAttach) {
// Verifies that bounds changes applied to a node hierarchy in one connection
// are reflected to another.
TEST_F(ViewManagerTest, SetBounds) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
- ViewTreeNode* node_in_embedded = embedded->GetNodeById(node->id());
+ Node* node_in_embedded = embedded->GetNodeById(node->id());
EXPECT_EQ(node->bounds(), node_in_embedded->bounds());
node->SetBounds(gfx::Rect(100, 100));
@@ -695,11 +693,11 @@ TEST_F(ViewManagerTest, SetBounds) {
// Verifies that bounds changes applied to a node owned by a different
// connection are refused.
TEST_F(ViewManagerTest, SetBoundsSecurity) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
- ViewTreeNode* node_in_embedded = embedded->GetNodeById(node->id());
+ Node* node_in_embedded = embedded->GetNodeById(node->id());
node->SetBounds(gfx::Rect(800, 600));
WaitForBoundsToChange(node_in_embedded);
@@ -710,11 +708,11 @@ TEST_F(ViewManagerTest, SetBoundsSecurity) {
// Verifies that a node can only be destroyed by the connection that created it.
TEST_F(ViewManagerTest, DestroySecurity) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
- ViewTreeNode* node_in_embedded = embedded->GetNodeById(node->id());
+ Node* node_in_embedded = embedded->GetNodeById(node->id());
NodeTracker tracker2(node_in_embedded);
node_in_embedded->Destroy();
@@ -727,9 +725,9 @@ TEST_F(ViewManagerTest, DestroySecurity) {
}
TEST_F(ViewManagerTest, MultiRoots) {
- ViewTreeNode* node1 = ViewTreeNode::Create(window_manager());
+ Node* node1 = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node1);
- ViewTreeNode* node2 = ViewTreeNode::Create(window_manager());
+ Node* node2 = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node2);
ViewManager* embedded1 = Embed(window_manager(), node1);
ViewManager* embedded2 = Embed(window_manager(), node2);
@@ -737,24 +735,24 @@ TEST_F(ViewManagerTest, MultiRoots) {
}
TEST_F(ViewManagerTest, EmbeddingIdentity) {
- ViewTreeNode* node = ViewTreeNode::Create(window_manager());
+ Node* node = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node);
ViewManager* embedded = Embed(window_manager(), node);
EXPECT_EQ(kWindowManagerURL, embedded->GetEmbedderURL());
}
TEST_F(ViewManagerTest, Reorder) {
- ViewTreeNode* node1 = ViewTreeNode::Create(window_manager());
+ Node* node1 = Node::Create(window_manager());
window_manager()->GetRoots().front()->AddChild(node1);
- ViewTreeNode* node11 = ViewTreeNode::Create(window_manager());
+ Node* node11 = Node::Create(window_manager());
node1->AddChild(node11);
- ViewTreeNode* node12 = ViewTreeNode::Create(window_manager());
+ Node* node12 = Node::Create(window_manager());
node1->AddChild(node12);
ViewManager* embedded = Embed(window_manager(), node1);
- ViewTreeNode* node1_in_embedded = embedded->GetNodeById(node1->id());
+ Node* node1_in_embedded = embedded->GetNodeById(node1->id());
{
node11->MoveToFront();
diff --git a/mojo/services/public/cpp/view_manager/tests/view_tree_host_unittest.cc b/mojo/services/public/cpp/view_manager/tests/view_tree_host_unittest.cc
deleted file mode 100644
index e69de29..0000000
--- a/mojo/services/public/cpp/view_manager/tests/view_tree_host_unittest.cc
+++ /dev/null
diff --git a/mojo/services/public/cpp/view_manager/view_manager_types.h b/mojo/services/public/cpp/view_manager/types.h
index 09f48f4..c1f33f3 100644
--- a/mojo/services/public/cpp/view_manager/view_manager_types.h
+++ b/mojo/services/public/cpp/view_manager/types.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_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_TYPES_H_
-#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_TYPES_H_
+#ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_TYPES_H_
+#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_TYPES_H_
#include "base/basictypes.h"
@@ -24,4 +24,4 @@ typedef uint16_t ConnectionSpecificId;
} // namespace view_manager
} // namespace mojo
-#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_TYPES_H_
+#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_TYPES_H_
diff --git a/mojo/services/public/cpp/view_manager/util.h b/mojo/services/public/cpp/view_manager/util.h
index 87382e2..6716075 100644
--- a/mojo/services/public/cpp/view_manager/util.h
+++ b/mojo/services/public/cpp/view_manager/util.h
@@ -5,7 +5,7 @@
#ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_UTIL_H_
#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_UTIL_H_
-#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
+#include "mojo/services/public/cpp/view_manager/types.h"
// TODO(beng): #$*&@#(@ MacOSX SDK!
#if defined(HiWord)
diff --git a/mojo/services/public/cpp/view_manager/view.h b/mojo/services/public/cpp/view_manager/view.h
index 28f072c..b10417b 100644
--- a/mojo/services/public/cpp/view_manager/view.h
+++ b/mojo/services/public/cpp/view_manager/view.h
@@ -7,7 +7,7 @@
#include "base/basictypes.h"
#include "base/observer_list.h"
-#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
+#include "mojo/services/public/cpp/view_manager/types.h"
#include "third_party/skia/include/core/SkColor.h"
class SkBitmap;
@@ -15,9 +15,9 @@ class SkBitmap;
namespace mojo {
namespace view_manager {
+class Node;
class ViewManager;
class ViewObserver;
-class ViewTreeNode;
// Views are owned by the ViewManager.
class View {
@@ -27,7 +27,7 @@ class View {
void Destroy();
Id id() const { return id_; }
- ViewTreeNode* node() { return node_; }
+ Node* node() { return node_; }
void AddObserver(ViewObserver* observer);
void RemoveObserver(ViewObserver* observer);
@@ -46,7 +46,7 @@ class View {
void LocalDestroy();
Id id_;
- ViewTreeNode* node_;
+ Node* node_;
ViewManager* manager_;
ObserverList<ViewObserver> observers_;
diff --git a/mojo/services/public/cpp/view_manager/view_manager.h b/mojo/services/public/cpp/view_manager/view_manager.h
index 36a1c4a..6ed6e90 100644
--- a/mojo/services/public/cpp/view_manager/view_manager.h
+++ b/mojo/services/public/cpp/view_manager/view_manager.h
@@ -8,15 +8,15 @@
#include <string>
#include <vector>
-#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
+#include "mojo/services/public/cpp/view_manager/types.h"
namespace mojo {
class Application;
namespace view_manager {
+class Node;
class View;
class ViewManagerDelegate;
-class ViewTreeNode;
class ViewManager {
public:
@@ -27,10 +27,10 @@ class ViewManager {
virtual const std::string& GetEmbedderURL() const = 0;
// Returns all root nodes known to this connection.
- virtual const std::vector<ViewTreeNode*>& GetRoots() const = 0;
+ virtual const std::vector<Node*>& GetRoots() const = 0;
// Returns a Node or View known to this connection.
- virtual ViewTreeNode* GetNodeById(Id id) = 0;
+ virtual Node* GetNodeById(Id id) = 0;
virtual View* GetViewById(Id id) = 0;
protected:
diff --git a/mojo/services/public/cpp/view_manager/view_manager_delegate.h b/mojo/services/public/cpp/view_manager/view_manager_delegate.h
index 4d8e5e6..a9c4b90 100644
--- a/mojo/services/public/cpp/view_manager/view_manager_delegate.h
+++ b/mojo/services/public/cpp/view_manager/view_manager_delegate.h
@@ -8,13 +8,13 @@
namespace mojo {
namespace view_manager {
+class Node;
class ViewManager;
-class ViewTreeNode;
class ViewManagerDelegate {
public:
- virtual void OnRootAdded(ViewManager* view_manager, ViewTreeNode* root) {}
- virtual void OnRootRemoved(ViewManager* view_manager, ViewTreeNode* root) {}
+ virtual void OnRootAdded(ViewManager* view_manager, Node* root) {}
+ virtual void OnRootRemoved(ViewManager* view_manager, Node* root) {}
protected:
virtual ~ViewManagerDelegate() {}
diff --git a/mojo/services/public/cpp/view_manager/view_tree_host.h b/mojo/services/public/cpp/view_manager/view_tree_host.h
deleted file mode 100644
index 81f9c71..0000000
--- a/mojo/services/public/cpp/view_manager/view_tree_host.h
+++ /dev/null
@@ -1,22 +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_VIEW_TREE_HOST_H_
-#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_HOST_H_
-
-#include "base/basictypes.h"
-
-namespace mojo {
-namespace view_manager {
-
-class ViewTreeHost {
- public:
- private:
- DISALLOW_COPY_AND_ASSIGN(ViewTreeHost);
-};
-
-} // namespace view_manager
-} // namespace mojo
-
-#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_HOST_H_
diff --git a/mojo/services/view_manager/ids.h b/mojo/services/view_manager/ids.h
index 9d17852..b7cfe45 100644
--- a/mojo/services/view_manager/ids.h
+++ b/mojo/services/view_manager/ids.h
@@ -5,8 +5,8 @@
#ifndef MOJO_SERVICES_VIEW_MANAGER_IDS_H_
#define MOJO_SERVICES_VIEW_MANAGER_IDS_H_
+#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/cpp/view_manager/util.h"
-#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
#include "mojo/services/view_manager/view_manager_export.h"
namespace mojo {
diff --git a/mojo/services/view_manager/test_change_tracker.h b/mojo/services/view_manager/test_change_tracker.h
index 4896f84..5a5edf7 100644
--- a/mojo/services/view_manager/test_change_tracker.h
+++ b/mojo/services/view_manager/test_change_tracker.h
@@ -9,7 +9,7 @@
#include <vector>
#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
+#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
#include "ui/gfx/rect.h"
diff --git a/mojo/services/view_manager/view_manager_unittest.cc b/mojo/services/view_manager/view_manager_unittest.cc
index 7fe5234..112a36f 100644
--- a/mojo/services/view_manager/view_manager_unittest.cc
+++ b/mojo/services/view_manager/view_manager_unittest.cc
@@ -19,8 +19,8 @@
#include "mojo/public/cpp/bindings/lib/router.h"
#include "mojo/service_manager/service_manager.h"
#include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
+#include "mojo/services/public/cpp/view_manager/types.h"
#include "mojo/services/public/cpp/view_manager/util.h"
-#include "mojo/services/public/cpp/view_manager/view_manager_types.h"
#include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
#include "mojo/services/view_manager/ids.h"
#include "mojo/services/view_manager/test_change_tracker.h"