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

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: 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
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 "net/base/filename_util.h" 11 #include "mojo/shell/filename_util.h"
12 #include "url/url_util.h" 12 #include "url/url_util.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace shell { 15 namespace shell {
16 namespace { 16 namespace {
17 17
18 std::string MakeSharedLibraryName(const std::string& host_name) { 18 std::string MakeSharedLibraryName(const std::string& host_name) {
19 #if defined(OS_WIN) 19 #if defined(OS_WIN)
20 return host_name + ".dll"; 20 return host_name + ".dll";
21 #elif defined(OS_LINUX) || defined(OS_ANDROID) 21 #elif defined(OS_LINUX) || defined(OS_ANDROID)
(...skipping 18 matching lines...) Expand all
40 40
41 } // namespace 41 } // namespace
42 42
43 MojoURLResolver::MojoURLResolver() { 43 MojoURLResolver::MojoURLResolver() {
44 // Needed to treat first component of mojo URLs as host, not path. 44 // Needed to treat first component of mojo URLs as host, not path.
45 url::AddStandardScheme("mojo"); 45 url::AddStandardScheme("mojo");
46 46
47 // By default, resolve mojo URLs to files living alongside the shell. 47 // By default, resolve mojo URLs to files living alongside the shell.
48 base::FilePath path; 48 base::FilePath path;
49 PathService::Get(base::DIR_MODULE, &path); 49 PathService::Get(base::DIR_MODULE, &path);
50 default_base_url_ = AddTrailingSlashIfNeeded(net::FilePathToFileURL(path)); 50 default_base_url_ = AddTrailingSlashIfNeeded(FilePathToFileURL(path));
51 } 51 }
52 52
53 MojoURLResolver::~MojoURLResolver() { 53 MojoURLResolver::~MojoURLResolver() {
54 } 54 }
55 55
56 void MojoURLResolver::SetBaseURL(const GURL& base_url) { 56 void MojoURLResolver::SetBaseURL(const GURL& base_url) {
57 DCHECK(base_url.is_valid()); 57 DCHECK(base_url.is_valid());
58 // Force a trailing slash on the base_url to simplify resolving 58 // Force a trailing slash on the base_url to simplify resolving
59 // relative files and URLs below. 59 // relative files and URLs below.
60 base_url_ = AddTrailingSlashIfNeeded(base_url); 60 base_url_ = AddTrailingSlashIfNeeded(base_url);
(...skipping 20 matching lines...) Expand all
81 // Resolve to a local file URL. 81 // Resolve to a local file URL.
82 return default_base_url_.Resolve(lib); 82 return default_base_url_.Resolve(lib);
83 } 83 }
84 84
85 // Otherwise, resolve to an URL relative to base_url_. 85 // Otherwise, resolve to an URL relative to base_url_.
86 return base_url_.Resolve(lib); 86 return base_url_.Resolve(lib);
87 } 87 }
88 88
89 } // namespace shell 89 } // namespace shell
90 } // namespace mojo 90 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698