| 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/dynamic_service_loader.h" | 5 #include "mojo/shell/dynamic_service_loader.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | |
| 8 #include "base/location.h" | 7 #include "base/location.h" |
| 9 #include "mojo/shell/context.h" | 8 #include "mojo/shell/context.h" |
| 10 #include "mojo/shell/keep_alive.h" | 9 #include "mojo/shell/keep_alive.h" |
| 11 #include "mojo/shell/switches.h" | |
| 12 | 10 |
| 13 namespace mojo { | 11 namespace mojo { |
| 14 namespace shell { | 12 namespace shell { |
| 15 | 13 |
| 16 namespace { | 14 namespace { |
| 17 | 15 |
| 18 std::string MakeSharedLibraryName(const std::string& file_name) { | 16 std::string MakeSharedLibraryName(const std::string& file_name) { |
| 19 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 20 return file_name + ".dll"; | 18 return file_name + ".dll"; |
| 21 #elif defined(OS_LINUX) | 19 #elif defined(OS_LINUX) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 37 ScopedMessagePipeHandle service_handle, | 35 ScopedMessagePipeHandle service_handle, |
| 38 scoped_ptr<DynamicServiceRunner> runner) | 36 scoped_ptr<DynamicServiceRunner> runner) |
| 39 : loader_(loader), | 37 : loader_(loader), |
| 40 url_(url), | 38 url_(url), |
| 41 service_handle_(service_handle.Pass()), | 39 service_handle_(service_handle.Pass()), |
| 42 runner_(runner.Pass()), | 40 runner_(runner.Pass()), |
| 43 keep_alive_(loader->context_) { | 41 keep_alive_(loader->context_) { |
| 44 GURL url_to_load; | 42 GURL url_to_load; |
| 45 | 43 |
| 46 if (url.SchemeIs("mojo")) { | 44 if (url.SchemeIs("mojo")) { |
| 47 std::string origin = | |
| 48 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 49 switches::kOrigin); | |
| 50 std::string lib = MakeSharedLibraryName(url.ExtractFileName()); | 45 std::string lib = MakeSharedLibraryName(url.ExtractFileName()); |
| 51 url_to_load = GURL(origin + "/" + lib); | 46 url_to_load = GURL(loader->context_->mojo_origin() + "/" + lib); |
| 52 } else { | 47 } else { |
| 53 url_to_load = url; | 48 url_to_load = url; |
| 54 } | 49 } |
| 55 | 50 |
| 56 request_ = loader_->context_->loader()->Load(url_to_load, this); | 51 request_ = loader_->context_->loader()->Load(url_to_load, this); |
| 57 } | 52 } |
| 58 | 53 |
| 59 virtual ~LoadContext() { | 54 virtual ~LoadContext() { |
| 60 } | 55 } |
| 61 | 56 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 DCHECK(it != url_to_load_context_.end()) << url; | 112 DCHECK(it != url_to_load_context_.end()) << url; |
| 118 | 113 |
| 119 LoadContext* doomed = it->second; | 114 LoadContext* doomed = it->second; |
| 120 url_to_load_context_.erase(it); | 115 url_to_load_context_.erase(it); |
| 121 | 116 |
| 122 delete doomed; | 117 delete doomed; |
| 123 } | 118 } |
| 124 | 119 |
| 125 } // namespace shell | 120 } // namespace shell |
| 126 } // namespace mojo | 121 } // namespace mojo |
| OLD | NEW |