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

Side by Side Diff: mojo/runner/url_resolver.cc

Issue 1147203002: Revert of Changes caching logic of mojo java apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/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/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // The mapping has produced some sort of non-mojo: URL - file:, http:, etc. 107 // The mapping has produced some sort of non-mojo: URL - file:, http:, etc.
108 return mojo_url; 108 return mojo_url;
109 } 109 }
110 110
111 // It's still a mojo: URL, use the default mapping scheme. 111 // It's still a mojo: URL, use the default mapping scheme.
112 std::string query; 112 std::string query;
113 GURL base_url = shell::GetBaseURLAndQuery(mojo_url, &query); 113 GURL base_url = shell::GetBaseURLAndQuery(mojo_url, &query);
114 if (mojo_base_url_.SchemeIsFile()) { 114 if (mojo_base_url_.SchemeIsFile()) {
115 const GURL url_with_directory( 115 const GURL url_with_directory(
116 mojo_base_url_.Resolve(base_url.host() + "/")); 116 mojo_base_url_.Resolve(base_url.host() + "/"));
117 const base::FilePath dir(util::UrlToFilePath(url_with_directory)); 117 const base::FilePath file_path(util::UrlToFilePath(url_with_directory));
118 if (base::DirectoryExists(dir)) { 118 if (base::DirectoryExists(file_path))
119 const base::FilePath mojo_path = dir.Append(base_url.host() + ".mojo"); 119 return url_with_directory.Resolve(base_url.host() + ".mojo" + query);
120 // Only use the directory if the .mojo exists in the directory.
121 if (base::PathExists(mojo_path))
122 return url_with_directory.Resolve(base_url.host() + ".mojo" + query);
123 }
124 } 120 }
125 return mojo_base_url_.Resolve(base_url.host() + ".mojo" + query); 121 return mojo_base_url_.Resolve(base_url.host() + ".mojo" + query);
126 } 122 }
127 123
128 } // namespace runner 124 } // namespace runner
129 } // namespace mojo 125 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java ('k') | mojo/runner/url_resolver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698