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

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

Issue 308803002: Change type of interface created by mojo:view_manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/services/view_manager/view_manager_init_connection.h"
6
7 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
8 #include "mojo/services/view_manager/ids.h"
9 #include "mojo/services/view_manager/view_manager_connection.h"
10
11 namespace mojo {
12 namespace view_manager {
13 namespace service {
14
15 ViewManagerInitConnection::ConnectParams::ConnectParams() {}
16
17 ViewManagerInitConnection::ConnectParams::~ConnectParams() {}
18
19 ViewManagerInitConnection::ViewManagerInitConnection(
20 ServiceProvider* service_provider)
21 : service_provider_(service_provider),
22 root_node_manager_(service_provider, this),
23 is_tree_host_ready_(false) {
24 }
25
26 ViewManagerInitConnection::~ViewManagerInitConnection() {
27 }
28
29 void ViewManagerInitConnection::MaybeConnect(
30 const std::string& url,
31 const Callback<void(bool)>& callback) {
32 if (!is_tree_host_ready_)
33 return;
34
35 root_node_manager_.InitialConnect(url);
36 callback.Run(true);
37 }
38
39 void ViewManagerInitConnection::Connect(const String& url,
40 const Callback<void(bool)>& callback) {
41 if (connect_params_.get()) {
42 DVLOG(1) << "Ignoring second connect";
43 callback.Run(false);
44 return;
45 }
46 connect_params_.reset(new ConnectParams);
47 connect_params_->url = url.To<std::string>();
48 connect_params_->callback = callback;
49 MaybeConnect(url.To<std::string>(), callback);
50 }
51
52 void ViewManagerInitConnection::OnRootViewManagerWindowTreeHostCreated() {
53 DCHECK(!is_tree_host_ready_);
54 is_tree_host_ready_ = true;
55 if (connect_params_.get())
56 MaybeConnect(connect_params_->url, connect_params_->callback);
57 }
58
59 } // namespace service
60 } // namespace view_manager
61 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/view_manager/view_manager_init_connection.h ('k') | mojo/shell/view_manager_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698