| 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 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 // Return the mimetype that should be sent with this response, or empty | 53 // Return the mimetype that should be sent with this response, or empty |
| 54 // string to specify no mime type. | 54 // string to specify no mime type. |
| 55 virtual std::string GetMimeType(const std::string& path) const = 0; | 55 virtual std::string GetMimeType(const std::string& path) const = 0; |
| 56 | 56 |
| 57 // Report that a request has resulted in the data |bytes|. | 57 // Report that a request has resulted in the data |bytes|. |
| 58 // 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 |
| 59 // the request is over. | 59 // the request is over. |
| 60 void SendResponse(int request_id, RefCountedBytes* bytes); | 60 void SendResponse(int request_id, RefCountedBytes* bytes); |
| 61 | 61 |
| 62 MessageLoop* message_loop() const { return message_loop_; } | 62 // Returns the MessageLoop on which the DataSource wishes to have |
| 63 // StartDataRequest called to handle the request for |path|. If the |
| 64 // DataSource does not care which thread StartDataRequest is called on, |
| 65 // this should return NULL. The default implementation always returns |
| 66 // message_loop_, which generally results in processing on the UI thread. |
| 67 // It may be beneficial to return NULL for requests that are safe to handle |
| 68 // directly on the IO thread. This can improve performance by satisfying |
| 69 // such requests more rapidly when there is a large amount of UI thread |
| 70 // contention. |
| 71 virtual MessageLoop* MessageLoopForRequestPath(const std::string& path) |
| 72 const; |
| 73 |
| 63 const std::string& source_name() const { return source_name_; } | 74 const std::string& source_name() const { return source_name_; } |
| 64 | 75 |
| 65 static void SetFontAndTextDirection(DictionaryValue* localized_strings); | 76 static void SetFontAndTextDirection(DictionaryValue* localized_strings); |
| 66 | 77 |
| 67 private: | 78 private: |
| 68 // The name of this source. | 79 // The name of this source. |
| 69 // E.g., for favicons, this could be "favicon", which results in paths for | 80 // E.g., for favicons, this could be "favicon", which results in paths for |
| 70 // specific resources like "favicon/34" getting sent to this source. | 81 // specific resources like "favicon/34" getting sent to this source. |
| 71 const std::string source_name_; | 82 const std::string source_name_; |
| 72 | 83 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 extern ChromeURLDataManager chrome_url_data_manager; | 161 extern ChromeURLDataManager chrome_url_data_manager; |
| 151 | 162 |
| 152 // Register our special URL handler under our special URL scheme. | 163 // Register our special URL handler under our special URL scheme. |
| 153 // Must be done once at startup. | 164 // Must be done once at startup. |
| 154 void RegisterURLRequestChromeJob(); | 165 void RegisterURLRequestChromeJob(); |
| 155 | 166 |
| 156 // Undoes the registration done by RegisterURLRequestChromeJob. | 167 // Undoes the registration done by RegisterURLRequestChromeJob. |
| 157 void UnregisterURLRequestChromeJob(); | 168 void UnregisterURLRequestChromeJob(); |
| 158 | 169 |
| 159 #endif // BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H__ | 170 #endif // BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H__ |
| OLD | NEW |