| 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 19 matching lines...) Expand all Loading... |
| 30 class CONTENT_EXPORT URLDataSource { | 30 class CONTENT_EXPORT URLDataSource { |
| 31 public: | 31 public: |
| 32 // Adds a URL data source to |browser_context|. | 32 // Adds a URL data source to |browser_context|. |
| 33 static void Add(BrowserContext* browser_context, URLDataSource* source); | 33 static void Add(BrowserContext* browser_context, URLDataSource* source); |
| 34 | 34 |
| 35 virtual ~URLDataSource() {} | 35 virtual ~URLDataSource() {} |
| 36 | 36 |
| 37 // The name of this source. | 37 // The name of this source. |
| 38 // E.g., for favicons, this could be "favicon", which results in paths for | 38 // E.g., for favicons, this could be "favicon", which results in paths for |
| 39 // specific resources like "favicon/34" getting sent to this source. | 39 // specific resources like "favicon/34" getting sent to this source. |
| 40 virtual std::string GetSource() = 0; | 40 virtual std::string GetSource() const = 0; |
| 41 | 41 |
| 42 // Used by StartDataRequest so that the child class can return the data when | 42 // Used by StartDataRequest so that the child class can return the data when |
| 43 // it's available. | 43 // it's available. |
| 44 typedef base::Callback<void(base::RefCountedMemory*)> GotDataCallback; | 44 typedef base::Callback<void(base::RefCountedMemory*)> GotDataCallback; |
| 45 | 45 |
| 46 // Called by URLDataSource to request data at |path|. The string parameter is | 46 // Called by URLDataSource to request data at |path|. The string parameter is |
| 47 // the path of the request. The child class should run |callback| when the | 47 // the path of the request. The child class should run |callback| when the |
| 48 // data is available or if the request could not be satisfied. This can be | 48 // data is available or if the request could not be satisfied. This can be |
| 49 // called either in this callback or asynchronously with the response. | 49 // called either in this callback or asynchronously with the response. |
| 50 virtual void StartDataRequest(const std::string& path, | 50 virtual void StartDataRequest(const std::string& path, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Override in specific WebUI data sources to enable for additional schemes or | 104 // Override in specific WebUI data sources to enable for additional schemes or |
| 105 // to implement fancier access control. Typically used in concert with | 105 // to implement fancier access control. Typically used in concert with |
| 106 // ContentBrowserClient::GetAdditionalWebUISchemes() to permit additional | 106 // ContentBrowserClient::GetAdditionalWebUISchemes() to permit additional |
| 107 // WebUI scheme support for an embedder. | 107 // WebUI scheme support for an embedder. |
| 108 virtual bool ShouldServiceRequest(const net::URLRequest* request) const; | 108 virtual bool ShouldServiceRequest(const net::URLRequest* request) const; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 } // namespace content | 111 } // namespace content |
| 112 | 112 |
| 113 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ | 113 #endif // CONTENT_PUBLIC_BROWSER_URL_DATA_SOURCE_H_ |
| OLD | NEW |