| OLD | NEW |
| 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 virtual void DoActionCompleted(bool success) OVERRIDE { | 531 virtual void DoActionCompleted(bool success) OVERRIDE { |
| 532 // TODO(beng): recovery? | 532 // TODO(beng): recovery? |
| 533 } | 533 } |
| 534 | 534 |
| 535 const Id node_id_; | 535 const Id node_id_; |
| 536 const bool visible_; | 536 const bool visible_; |
| 537 | 537 |
| 538 DISALLOW_COPY_AND_ASSIGN(SetVisibleTransaction); | 538 DISALLOW_COPY_AND_ASSIGN(SetVisibleTransaction); |
| 539 }; | 539 }; |
| 540 | 540 |
| 541 ViewManagerClientImpl::ViewManagerClientImpl(ApplicationConnection* connection, | 541 ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate) |
| 542 ViewManagerDelegate* delegate) | |
| 543 : connected_(false), | 542 : connected_(false), |
| 544 connection_id_(0), | 543 connection_id_(0), |
| 545 next_id_(1), | 544 next_id_(1), |
| 546 next_server_change_id_(0), | 545 next_server_change_id_(0), |
| 547 delegate_(delegate), | 546 delegate_(delegate), |
| 548 dispatcher_(NULL) {} | 547 dispatcher_(NULL) { |
| 548 } |
| 549 | 549 |
| 550 ViewManagerClientImpl::~ViewManagerClientImpl() { | 550 ViewManagerClientImpl::~ViewManagerClientImpl() { |
| 551 delegate_->OnViewManagerDisconnected(this); | 551 delegate_->OnViewManagerDisconnected(this); |
| 552 while (!nodes_.empty()) { | 552 while (!nodes_.empty()) { |
| 553 IdToNodeMap::iterator it = nodes_.begin(); | 553 IdToNodeMap::iterator it = nodes_.begin(); |
| 554 if (OwnsNode(it->second->id())) | 554 if (OwnsNode(it->second->id())) |
| 555 it->second->Destroy(); | 555 it->second->Destroy(); |
| 556 else | 556 else |
| 557 nodes_.erase(it); | 557 nodes_.erase(it); |
| 558 } | 558 } |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 delegate_->OnRootAdded(this, root); | 898 delegate_->OnRootAdded(this, root); |
| 899 } | 899 } |
| 900 | 900 |
| 901 void ViewManagerClientImpl::RemoveRoot(Node* root) { | 901 void ViewManagerClientImpl::RemoveRoot(Node* root) { |
| 902 std::vector<Node*>::iterator it = | 902 std::vector<Node*>::iterator it = |
| 903 std::find(roots_.begin(), roots_.end(), root); | 903 std::find(roots_.begin(), roots_.end(), root); |
| 904 if (it != roots_.end()) | 904 if (it != roots_.end()) |
| 905 roots_.erase(it); | 905 roots_.erase(it); |
| 906 } | 906 } |
| 907 | 907 |
| 908 //////////////////////////////////////////////////////////////////////////////// | |
| 909 // ViewManager, public: | |
| 910 | |
| 911 // static | |
| 912 void ViewManager::ConfigureIncomingConnection( | |
| 913 ApplicationConnection* connection, | |
| 914 ViewManagerDelegate* delegate) { | |
| 915 connection->AddService<ViewManagerClientImpl>(delegate); | |
| 916 } | |
| 917 | |
| 918 } // namespace view_manager | 908 } // namespace view_manager |
| 919 } // namespace mojo | 909 } // namespace mojo |
| OLD | NEW |