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

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

Issue 640403002: Drop refs to net::EmbeddedTestServer / net::File{Path,URL} utils in mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cast length explicitly Created 6 years, 2 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
« no previous file with comments | « mojo/shell/filename_util.cc ('k') | mojo/shell/shell_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/mojo_url_resolver.h" 5 #include "mojo/shell/mojo_url_resolver.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "net/base/filename_util.h" 12 #include "mojo/shell/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 shell { 16 namespace shell {
17 namespace { 17 namespace {
18 18
19 std::string MakeSharedLibraryName(std::string host_name) { 19 std::string MakeSharedLibraryName(std::string host_name) {
20 // TODO(aa): This should go away soon. In the Chromium repo, all the app 20 // TODO(aa): This should go away soon. In the Chromium repo, all the app
21 // target names start with "mojo_" by convention. But when we have an SDK, 21 // target names start with "mojo_" by convention. But when we have an SDK,
22 // one would assume the libraries would have names that don't have this bit. 22 // one would assume the libraries would have names that don't have this bit.
(...skipping 25 matching lines...) Expand all
48 48
49 } // namespace 49 } // namespace
50 50
51 MojoURLResolver::MojoURLResolver() { 51 MojoURLResolver::MojoURLResolver() {
52 // Needed to treat first component of mojo URLs as host, not path. 52 // Needed to treat first component of mojo URLs as host, not path.
53 url::AddStandardScheme("mojo"); 53 url::AddStandardScheme("mojo");
54 54
55 // By default, resolve mojo URLs to files living alongside the shell. 55 // By default, resolve mojo URLs to files living alongside the shell.
56 base::FilePath path; 56 base::FilePath path;
57 PathService::Get(base::DIR_MODULE, &path); 57 PathService::Get(base::DIR_MODULE, &path);
58 default_base_url_ = AddTrailingSlashIfNeeded(net::FilePathToFileURL(path)); 58 default_base_url_ = AddTrailingSlashIfNeeded(FilePathToFileURL(path));
59 } 59 }
60 60
61 MojoURLResolver::~MojoURLResolver() { 61 MojoURLResolver::~MojoURLResolver() {
62 } 62 }
63 63
64 void MojoURLResolver::SetBaseURL(const GURL& base_url) { 64 void MojoURLResolver::SetBaseURL(const GURL& base_url) {
65 DCHECK(base_url.is_valid()); 65 DCHECK(base_url.is_valid());
66 // Force a trailing slash on the base_url to simplify resolving 66 // Force a trailing slash on the base_url to simplify resolving
67 // relative files and URLs below. 67 // relative files and URLs below.
68 base_url_ = AddTrailingSlashIfNeeded(base_url); 68 base_url_ = AddTrailingSlashIfNeeded(base_url);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 std::map<GURL, GURL>::const_iterator it = url_map_.find(mapped_url); 102 std::map<GURL, GURL>::const_iterator it = url_map_.find(mapped_url);
103 if (it == url_map_.end()) 103 if (it == url_map_.end())
104 break; 104 break;
105 mapped_url = it->second; 105 mapped_url = it->second;
106 } 106 }
107 return mapped_url; 107 return mapped_url;
108 } 108 }
109 109
110 } // namespace shell 110 } // namespace shell
111 } // namespace mojo 111 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/filename_util.cc ('k') | mojo/shell/shell_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698