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

Side by Side Diff: mojo/package_manager/package_manager_impl.cc

Issue 1538823002: Convert Pass()→std::move() in mojo/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/package_manager/package_manager_impl.h" 5 #include "mojo/package_manager/package_manager_impl.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "mojo/application/public/interfaces/content_handler.mojom.h" 10 #include "mojo/application/public/interfaces/content_handler.mojom.h"
9 #include "mojo/fetcher/about_fetcher.h" 11 #include "mojo/fetcher/about_fetcher.h"
10 #include "mojo/fetcher/data_fetcher.h" 12 #include "mojo/fetcher/data_fetcher.h"
11 #include "mojo/fetcher/local_fetcher.h" 13 #include "mojo/fetcher/local_fetcher.h"
12 #include "mojo/fetcher/network_fetcher.h" 14 #include "mojo/fetcher/network_fetcher.h"
13 #include "mojo/fetcher/switches.h" 15 #include "mojo/fetcher/switches.h"
14 #include "mojo/fetcher/update_fetcher.h" 16 #include "mojo/fetcher/update_fetcher.h"
15 #include "mojo/package_manager/content_handler_connection.h" 17 #include "mojo/package_manager/content_handler_connection.h"
16 #include "mojo/shell/application_manager.h" 18 #include "mojo/shell/application_manager.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 117 }
116 #endif 118 #endif
117 119
118 if (!url_loader_factory_) { 120 if (!url_loader_factory_) {
119 shell::ConnectToService(application_manager_, GURL("mojo:network_service"), 121 shell::ConnectToService(application_manager_, GURL("mojo:network_service"),
120 &url_loader_factory_); 122 &url_loader_factory_);
121 } 123 }
122 124
123 // Ownership of this object is transferred to |loader_callback|. 125 // Ownership of this object is transferred to |loader_callback|.
124 // TODO(beng): this is eff'n weird. 126 // TODO(beng): this is eff'n weird.
125 new fetcher::NetworkFetcher(disable_cache_, request.Pass(), 127 new fetcher::NetworkFetcher(disable_cache_, std::move(request),
126 url_loader_factory_.get(), loader_callback); 128 url_loader_factory_.get(), loader_callback);
127 } 129 }
128 130
129 uint32_t PackageManagerImpl::HandleWithContentHandler( 131 uint32_t PackageManagerImpl::HandleWithContentHandler(
130 shell::Fetcher* fetcher, 132 shell::Fetcher* fetcher,
131 const shell::Identity& source, 133 const shell::Identity& source,
132 const GURL& target_url, 134 const GURL& target_url,
133 const shell::CapabilityFilter& target_filter, 135 const shell::CapabilityFilter& target_filter,
134 InterfaceRequest<Application>* application_request) { 136 InterfaceRequest<Application>* application_request) {
135 shell::Identity content_handler_identity; 137 shell::Identity content_handler_identity;
136 URLResponsePtr response; 138 URLResponsePtr response;
137 if (ShouldHandleWithContentHandler(fetcher, 139 if (ShouldHandleWithContentHandler(fetcher,
138 target_url, 140 target_url,
139 target_filter, 141 target_filter,
140 &content_handler_identity, 142 &content_handler_identity,
141 &response)) { 143 &response)) {
142 ContentHandlerConnection* connection = 144 ContentHandlerConnection* connection =
143 GetContentHandler(content_handler_identity, source); 145 GetContentHandler(content_handler_identity, source);
144 connection->StartApplication(application_request->Pass(), response.Pass()); 146 connection->StartApplication(std::move(*application_request),
147 std::move(response));
145 return connection->id(); 148 return connection->id();
146 } 149 }
147 return Shell::kInvalidContentHandlerID; 150 return Shell::kInvalidContentHandlerID;
148 } 151 }
149 152
150 GURL PackageManagerImpl::ResolveURL(const GURL& url) { 153 GURL PackageManagerImpl::ResolveURL(const GURL& url) {
151 return url_resolver_.get() ? url_resolver_->ResolveMojoURL(url) : url; 154 return url_resolver_.get() ? url_resolver_->ResolveMojoURL(url) : url;
152 } 155 }
153 156
154 bool PackageManagerImpl::ShouldHandleWithContentHandler( 157 bool PackageManagerImpl::ShouldHandleWithContentHandler(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 void PackageManagerImpl::OnContentHandlerConnectionClosed( 236 void PackageManagerImpl::OnContentHandlerConnectionClosed(
234 ContentHandlerConnection* connection) { 237 ContentHandlerConnection* connection) {
235 // Remove the mapping. 238 // Remove the mapping.
236 auto it = identity_to_content_handler_.find(connection->identity()); 239 auto it = identity_to_content_handler_.find(connection->identity());
237 DCHECK(it != identity_to_content_handler_.end()); 240 DCHECK(it != identity_to_content_handler_.end());
238 identity_to_content_handler_.erase(it); 241 identity_to_content_handler_.erase(it);
239 } 242 }
240 243
241 } // namespace package_manager 244 } // namespace package_manager
242 } // namespace mojo 245 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/package_manager/content_handler_unittest.cc ('k') | mojo/platform_handle/platform_handle_functions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698