diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-12 23:57:07 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-12 23:57:07 +0000 |
commit | 5a8459aa45b09a6cdcdd90ca190ba353799e3464 (patch) | |
tree | 602891af868f7e18c86310dece98b96a1681c9ce /chrome/browser/dom_ui | |
parent | 62b770196c21fccc2e9605187b3f0e8725e87f7d (diff) | |
download | chromium_src-5a8459aa45b09a6cdcdd90ca190ba353799e3464.zip chromium_src-5a8459aa45b09a6cdcdd90ca190ba353799e3464.tar.gz chromium_src-5a8459aa45b09a6cdcdd90ca190ba353799e3464.tar.bz2 |
Use FilePaths in chrome_url_data_manager.
BUG=24672
TEST=still compiles
Review URL: http://codereview.chromium.org/267065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28760 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r-- | chrome/browser/dom_ui/chrome_url_data_manager.cc | 15 | ||||
-rw-r--r-- | chrome/browser/dom_ui/chrome_url_data_manager.h | 13 |
2 files changed, 14 insertions, 14 deletions
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc index c9ebd51..be3c856 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.cc +++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc @@ -99,7 +99,7 @@ void RegisterURLRequestChromeJob() { url_util::AddStandardScheme(kChromeURLScheme); } - std::wstring inspector_dir; + FilePath inspector_dir; if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) { // TODO(yurys): remove "inspector" source when new developer tools support // all features of in-process Web Inspector and Console Debugger. For the @@ -157,7 +157,7 @@ void ChromeURLDataManager::URLToRequest(const GURL& url, // static bool ChromeURLDataManager::URLToFilePath(const GURL& url, - std::wstring* file_path) { + FilePath* file_path) { // Parse the URL into a request for a source and path. std::string source_name; std::string relative_path; @@ -168,8 +168,8 @@ bool ChromeURLDataManager::URLToFilePath(const GURL& url, if (i == chrome_url_data_manager.file_sources_.end()) return false; - file_path->assign(i->second); - file_util::AppendToPath(file_path, UTF8ToWide(relative_path)); + *file_path = i->second.AppendASCII(relative_path); + return true; } @@ -184,7 +184,7 @@ void ChromeURLDataManager::AddDataSource(scoped_refptr<DataSource> source) { } void ChromeURLDataManager::AddFileSource(const std::string& source_name, - const std::wstring& file_path) { + const FilePath& file_path) { DCHECK(file_sources_.count(source_name) == 0); file_sources_[source_name] = file_path; } @@ -328,10 +328,9 @@ class NetInternalsURLFormat : public URLRequestViewNetInternalsJob::URLFormat { URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request, const std::string& scheme) { // Try first with a file handler - std::wstring path; + FilePath path; if (ChromeURLDataManager::URLToFilePath(request->url(), &path)) - return new URLRequestChromeFileJob(request, - FilePath::FromWStringHack(path)); + return new URLRequestChromeFileJob(request, path); // Next check for chrome://net-internals/, which uses its own job type. if (NetInternalsURLFormat::IsSupportedURL(request->url())) { diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.h b/chrome/browser/dom_ui/chrome_url_data_manager.h index 80fc862..beecdaa 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.h +++ b/chrome/browser/dom_ui/chrome_url_data_manager.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H__ -#define BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H__ +#ifndef BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H_ +#define BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H_ #include <map> #include <string> @@ -12,6 +12,7 @@ #include "chrome/common/ref_counted_util.h" class DictionaryValue; +class FilePath; class GURL; class MessageLoop; class URLRequest; @@ -100,7 +101,7 @@ class ChromeURLDataManager { // A file source acts like a file:// URL to the specified path. // Calling this from threads other the IO thread must be done via // InvokeLater. - void AddFileSource(const std::string& source_name, const std::wstring& path); + void AddFileSource(const std::string& source_name, const FilePath& path); void RemoveFileSource(const std::string& source_name); static URLRequestJob* Factory(URLRequest* request, const std::string& scheme); @@ -115,7 +116,7 @@ private: // Translate a chrome resource URL into a local file path if there is one. // Returns false if there is no file handler for this URL - static bool URLToFilePath(const GURL& url, std::wstring* file_path); + static bool URLToFilePath(const GURL& url, FilePath* file_path); // Called by the job when it's starting up. // Returns false if |url| is not a URL managed by this object. @@ -133,7 +134,7 @@ private: scoped_refptr<RefCountedBytes> bytes); // File sources of data, keyed by source name (e.g. "inspector"). - typedef std::map<std::string, std::wstring> FileSourceMap; + typedef std::map<std::string, FilePath> FileSourceMap; FileSourceMap file_sources_; // Custom sources of data, keyed by source path (e.g. "favicon"). @@ -167,4 +168,4 @@ void RegisterURLRequestChromeJob(); // Undoes the registration done by RegisterURLRequestChromeJob. void UnregisterURLRequestChromeJob(); -#endif // BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H__ +#endif // BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H_ |