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

Side by Side Diff: mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix network_service_loader 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/public/cpp/view_manager/lib/view_manager_client_impl.h" 5 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "mojo/public/cpp/application/application_connection.h" 9 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/public/cpp/application/connect.h" 10 #include "mojo/public/cpp/application/connect.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 virtual void DoActionCompleted(bool success) OVERRIDE { 516 virtual void DoActionCompleted(bool success) OVERRIDE {
517 // TODO(beng): recovery? 517 // TODO(beng): recovery?
518 } 518 }
519 519
520 const Id node_id_; 520 const Id node_id_;
521 const bool visible_; 521 const bool visible_;
522 522
523 DISALLOW_COPY_AND_ASSIGN(SetVisibleTransaction); 523 DISALLOW_COPY_AND_ASSIGN(SetVisibleTransaction);
524 }; 524 };
525 525
526 ViewManagerClientImpl::ViewManagerClientImpl(ApplicationConnection* connection, 526 ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate)
527 ViewManagerDelegate* delegate)
528 : connected_(false), 527 : connected_(false),
529 connection_id_(0), 528 connection_id_(0),
530 next_id_(1), 529 next_id_(1),
531 delegate_(delegate), 530 delegate_(delegate),
532 window_manager_delegate_(NULL) {} 531 window_manager_delegate_(NULL) {
532 }
533 533
534 ViewManagerClientImpl::~ViewManagerClientImpl() { 534 ViewManagerClientImpl::~ViewManagerClientImpl() {
535 while (!nodes_.empty()) { 535 while (!nodes_.empty()) {
536 IdToNodeMap::iterator it = nodes_.begin(); 536 IdToNodeMap::iterator it = nodes_.begin();
537 if (OwnsNode(it->second->id())) 537 if (OwnsNode(it->second->id()))
538 it->second->Destroy(); 538 it->second->Destroy();
539 else 539 else
540 nodes_.erase(it); 540 nodes_.erase(it);
541 } 541 }
542 while (!views_.empty()) { 542 while (!views_.empty()) {
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 delegate_->OnRootAdded(this, root); 870 delegate_->OnRootAdded(this, root);
871 } 871 }
872 872
873 void ViewManagerClientImpl::RemoveRoot(Node* root) { 873 void ViewManagerClientImpl::RemoveRoot(Node* root) {
874 std::vector<Node*>::iterator it = 874 std::vector<Node*>::iterator it =
875 std::find(roots_.begin(), roots_.end(), root); 875 std::find(roots_.begin(), roots_.end(), root);
876 if (it != roots_.end()) 876 if (it != roots_.end())
877 roots_.erase(it); 877 roots_.erase(it);
878 } 878 }
879 879
880 ////////////////////////////////////////////////////////////////////////////////
881 // ViewManager, public:
882
883 // static
884 void ViewManager::ConfigureIncomingConnection(
885 ApplicationConnection* connection,
886 ViewManagerDelegate* delegate) {
887 connection->AddService<ViewManagerClientImpl>(delegate);
888 }
889
890 } // namespace view_manager 880 } // namespace view_manager
891 } // namespace mojo 881 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698