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

Side by Side Diff: mojo/shell/dbus_service_loader_linux.cc

Issue 423963004: First cut at "content handling" support in Mojo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blech Created 6 years, 4 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/shell/dbus_service_loader_linux.h" 5 #include "mojo/shell/dbus_service_loader_linux.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 dbus::Bus::Options options; 143 dbus::Bus::Options options;
144 options.bus_type = dbus::Bus::SESSION; 144 options.bus_type = dbus::Bus::SESSION;
145 options.dbus_task_runner = context_->task_runners()->io_runner(); 145 options.dbus_task_runner = context_->task_runners()->io_runner();
146 bus_ = new dbus::Bus(options); 146 bus_ = new dbus::Bus(options);
147 } 147 }
148 148
149 DBusServiceLoader::~DBusServiceLoader() { 149 DBusServiceLoader::~DBusServiceLoader() {
150 DCHECK(url_to_load_context_.empty()); 150 DCHECK(url_to_load_context_.empty());
151 } 151 }
152 152
153 void DBusServiceLoader::LoadService(ServiceManager* manager, 153 void DBusServiceLoader::LoadService(
154 const GURL& url, 154 ServiceManager* manager,
155 ScopedMessagePipeHandle shell_handle) { 155 const GURL& url,
156 scoped_refptr<LoadServiceCallbacks> callbacks) {
157 // TODO(aa): This could be delayed until later, when we know that loading is
158 // going to succeed.
159 ScopedMessagePipeHandle shell_handle = callbacks->RegisterApplication();
160 if (!shell_handle.is_valid()) {
DaveMoore 2014/08/06 20:50:46 Nit: no braces
Aaron Boodman 2014/08/06 22:49:29 Done.
161 return;
162 }
163
156 DCHECK(url.SchemeIs("dbus")); 164 DCHECK(url.SchemeIs("dbus"));
157 DCHECK(url_to_load_context_.find(url) == url_to_load_context_.end()); 165 DCHECK(url_to_load_context_.find(url) == url_to_load_context_.end());
158 url_to_load_context_[url] = 166 url_to_load_context_[url] =
159 new LoadContext(this, bus_, url, shell_handle.Pass()); 167 new LoadContext(this, bus_, url, shell_handle.Pass());
160 } 168 }
161 169
162 void DBusServiceLoader::OnServiceError(ServiceManager* manager, 170 void DBusServiceLoader::OnServiceError(ServiceManager* manager,
163 const GURL& url) { 171 const GURL& url) {
164 // TODO(cmasone): Anything at all in this method here. 172 // TODO(cmasone): Anything at all in this method here.
165 } 173 }
166 174
167 void DBusServiceLoader::ForgetService(const GURL& url) { 175 void DBusServiceLoader::ForgetService(const GURL& url) {
168 DCHECK(context_->task_runners()->shell_runner()->BelongsToCurrentThread()); 176 DCHECK(context_->task_runners()->shell_runner()->BelongsToCurrentThread());
169 DVLOG(2) << "Forgetting service (url: " << url << ")"; 177 DVLOG(2) << "Forgetting service (url: " << url << ")";
170 178
171 LoadContextMap::iterator it = url_to_load_context_.find(url); 179 LoadContextMap::iterator it = url_to_load_context_.find(url);
172 DCHECK(it != url_to_load_context_.end()) << url; 180 DCHECK(it != url_to_load_context_.end()) << url;
173 181
174 LoadContext* doomed = it->second; 182 LoadContext* doomed = it->second;
175 url_to_load_context_.erase(it); 183 url_to_load_context_.erase(it);
176 184
177 delete doomed; 185 delete doomed;
178 } 186 }
179 187
180 } // namespace shell 188 } // namespace shell
181 } // namespace mojo 189 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698