| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/dom_ui/chrome_url_data_manager.h" | 5 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 replacements.ClearRef(); | 162 replacements.ClearRef(); |
| 163 stripped_url = url.ReplaceComponents(replacements); | 163 stripped_url = url.ReplaceComponents(replacements); |
| 164 | 164 |
| 165 URLToRequest(stripped_url, &source_name, &relative_path); | 165 URLToRequest(stripped_url, &source_name, &relative_path); |
| 166 | 166 |
| 167 FileSourceMap::const_iterator i( | 167 FileSourceMap::const_iterator i( |
| 168 Singleton<ChromeURLDataManager>()->file_sources_.find(source_name)); | 168 Singleton<ChromeURLDataManager>()->file_sources_.find(source_name)); |
| 169 if (i == Singleton<ChromeURLDataManager>()->file_sources_.end()) | 169 if (i == Singleton<ChromeURLDataManager>()->file_sources_.end()) |
| 170 return false; | 170 return false; |
| 171 | 171 |
| 172 // Check that |relative_path| is not an absolute path (otherwise AppendASCII() |
| 173 // will DCHECK). The awkward use of StringType is because on some systems |
| 174 // FilePath expects a std::string, but on others a std::wstring. |
| 175 FilePath p(FilePath::StringType(relative_path.begin(), relative_path.end())); |
| 176 if (p.IsAbsolute()) |
| 177 return false; |
| 178 |
| 172 *file_path = i->second.AppendASCII(relative_path); | 179 *file_path = i->second.AppendASCII(relative_path); |
| 173 | 180 |
| 174 return true; | 181 return true; |
| 175 } | 182 } |
| 176 | 183 |
| 177 ChromeURLDataManager::ChromeURLDataManager() : next_request_id_(0) { } | 184 ChromeURLDataManager::ChromeURLDataManager() : next_request_id_(0) { } |
| 178 | 185 |
| 179 ChromeURLDataManager::~ChromeURLDataManager() { } | 186 ChromeURLDataManager::~ChromeURLDataManager() { } |
| 180 | 187 |
| 181 void ChromeURLDataManager::AddDataSource(scoped_refptr<DataSource> source) { | 188 void ChromeURLDataManager::AddDataSource(scoped_refptr<DataSource> source) { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 net::ERR_INVALID_URL)); | 420 net::ERR_INVALID_URL)); |
| 414 } | 421 } |
| 415 } | 422 } |
| 416 | 423 |
| 417 URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request, | 424 URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request, |
| 418 const FilePath& path) | 425 const FilePath& path) |
| 419 : URLRequestFileJob(request, path) { | 426 : URLRequestFileJob(request, path) { |
| 420 } | 427 } |
| 421 | 428 |
| 422 URLRequestChromeFileJob::~URLRequestChromeFileJob() { } | 429 URLRequestChromeFileJob::~URLRequestChromeFileJob() { } |
| OLD | NEW |