| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // Used by StartDataRequest so that the child class can return the data when | 48 // Used by StartDataRequest so that the child class can return the data when |
| 49 // it's available. | 49 // it's available. |
| 50 typedef base::Callback<void(scoped_refptr<base::RefCountedMemory>)> | 50 typedef base::Callback<void(scoped_refptr<base::RefCountedMemory>)> |
| 51 GotDataCallback; | 51 GotDataCallback; |
| 52 | 52 |
| 53 // Called by URLDataSource to request data at |path|. The string parameter is | 53 // Called by URLDataSource to request data at |path|. The string parameter is |
| 54 // the path of the request. The child class should run |callback| when the | 54 // the path of the request. The child class should run |callback| when the |
| 55 // data is available or if the request could not be satisfied. This can be | 55 // data is available or if the request could not be satisfied. This can be |
| 56 // called either in this callback or asynchronously with the response. | 56 // called either in this callback or asynchronously with the response. |
| 57 // |wc_getter| can be called to return the WebContents for this request, but | 57 // |wc_getter| can be called on the UI thread to return the WebContents for |
| 58 // only on the UI thread. If this method is called on the UI thread, then it's | 58 // this request if it originates from a render frame. If it originated from a |
| 59 // guaranteed that wc_getter will return a non-null WebContents. | 59 // worker or if the frame has destructed it will return null. |
| 60 virtual void StartDataRequest( | 60 virtual void StartDataRequest( |
| 61 const std::string& path, | 61 const std::string& path, |
| 62 const ResourceRequestInfo::WebContentsGetter& wc_getter, | 62 const ResourceRequestInfo::WebContentsGetter& wc_getter, |
| 63 const GotDataCallback& callback) = 0; | 63 const GotDataCallback& callback) = 0; |
| 64 | 64 |
| 65 // Return the mimetype that should be sent with this response, or empty | 65 // Return the mimetype that should be sent with this response, or empty |
| 66 // string to specify no mime type. | 66 // string to specify no mime type. |
| 67 virtual std::string GetMimeType(const std::string& path) const = 0; | 67 virtual std::string GetMimeType(const std::string& path) const = 0; |
| 68 | 68 |
| 69 // The following methods are all called on the IO thread. | 69 // The following methods are all called on the IO thread. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 const net::URLRequest* request, | 152 const net::URLRequest* request, |
| 153 std::string* path) const {} | 153 std::string* path) const {} |
| 154 | 154 |
| 155 // Whether |path| is gzipped (and should be transmitted gzipped). | 155 // Whether |path| is gzipped (and should be transmitted gzipped). |
| 156 virtual bool IsGzipped(const std::string& path) const; | 156 virtual bool IsGzipped(const std::string& path) const; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 } // namespace content | 159 } // namespace content |
| 160 | 160 |
| 161 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ | 161 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ |
| OLD | NEW |