Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: mojo/services/view_manager/connection_manager.cc

Issue 513923004: More viewmanager renaming: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sim30 Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/view_manager/connection_manager.h ('k') | mojo/services/view_manager/default_access_policy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/view_manager/connection_manager.cc
diff --git a/mojo/services/view_manager/root_node_manager.cc b/mojo/services/view_manager/connection_manager.cc
similarity index 56%
rename from mojo/services/view_manager/root_node_manager.cc
rename to mojo/services/view_manager/connection_manager.cc
index 18461b790110755e5ebce0ddc376733cfdd91a9b..bc1f21db0bfc989cebf896ac4db3e60ec11fe1e9 100644
--- a/mojo/services/view_manager/root_node_manager.cc
+++ b/mojo/services/view_manager/connection_manager.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/view_manager/root_node_manager.h"
+#include "mojo/services/view_manager/connection_manager.h"
#include "base/logging.h"
#include "mojo/public/cpp/application/application_connection.h"
@@ -14,30 +14,30 @@
namespace mojo {
namespace service {
-RootNodeManager::ScopedChange::ScopedChange(
+ConnectionManager::ScopedChange::ScopedChange(
ViewManagerServiceImpl* connection,
- RootNodeManager* root,
- bool is_delete_node)
- : root_(root),
+ ConnectionManager* connection_manager,
+ bool is_delete_view)
+ : connection_manager_(connection_manager),
connection_id_(connection->id()),
- is_delete_node_(is_delete_node) {
- root_->PrepareForChange(this);
+ is_delete_view_(is_delete_view) {
+ connection_manager_->PrepareForChange(this);
}
-RootNodeManager::ScopedChange::~ScopedChange() {
- root_->FinishChange();
+ConnectionManager::ScopedChange::~ScopedChange() {
+ connection_manager_->FinishChange();
}
-RootNodeManager::Context::Context() {
+ConnectionManager::Context::Context() {
// Pass in false as native viewport creates the PlatformEventSource.
aura::Env::CreateInstance(false);
}
-RootNodeManager::Context::~Context() {
+ConnectionManager::Context::~Context() {
aura::Env::DeleteInstance();
}
-RootNodeManager::RootNodeManager(
+ConnectionManager::ConnectionManager(
ApplicationConnection* app_connection,
DisplayManagerDelegate* display_manager_delegate,
const Callback<void()>& native_viewport_closed_callback)
@@ -47,11 +47,11 @@ RootNodeManager::RootNodeManager(
this,
display_manager_delegate,
native_viewport_closed_callback),
- root_(new Node(this, RootNodeId())),
+ root_(new ServerView(this, RootViewId())),
current_change_(NULL) {
}
-RootNodeManager::~RootNodeManager() {
+ConnectionManager::~ConnectionManager() {
while (!connections_created_by_connect_.empty())
delete *(connections_created_by_connect_.begin());
// All the connections should have been destroyed.
@@ -59,33 +59,36 @@ RootNodeManager::~RootNodeManager() {
root_.reset();
}
-ConnectionSpecificId RootNodeManager::GetAndAdvanceNextConnectionId() {
+ConnectionSpecificId ConnectionManager::GetAndAdvanceNextConnectionId() {
const ConnectionSpecificId id = next_connection_id_++;
DCHECK_LT(id, next_connection_id_);
return id;
}
-void RootNodeManager::AddConnection(ViewManagerServiceImpl* connection) {
+void ConnectionManager::AddConnection(ViewManagerServiceImpl* connection) {
DCHECK_EQ(0u, connection_map_.count(connection->id()));
connection_map_[connection->id()] = connection;
}
-void RootNodeManager::RemoveConnection(ViewManagerServiceImpl* connection) {
+void ConnectionManager::RemoveConnection(ViewManagerServiceImpl* connection) {
connection_map_.erase(connection->id());
connections_created_by_connect_.erase(connection);
// Notify remaining connections so that they can cleanup.
for (ConnectionMap::const_iterator i = connection_map_.begin();
- i != connection_map_.end(); ++i) {
+ i != connection_map_.end();
+ ++i) {
i->second->OnViewManagerServiceImplDestroyed(connection->id());
}
}
-void RootNodeManager::EmbedRoot(
+void ConnectionManager::EmbedRoot(
const std::string& url,
InterfaceRequest<ServiceProvider> service_provider) {
if (connection_map_.empty()) {
- EmbedImpl(kInvalidConnectionId, String::From(url), RootNodeId(),
+ EmbedImpl(kInvalidConnectionId,
+ String::From(url),
+ RootViewId(),
service_provider.Pass());
return;
}
@@ -93,62 +96,64 @@ void RootNodeManager::EmbedRoot(
connection->client()->Embed(url, service_provider.Pass());
}
-void RootNodeManager::Embed(
+void ConnectionManager::Embed(
ConnectionSpecificId creator_id,
const String& url,
- Id transport_node_id,
+ Id transport_view_id,
InterfaceRequest<ServiceProvider> service_provider) {
EmbedImpl(creator_id,
url,
- NodeIdFromTransportId(transport_node_id),
+ ViewIdFromTransportId(transport_view_id),
service_provider.Pass())->set_delete_on_connection_error();
}
-ViewManagerServiceImpl* RootNodeManager::GetConnection(
+ViewManagerServiceImpl* ConnectionManager::GetConnection(
ConnectionSpecificId connection_id) {
ConnectionMap::iterator i = connection_map_.find(connection_id);
return i == connection_map_.end() ? NULL : i->second;
}
-Node* RootNodeManager::GetNode(const NodeId& id) {
+ServerView* ConnectionManager::GetView(const ViewId& id) {
if (id == root_->id())
return root_.get();
ConnectionMap::iterator i = connection_map_.find(id.connection_id);
- return i == connection_map_.end() ? NULL : i->second->GetNode(id);
+ return i == connection_map_.end() ? NULL : i->second->GetView(id);
}
-void RootNodeManager::OnConnectionMessagedClient(ConnectionSpecificId id) {
+void ConnectionManager::OnConnectionMessagedClient(ConnectionSpecificId id) {
if (current_change_)
current_change_->MarkConnectionAsMessaged(id);
}
-bool RootNodeManager::DidConnectionMessageClient(
+bool ConnectionManager::DidConnectionMessageClient(
ConnectionSpecificId id) const {
return current_change_ && current_change_->DidMessageConnection(id);
}
-ViewManagerServiceImpl* RootNodeManager::GetConnectionByCreator(
+ViewManagerServiceImpl* ConnectionManager::GetConnectionByCreator(
ConnectionSpecificId creator_id,
const std::string& url) const {
for (ConnectionMap::const_iterator i = connection_map_.begin();
- i != connection_map_.end(); ++i) {
+ i != connection_map_.end();
+ ++i) {
if (i->second->creator_id() == creator_id && i->second->url() == url)
return i->second;
}
return NULL;
}
-const ViewManagerServiceImpl* RootNodeManager::GetConnectionWithRoot(
- const NodeId& id) const {
+const ViewManagerServiceImpl* ConnectionManager::GetConnectionWithRoot(
+ const ViewId& id) const {
for (ConnectionMap::const_iterator i = connection_map_.begin();
- i != connection_map_.end(); ++i) {
+ i != connection_map_.end();
+ ++i) {
if (i->second->HasRoot(id))
return i->second;
}
return NULL;
}
-void RootNodeManager::DispatchNodeInputEventToWindowManager(EventPtr event) {
+void ConnectionManager::DispatchViewInputEventToWindowManager(EventPtr event) {
// Input events are forwarded to the WindowManager. The WindowManager
// eventually calls back to us with DispatchOnViewInputEvent().
ViewManagerServiceImpl* connection = GetConnection(kWindowManagerConnection);
@@ -157,67 +162,71 @@ void RootNodeManager::DispatchNodeInputEventToWindowManager(EventPtr event) {
connection->client()->DispatchOnViewInputEvent(event.Pass());
}
-void RootNodeManager::ProcessNodeBoundsChanged(const Node* node,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
+void ConnectionManager::ProcessViewBoundsChanged(const ServerView* view,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) {
for (ConnectionMap::iterator i = connection_map_.begin();
- i != connection_map_.end(); ++i) {
- i->second->ProcessNodeBoundsChanged(node, old_bounds, new_bounds,
- IsChangeSource(i->first));
+ i != connection_map_.end();
+ ++i) {
+ i->second->ProcessViewBoundsChanged(
+ view, old_bounds, new_bounds, IsChangeSource(i->first));
}
}
-void RootNodeManager::ProcessNodeHierarchyChanged(const Node* node,
- const Node* new_parent,
- const Node* old_parent) {
+void ConnectionManager::ProcessViewHierarchyChanged(
+ const ServerView* view,
+ const ServerView* new_parent,
+ const ServerView* old_parent) {
for (ConnectionMap::iterator i = connection_map_.begin();
- i != connection_map_.end(); ++i) {
- i->second->ProcessNodeHierarchyChanged(
- node, new_parent, old_parent, IsChangeSource(i->first));
+ i != connection_map_.end();
+ ++i) {
+ i->second->ProcessViewHierarchyChanged(
+ view, new_parent, old_parent, IsChangeSource(i->first));
}
}
-void RootNodeManager::ProcessNodeReorder(const Node* node,
- const Node* relative_node,
- const OrderDirection direction) {
+void ConnectionManager::ProcessViewReorder(const ServerView* view,
+ const ServerView* relative_view,
+ const OrderDirection direction) {
for (ConnectionMap::iterator i = connection_map_.begin();
- i != connection_map_.end(); ++i) {
- i->second->ProcessNodeReorder(
- node, relative_node, direction, IsChangeSource(i->first));
+ i != connection_map_.end();
+ ++i) {
+ i->second->ProcessViewReorder(
+ view, relative_view, direction, IsChangeSource(i->first));
}
}
-void RootNodeManager::ProcessNodeDeleted(const NodeId& node) {
+void ConnectionManager::ProcessViewDeleted(const ViewId& view) {
for (ConnectionMap::iterator i = connection_map_.begin();
- i != connection_map_.end(); ++i) {
- i->second->ProcessNodeDeleted(node, IsChangeSource(i->first));
+ i != connection_map_.end();
+ ++i) {
+ i->second->ProcessViewDeleted(view, IsChangeSource(i->first));
}
}
-void RootNodeManager::PrepareForChange(ScopedChange* change) {
+void ConnectionManager::PrepareForChange(ScopedChange* change) {
// Should only ever have one change in flight.
CHECK(!current_change_);
current_change_ = change;
}
-void RootNodeManager::FinishChange() {
+void ConnectionManager::FinishChange() {
// PrepareForChange/FinishChange should be balanced.
CHECK(current_change_);
current_change_ = NULL;
}
-ViewManagerServiceImpl* RootNodeManager::EmbedImpl(
+ViewManagerServiceImpl* ConnectionManager::EmbedImpl(
const ConnectionSpecificId creator_id,
const String& url,
- const NodeId& root_id,
+ const ViewId& root_id,
InterfaceRequest<ServiceProvider> service_provider) {
MessagePipe pipe;
ServiceProvider* view_manager_service_provider =
app_connection_->ConnectToApplication(url)->GetServiceProvider();
view_manager_service_provider->ConnectToService(
- ViewManagerServiceImpl::Client::Name_,
- pipe.handle1.Pass());
+ ViewManagerServiceImpl::Client::Name_, pipe.handle1.Pass());
std::string creator_url;
ConnectionMap::const_iterator it = connection_map_.find(creator_id);
@@ -237,31 +246,31 @@ ViewManagerServiceImpl* RootNodeManager::EmbedImpl(
return connection;
}
-void RootNodeManager::OnNodeDestroyed(const Node* node) {
- ProcessNodeDeleted(node->id());
+void ConnectionManager::OnViewDestroyed(const ServerView* view) {
+ ProcessViewDeleted(view->id());
}
-void RootNodeManager::OnNodeHierarchyChanged(const Node* node,
- const Node* new_parent,
- const Node* old_parent) {
+void ConnectionManager::OnViewHierarchyChanged(const ServerView* view,
+ const ServerView* new_parent,
+ const ServerView* old_parent) {
if (!display_manager_.in_setup())
- ProcessNodeHierarchyChanged(node, new_parent, old_parent);
+ ProcessViewHierarchyChanged(view, new_parent, old_parent);
}
-void RootNodeManager::OnNodeBoundsChanged(const Node* node,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
- ProcessNodeBoundsChanged(node, old_bounds, new_bounds);
- if (!node->parent())
+void ConnectionManager::OnViewBoundsChanged(const ServerView* view,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) {
+ ProcessViewBoundsChanged(view, old_bounds, new_bounds);
+ if (!view->parent())
return;
// TODO(sky): optimize this.
- display_manager_.SchedulePaint(node->parent(), old_bounds);
- display_manager_.SchedulePaint(node->parent(), new_bounds);
+ display_manager_.SchedulePaint(view->parent(), old_bounds);
+ display_manager_.SchedulePaint(view->parent(), new_bounds);
}
-void RootNodeManager::OnNodeBitmapChanged(const Node* node) {
- display_manager_.SchedulePaint(node, gfx::Rect(node->bounds().size()));
+void ConnectionManager::OnViewBitmapChanged(const ServerView* view) {
+ display_manager_.SchedulePaint(view, gfx::Rect(view->bounds().size()));
}
} // namespace service
« no previous file with comments | « mojo/services/view_manager/connection_manager.h ('k') | mojo/services/view_manager/default_access_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698