| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H_ |
| 6 #define BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H_ | 6 #define CHROME_BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/task.h" | 11 #include "base/task.h" |
| 12 #include "chrome/common/ref_counted_util.h" | 12 #include "chrome/common/ref_counted_util.h" |
| 13 | 13 |
| 14 class DictionaryValue; | 14 class DictionaryValue; |
| 15 class FilePath; | 15 class FilePath; |
| 16 class GURL; | 16 class GURL; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 // Add/remove a path from the collection of file sources. | 100 // Add/remove a path from the collection of file sources. |
| 101 // A file source acts like a file:// URL to the specified path. | 101 // A file source acts like a file:// URL to the specified path. |
| 102 // Calling this from threads other the IO thread must be done via | 102 // Calling this from threads other the IO thread must be done via |
| 103 // InvokeLater. | 103 // InvokeLater. |
| 104 void AddFileSource(const std::string& source_name, const FilePath& path); | 104 void AddFileSource(const std::string& source_name, const FilePath& path); |
| 105 void RemoveFileSource(const std::string& source_name); | 105 void RemoveFileSource(const std::string& source_name); |
| 106 | 106 |
| 107 static URLRequestJob* Factory(URLRequest* request, const std::string& scheme); | 107 static URLRequestJob* Factory(URLRequest* request, const std::string& scheme); |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 friend class URLRequestChromeJob; | 110 friend class URLRequestChromeJob; |
| 111 | 111 |
| 112 // Parse a URL into the components used to resolve its request. | 112 // Parse a URL into the components used to resolve its request. |
| 113 static void URLToRequest(const GURL& url, | 113 static void URLToRequest(const GURL& url, |
| 114 std::string* source, | 114 std::string* source, |
| 115 std::string* path); | 115 std::string* path); |
| 116 | 116 |
| 117 // Translate a chrome resource URL into a local file path if there is one. | 117 // Translate a chrome resource URL into a local file path if there is one. |
| 118 // Returns false if there is no file handler for this URL | 118 // Returns false if there is no file handler for this URL |
| 119 static bool URLToFilePath(const GURL& url, FilePath* file_path); | 119 static bool URLToFilePath(const GURL& url, FilePath* file_path); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 147 typedef std::map<RequestID, URLRequestChromeJob*> PendingRequestMap; | 147 typedef std::map<RequestID, URLRequestChromeJob*> PendingRequestMap; |
| 148 PendingRequestMap pending_requests_; | 148 PendingRequestMap pending_requests_; |
| 149 | 149 |
| 150 // The ID we'll use for the next request we receive. | 150 // The ID we'll use for the next request we receive. |
| 151 RequestID next_request_id_; | 151 RequestID next_request_id_; |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 // Since we have a single global ChromeURLDataManager, we don't need to | 154 // Since we have a single global ChromeURLDataManager, we don't need to |
| 155 // grab a reference to it when creating Tasks involving it. | 155 // grab a reference to it when creating Tasks involving it. |
| 156 template <> struct RunnableMethodTraits<ChromeURLDataManager> { | 156 template <> struct RunnableMethodTraits<ChromeURLDataManager> { |
| 157 void RetainCallee(ChromeURLDataManager*) {} | 157 void RetainCallee(ChromeURLDataManager* manager) {} |
| 158 void ReleaseCallee(ChromeURLDataManager*) {} | 158 void ReleaseCallee(ChromeURLDataManager* manager) {} |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 // The single global instance of ChromeURLDataManager. | 161 // The single global instance of ChromeURLDataManager. |
| 162 extern ChromeURLDataManager chrome_url_data_manager; | 162 extern ChromeURLDataManager chrome_url_data_manager; |
| 163 | 163 |
| 164 // Register our special URL handler under our special URL scheme. | 164 // Register our special URL handler under our special URL scheme. |
| 165 // Must be done once at startup. | 165 // Must be done once at startup. |
| 166 void RegisterURLRequestChromeJob(); | 166 void RegisterURLRequestChromeJob(); |
| 167 | 167 |
| 168 // Undoes the registration done by RegisterURLRequestChromeJob. | 168 // Undoes the registration done by RegisterURLRequestChromeJob. |
| 169 void UnregisterURLRequestChromeJob(); | 169 void UnregisterURLRequestChromeJob(); |
| 170 | 170 |
| 171 #endif // BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H_ | 171 #endif // CHROME_BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H_ |
| OLD | NEW |