OLD | NEW |
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/application_manager.h" | 5 #include "mojo/shell/application_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 base::Passed(services.Pass()), base::Passed(exposed_services.Pass()), | 127 base::Passed(services.Pass()), base::Passed(exposed_services.Pass()), |
128 filter, on_application_end); | 128 filter, on_application_end); |
129 | 129 |
130 if (delegate_->CreateFetcher( | 130 if (delegate_->CreateFetcher( |
131 resolved_url, | 131 resolved_url, |
132 base::Bind(callback, NativeApplicationCleanup::DONT_DELETE))) { | 132 base::Bind(callback, NativeApplicationCleanup::DONT_DELETE))) { |
133 return; | 133 return; |
134 } | 134 } |
135 | 135 |
136 if (resolved_url.SchemeIsFile()) { | 136 if (resolved_url.SchemeIsFile()) { |
| 137 // LocalFetcher uses the network service to infer MIME types from URLs. |
| 138 // Skip this for mojo URLs to avoid recursively loading the network service. |
| 139 if (!network_service_ && !requested_gurl.SchemeIs("mojo")) |
| 140 ConnectToService(GURL("mojo:network_service"), &network_service_); |
137 new LocalFetcher( | 141 new LocalFetcher( |
138 resolved_url, GetBaseURLAndQuery(resolved_url, nullptr), | 142 network_service_.get(), resolved_url, |
| 143 GetBaseURLAndQuery(resolved_url, nullptr), |
139 base::Bind(callback, NativeApplicationCleanup::DONT_DELETE)); | 144 base::Bind(callback, NativeApplicationCleanup::DONT_DELETE)); |
140 return; | 145 return; |
141 } | 146 } |
142 | 147 |
143 if (mapped_url.SchemeIs("mojo") && | 148 if (mapped_url.SchemeIs("mojo") && |
144 base::CommandLine::ForCurrentProcess()->HasSwitch( | 149 base::CommandLine::ForCurrentProcess()->HasSwitch( |
145 switches::kUseUpdater)) { | 150 switches::kUseUpdater)) { |
146 ConnectToService(GURL("mojo:updater"), &updater_); | 151 ConnectToService(GURL("mojo:updater"), &updater_); |
147 new UpdateFetcher( | 152 new UpdateFetcher( |
148 mapped_url, updater_.get(), | 153 mapped_url, updater_.get(), |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 ConnectToApplication(nullptr, request.Pass(), std::string(), GURL(), | 541 ConnectToApplication(nullptr, request.Pass(), std::string(), GURL(), |
537 GetProxy(&services), nullptr, | 542 GetProxy(&services), nullptr, |
538 GetPermissiveCapabilityFilter(), base::Closure()); | 543 GetPermissiveCapabilityFilter(), base::Closure()); |
539 MessagePipe pipe; | 544 MessagePipe pipe; |
540 services->ConnectToService(interface_name, pipe.handle1.Pass()); | 545 services->ConnectToService(interface_name, pipe.handle1.Pass()); |
541 return pipe.handle0.Pass(); | 546 return pipe.handle0.Pass(); |
542 } | 547 } |
543 | 548 |
544 } // namespace shell | 549 } // namespace shell |
545 } // namespace mojo | 550 } // namespace mojo |
OLD | NEW |