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

Side by Side Diff: mojo/services/view_manager/view_manager_service_impl.cc

Issue 405163002: Add EmbedRoot to ViewManagerService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/services/view_manager/view_manager_service_impl.h" 5 #include "mojo/services/view_manager/view_manager_service_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" 8 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
9 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" 9 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h"
10 #include "mojo/services/view_manager/node.h" 10 #include "mojo/services/view_manager/node.h"
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 DCHECK(node); 719 DCHECK(node);
720 node->SetVisible(visible); 720 node->SetVisible(visible);
721 } 721 }
722 // TODO(sky): need to notify of visibility changes. 722 // TODO(sky): need to notify of visibility changes.
723 callback.Run(success); 723 callback.Run(success);
724 } 724 }
725 725
726 void ViewManagerServiceImpl::Embed(const String& url, 726 void ViewManagerServiceImpl::Embed(const String& url,
727 Id transport_node_id, 727 Id transport_node_id,
728 const Callback<void(bool)>& callback) { 728 const Callback<void(bool)>& callback) {
729 if (NodeIdFromTransportId(transport_node_id) == InvalidNodeId()) {
730 root_node_manager_->EmbedRoot(url);
731 callback.Run(true);
732 return;
733 }
729 bool success = CanEmbed(transport_node_id); 734 bool success = CanEmbed(transport_node_id);
730 if (success) { 735 if (success) {
731 // Only allow a node to be the root for one connection. 736 // Only allow a node to be the root for one connection.
732 const NodeId node_id(NodeIdFromTransportId(transport_node_id)); 737 const NodeId node_id(NodeIdFromTransportId(transport_node_id));
733 ViewManagerServiceImpl* connection_by_url = 738 ViewManagerServiceImpl* connection_by_url =
734 root_node_manager_->GetConnectionByCreator(id_, url.To<std::string>()); 739 root_node_manager_->GetConnectionByCreator(id_, url.To<std::string>());
735 ViewManagerServiceImpl* connection_with_node_as_root = 740 ViewManagerServiceImpl* connection_with_node_as_root =
736 root_node_manager_->GetConnectionWithRoot(node_id); 741 root_node_manager_->GetConnectionWithRoot(node_id);
737 if ((connection_by_url != connection_with_node_as_root || 742 if ((connection_by_url != connection_with_node_as_root ||
738 (!connection_by_url && !connection_with_node_as_root)) && 743 (!connection_by_url && !connection_with_node_as_root)) &&
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 789
785 client()->OnViewManagerConnectionEstablished( 790 client()->OnViewManagerConnectionEstablished(
786 id_, 791 id_,
787 creator_url_, 792 creator_url_,
788 NodesToNodeDatas(to_send)); 793 NodesToNodeDatas(to_send));
789 } 794 }
790 795
791 } // namespace service 796 } // namespace service
792 } // namespace view_manager 797 } // namespace view_manager
793 } // namespace mojo 798 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/view_manager/view_manager_service_impl.h ('k') | mojo/services/view_manager/view_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698