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

Side by Side Diff: mojo/shell/public/cpp/lib/connection_impl.cc

Issue 1705323003: ContentHandler -> ShellClientFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delete
Patch Set: . Created 4 years, 10 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
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/shell/public/cpp/lib/connection_impl.h" 5 #include "mojo/shell/public/cpp/lib/connection_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 11 matching lines...) Expand all
22 ConnectionImpl::ConnectionImpl( 22 ConnectionImpl::ConnectionImpl(
23 const std::string& connection_url, 23 const std::string& connection_url,
24 const std::string& remote_url, 24 const std::string& remote_url,
25 uint32_t remote_id, 25 uint32_t remote_id,
26 shell::mojom::InterfaceProviderPtr remote_interfaces, 26 shell::mojom::InterfaceProviderPtr remote_interfaces,
27 shell::mojom::InterfaceProviderRequest local_interfaces, 27 shell::mojom::InterfaceProviderRequest local_interfaces,
28 const std::set<std::string>& allowed_interfaces) 28 const std::set<std::string>& allowed_interfaces)
29 : connection_url_(connection_url), 29 : connection_url_(connection_url),
30 remote_url_(remote_url), 30 remote_url_(remote_url),
31 remote_id_(remote_id), 31 remote_id_(remote_id),
32 content_handler_id_(0u), 32 shell_client_factory_id_(0u),
33 remote_ids_valid_(false), 33 remote_ids_valid_(false),
34 local_registry_(std::move(local_interfaces), this), 34 local_registry_(std::move(local_interfaces), this),
35 remote_interfaces_(std::move(remote_interfaces)), 35 remote_interfaces_(std::move(remote_interfaces)),
36 allowed_interfaces_(allowed_interfaces), 36 allowed_interfaces_(allowed_interfaces),
37 allow_all_interfaces_(allowed_interfaces_.size() == 1 && 37 allow_all_interfaces_(allowed_interfaces_.size() == 1 &&
38 allowed_interfaces_.count("*") == 1), 38 allowed_interfaces_.count("*") == 1),
39 weak_factory_(this) {} 39 weak_factory_(this) {}
40 40
41 ConnectionImpl::ConnectionImpl() 41 ConnectionImpl::ConnectionImpl()
42 : remote_id_(shell::mojom::Shell::kInvalidApplicationID), 42 : remote_id_(shell::mojom::Shell::kInvalidApplicationID),
43 content_handler_id_(shell::mojom::Shell::kInvalidApplicationID), 43 shell_client_factory_id_(shell::mojom::Shell::kInvalidApplicationID),
44 remote_ids_valid_(false), 44 remote_ids_valid_(false),
45 local_registry_(shell::mojom::InterfaceProviderRequest(), this), 45 local_registry_(shell::mojom::InterfaceProviderRequest(), this),
46 allow_all_interfaces_(true), 46 allow_all_interfaces_(true),
47 weak_factory_(this) {} 47 weak_factory_(this) {}
48 48
49 ConnectionImpl::~ConnectionImpl() {} 49 ConnectionImpl::~ConnectionImpl() {}
50 50
51 shell::mojom::Shell::ConnectToApplicationCallback 51 shell::mojom::Shell::ConnectToApplicationCallback
52 ConnectionImpl::GetConnectToApplicationCallback() { 52 ConnectionImpl::GetConnectToApplicationCallback() {
53 return base::Bind(&ConnectionImpl::OnGotRemoteIDs, 53 return base::Bind(&ConnectionImpl::OnGotRemoteIDs,
(...skipping 17 matching lines...) Expand all
71 } 71 }
72 72
73 bool ConnectionImpl::GetRemoteApplicationID(uint32_t* remote_id) const { 73 bool ConnectionImpl::GetRemoteApplicationID(uint32_t* remote_id) const {
74 if (!remote_ids_valid_) 74 if (!remote_ids_valid_)
75 return false; 75 return false;
76 76
77 *remote_id = remote_id_; 77 *remote_id = remote_id_;
78 return true; 78 return true;
79 } 79 }
80 80
81 bool ConnectionImpl::GetRemoteContentHandlerID( 81 bool ConnectionImpl::GetRemoteShellClientFactoryID(
82 uint32_t* content_handler_id) const { 82 uint32_t* shell_client_factory_id) const {
83 if (!remote_ids_valid_) 83 if (!remote_ids_valid_)
84 return false; 84 return false;
85 85
86 *content_handler_id = content_handler_id_; 86 *shell_client_factory_id = shell_client_factory_id_;
87 return true; 87 return true;
88 } 88 }
89 89
90 void ConnectionImpl::AddRemoteIDCallback(const Closure& callback) { 90 void ConnectionImpl::AddRemoteIDCallback(const Closure& callback) {
91 if (remote_ids_valid_) { 91 if (remote_ids_valid_) {
92 callback.Run(); 92 callback.Run();
93 return; 93 return;
94 } 94 }
95 remote_id_callbacks_.push_back(callback); 95 remote_id_callbacks_.push_back(callback);
96 } 96 }
(...skipping 11 matching lines...) Expand all
108 } 108 }
109 109
110 base::WeakPtr<Connection> ConnectionImpl::GetWeakPtr() { 110 base::WeakPtr<Connection> ConnectionImpl::GetWeakPtr() {
111 return weak_factory_.GetWeakPtr(); 111 return weak_factory_.GetWeakPtr();
112 } 112 }
113 113
114 //////////////////////////////////////////////////////////////////////////////// 114 ////////////////////////////////////////////////////////////////////////////////
115 // ConnectionImpl, private: 115 // ConnectionImpl, private:
116 116
117 void ConnectionImpl::OnGotRemoteIDs(uint32_t target_application_id, 117 void ConnectionImpl::OnGotRemoteIDs(uint32_t target_application_id,
118 uint32_t content_handler_id) { 118 uint32_t shell_client_factory_id) {
119 DCHECK(!remote_ids_valid_); 119 DCHECK(!remote_ids_valid_);
120 remote_ids_valid_ = true; 120 remote_ids_valid_ = true;
121 121
122 remote_id_ = target_application_id; 122 remote_id_ = target_application_id;
123 content_handler_id_ = content_handler_id; 123 shell_client_factory_id_ = shell_client_factory_id;
124 std::vector<Closure> callbacks; 124 std::vector<Closure> callbacks;
125 callbacks.swap(remote_id_callbacks_); 125 callbacks.swap(remote_id_callbacks_);
126 for (auto callback : callbacks) 126 for (auto callback : callbacks)
127 callback.Run(); 127 callback.Run();
128 } 128 }
129 129
130 } // namespace internal 130 } // namespace internal
131 } // namespace mojo 131 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/lib/connection_impl.h ('k') | mojo/shell/public/cpp/lib/content_handler_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698