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

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

Issue 405523002: Add ability APIs for opening a window with a url embedded, focusing and activating a window. (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/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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 ViewManagerClientImpl::ViewManagerClientImpl(ApplicationConnection* connection, 540 ViewManagerClientImpl::ViewManagerClientImpl(ApplicationConnection* connection,
541 ViewManagerDelegate* delegate) 541 ViewManagerDelegate* delegate)
542 : connected_(false), 542 : connected_(false),
543 connection_id_(0), 543 connection_id_(0),
544 next_id_(1), 544 next_id_(1),
545 next_server_change_id_(0), 545 next_server_change_id_(0),
546 delegate_(delegate), 546 delegate_(delegate),
547 dispatcher_(NULL) {} 547 dispatcher_(NULL) {}
548 548
549 ViewManagerClientImpl::~ViewManagerClientImpl() { 549 ViewManagerClientImpl::~ViewManagerClientImpl() {
550 delegate_->OnViewManagerDisconnected(this);
551 while (!nodes_.empty()) { 550 while (!nodes_.empty()) {
552 IdToNodeMap::iterator it = nodes_.begin(); 551 IdToNodeMap::iterator it = nodes_.begin();
553 if (OwnsNode(it->second->id())) 552 if (OwnsNode(it->second->id()))
554 it->second->Destroy(); 553 it->second->Destroy();
555 else 554 else
556 nodes_.erase(it); 555 nodes_.erase(it);
557 } 556 }
558 while (!views_.empty()) { 557 while (!views_.empty()) {
559 IdToViewMap::iterator it = views_.begin(); 558 IdToViewMap::iterator it = views_.begin();
560 if (OwnsView(it->second->id())) 559 if (OwnsView(it->second->id()))
561 it->second->Destroy(); 560 it->second->Destroy();
562 else 561 else
563 views_.erase(it); 562 views_.erase(it);
564 } 563 }
564 delegate_->OnViewManagerDisconnected(this);
565 } 565 }
566 566
567 Id ViewManagerClientImpl::CreateNode() { 567 Id ViewManagerClientImpl::CreateNode() {
568 DCHECK(connected_); 568 DCHECK(connected_);
569 const Id node_id(MakeTransportId(connection_id_, ++next_id_)); 569 const Id node_id(MakeTransportId(connection_id_, ++next_id_));
570 pending_transactions_.push_back(new CreateNodeTransaction(node_id, this)); 570 pending_transactions_.push_back(new CreateNodeTransaction(node_id, this));
571 Sync(); 571 Sync();
572 return node_id; 572 return node_id;
573 } 573 }
574 574
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 909
910 // static 910 // static
911 void ViewManager::ConfigureIncomingConnection( 911 void ViewManager::ConfigureIncomingConnection(
912 ApplicationConnection* connection, 912 ApplicationConnection* connection,
913 ViewManagerDelegate* delegate) { 913 ViewManagerDelegate* delegate) {
914 connection->AddService<ViewManagerClientImpl>(delegate); 914 connection->AddService<ViewManagerClientImpl>(delegate);
915 } 915 }
916 916
917 } // namespace view_manager 917 } // namespace view_manager
918 } // namespace mojo 918 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698