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/runner/url_resolver.h" | 5 #include "mojo/runner/url_resolver.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "mojo/runner/switches.h" | 10 #include "mojo/runner/switches.h" |
11 #include "mojo/shell/query_util.h" | 11 #include "mojo/shell/query_util.h" |
12 #include "mojo/util/filename_util.h" | 12 #include "mojo/util/filename_util.h" |
13 #include "url/url_util.h" | 13 #include "url/url_util.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 namespace runner { | 16 namespace runner { |
17 | 17 |
18 URLResolver::URLResolver() { | 18 URLResolver::URLResolver() { |
19 // Needed to treat first component of mojo URLs as host, not path. | 19 // Needed to treat first component of mojo URLs as host, not path. |
20 url::AddStandardScheme("mojo"); | 20 url::AddStandardScheme("mojo", url::SCHEME_WITHOUT_AUTHORITY); |
21 } | 21 } |
22 | 22 |
23 URLResolver::~URLResolver() { | 23 URLResolver::~URLResolver() { |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 std::vector<URLResolver::OriginMapping> URLResolver::GetOriginMappings( | 27 std::vector<URLResolver::OriginMapping> URLResolver::GetOriginMappings( |
28 const base::CommandLine::StringVector& args) { | 28 const base::CommandLine::StringVector& args) { |
29 std::vector<OriginMapping> origin_mappings; | 29 std::vector<OriginMapping> origin_mappings; |
30 const std::string kArgsForSwitches[] = { | 30 const std::string kArgsForSwitches[] = { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 // It's still a mojo: URL, use the default mapping scheme. | 109 // It's still a mojo: URL, use the default mapping scheme. |
110 std::string query; | 110 std::string query; |
111 GURL base_url = shell::GetBaseURLAndQuery(mojo_url, &query); | 111 GURL base_url = shell::GetBaseURLAndQuery(mojo_url, &query); |
112 const std::string host = base_url.host(); | 112 const std::string host = base_url.host(); |
113 return mojo_base_url_.Resolve(host + "/" + host + ".mojo" + query); | 113 return mojo_base_url_.Resolve(host + "/" + host + ".mojo" + query); |
114 } | 114 } |
115 | 115 |
116 } // namespace runner | 116 } // namespace runner |
117 } // namespace mojo | 117 } // namespace mojo |
OLD | NEW |