| 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 30 matching lines...) Expand all Loading... |
| 41 DataSource(const std::string& source_name, | 41 DataSource(const std::string& source_name, |
| 42 MessageLoop* message_loop) | 42 MessageLoop* message_loop) |
| 43 : source_name_(source_name), message_loop_(message_loop) {} | 43 : source_name_(source_name), message_loop_(message_loop) {} |
| 44 virtual ~DataSource() {} | 44 virtual ~DataSource() {} |
| 45 | 45 |
| 46 // Sent by the DataManager to request data at |path|. The source should | 46 // Sent by the DataManager to request data at |path|. The source should |
| 47 // call SendResponse() when the data is available or if the request could | 47 // call SendResponse() when the data is available or if the request could |
| 48 // not be satisfied. | 48 // not be satisfied. |
| 49 virtual void StartDataRequest(const std::string& path, int request_id) = 0; | 49 virtual void StartDataRequest(const std::string& path, int request_id) = 0; |
| 50 | 50 |
| 51 // Return the mimetype that should be sent with this response, or empty |
| 52 // string to specify no mime type. |
| 53 virtual std::string GetMimeType(const std::string& path) const = 0; |
| 54 |
| 51 // Report that a request has resulted in the data |bytes|. | 55 // Report that a request has resulted in the data |bytes|. |
| 52 // If the request can't be satisfied, pass NULL for |bytes| to indicate | 56 // If the request can't be satisfied, pass NULL for |bytes| to indicate |
| 53 // the request is over. | 57 // the request is over. |
| 54 void SendResponse(int request_id, RefCountedBytes* bytes); | 58 void SendResponse(int request_id, RefCountedBytes* bytes); |
| 55 | 59 |
| 56 MessageLoop* message_loop() const { return message_loop_; } | 60 MessageLoop* message_loop() const { return message_loop_; } |
| 57 const std::string& source_name() const { return source_name_; } | 61 const std::string& source_name() const { return source_name_; } |
| 58 | 62 |
| 59 private: | 63 private: |
| 60 // The name of this source. | 64 // The name of this source. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 139 |
| 136 // The single global instance of ChromeURLDataManager. | 140 // The single global instance of ChromeURLDataManager. |
| 137 extern ChromeURLDataManager chrome_url_data_manager; | 141 extern ChromeURLDataManager chrome_url_data_manager; |
| 138 | 142 |
| 139 // Register our special URL handler under our special URL scheme. | 143 // Register our special URL handler under our special URL scheme. |
| 140 // Must be done once at startup. | 144 // Must be done once at startup. |
| 141 void RegisterURLRequestChromeJob(); | 145 void RegisterURLRequestChromeJob(); |
| 142 | 146 |
| 143 #endif // BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H__ | 147 #endif // BROWSER_DOM_UI_CHROME_URL_DATA_MANAGER_H__ |
| 144 | 148 |
| OLD | NEW |