| 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 BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H__ |
| 6 #define BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H__ | 6 #define 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 GURL; | 15 class GURL; |
| 15 class MessageLoop; | 16 class MessageLoop; |
| 16 class URLRequest; | 17 class URLRequest; |
| 17 class URLRequestChromeJob; | 18 class URLRequestChromeJob; |
| 18 class URLRequestJob; | 19 class URLRequestJob; |
| 19 | 20 |
| 20 // To serve dynamic data off of chrome: URLs, implement the | 21 // To serve dynamic data off of chrome: URLs, implement the |
| 21 // ChromeURLDataManager::DataSource interface and register your handler | 22 // ChromeURLDataManager::DataSource interface and register your handler |
| 22 // with AddDataSource. | 23 // with AddDataSource. |
| 23 | 24 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 54 virtual std::string GetMimeType(const std::string& path) const = 0; | 55 virtual std::string GetMimeType(const std::string& path) const = 0; |
| 55 | 56 |
| 56 // Report that a request has resulted in the data |bytes|. | 57 // Report that a request has resulted in the data |bytes|. |
| 57 // If the request can't be satisfied, pass NULL for |bytes| to indicate | 58 // If the request can't be satisfied, pass NULL for |bytes| to indicate |
| 58 // the request is over. | 59 // the request is over. |
| 59 void SendResponse(int request_id, RefCountedBytes* bytes); | 60 void SendResponse(int request_id, RefCountedBytes* bytes); |
| 60 | 61 |
| 61 MessageLoop* message_loop() const { return message_loop_; } | 62 MessageLoop* message_loop() const { return message_loop_; } |
| 62 const std::string& source_name() const { return source_name_; } | 63 const std::string& source_name() const { return source_name_; } |
| 63 | 64 |
| 65 static void SetFontAndTextDirection(DictionaryValue* localized_strings); |
| 66 |
| 64 private: | 67 private: |
| 65 // The name of this source. | 68 // The name of this source. |
| 66 // E.g., for favicons, this could be "favicon", which results in paths for | 69 // E.g., for favicons, this could be "favicon", which results in paths for |
| 67 // specific resources like "favicon/34" getting sent to this source. | 70 // specific resources like "favicon/34" getting sent to this source. |
| 68 const std::string source_name_; | 71 const std::string source_name_; |
| 69 | 72 |
| 70 // The MessageLoop for the thread where this DataSource lives. | 73 // The MessageLoop for the thread where this DataSource lives. |
| 71 // Used to send messages to the DataSource. | 74 // Used to send messages to the DataSource. |
| 72 MessageLoop* message_loop_; | 75 MessageLoop* message_loop_; |
| 73 }; | 76 }; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 extern ChromeURLDataManager chrome_url_data_manager; | 145 extern ChromeURLDataManager chrome_url_data_manager; |
| 143 | 146 |
| 144 // Register our special URL handler under our special URL scheme. | 147 // Register our special URL handler under our special URL scheme. |
| 145 // Must be done once at startup. | 148 // Must be done once at startup. |
| 146 void RegisterURLRequestChromeJob(); | 149 void RegisterURLRequestChromeJob(); |
| 147 | 150 |
| 148 // Undoes the registration done by RegisterURLRequestChromeJob. | 151 // Undoes the registration done by RegisterURLRequestChromeJob. |
| 149 void UnregisterURLRequestChromeJob(); | 152 void UnregisterURLRequestChromeJob(); |
| 150 | 153 |
| 151 #endif // BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H__ | 154 #endif // BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H__ |
| OLD | NEW |