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_BROWSER_WEBUI_URL_DATA_SOURCE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEBUI_URL_DATA_SOURCE_IMPL_H_ |
6 #define CONTENT_BROWSER_WEBUI_URL_DATA_SOURCE_IMPL_H_ | 6 #define CONTENT_BROWSER_WEBUI_URL_DATA_SOURCE_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
| 9 #include <string> |
9 | 10 |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "base/sequenced_task_runner_helpers.h" | 12 #include "base/sequenced_task_runner_helpers.h" |
12 #include "content/browser/webui/url_data_manager.h" | 13 #include "content/browser/webui/url_data_manager.h" |
13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "ui/base/template_expressions.h" |
14 | 16 |
15 namespace base { | 17 namespace base { |
16 class RefCountedMemory; | 18 class RefCountedMemory; |
17 } | 19 } |
18 | 20 |
19 namespace content { | 21 namespace content { |
20 class URLDataManagerBackend; | 22 class URLDataManagerBackend; |
21 class URLDataSource; | 23 class URLDataSource; |
22 class URLDataSourceImpl; | 24 class URLDataSourceImpl; |
23 | 25 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 58 |
57 // Report that a request has resulted in the data |bytes|. | 59 // Report that a request has resulted in the data |bytes|. |
58 // If the request can't be satisfied, pass NULL for |bytes| to indicate | 60 // If the request can't be satisfied, pass NULL for |bytes| to indicate |
59 // the request is over. | 61 // the request is over. |
60 virtual void SendResponse(int request_id, | 62 virtual void SendResponse(int request_id, |
61 scoped_refptr<base::RefCountedMemory> bytes); | 63 scoped_refptr<base::RefCountedMemory> bytes); |
62 | 64 |
63 const std::string& source_name() const { return source_name_; } | 65 const std::string& source_name() const { return source_name_; } |
64 URLDataSource* source() const { return source_.get(); } | 66 URLDataSource* source() const { return source_.get(); } |
65 | 67 |
| 68 // Replacements for i18n or null if no replacements are desired. |
| 69 virtual const ui::TemplateReplacements* GetReplacements() const; |
| 70 |
66 protected: | 71 protected: |
67 virtual ~URLDataSourceImpl(); | 72 virtual ~URLDataSourceImpl(); |
68 | 73 |
69 private: | 74 private: |
70 friend class URLDataManager; | 75 friend class URLDataManager; |
71 friend class URLDataManagerBackend; | 76 friend class URLDataManagerBackend; |
72 friend class base::DeleteHelper<URLDataSourceImpl>; | 77 friend class base::DeleteHelper<URLDataSourceImpl>; |
73 | 78 |
74 // SendResponse invokes this on the IO thread. Notifies the backend to | 79 // SendResponse invokes this on the IO thread. Notifies the backend to |
75 // handle the actual work of sending the data. | 80 // handle the actual work of sending the data. |
(...skipping 14 matching lines...) Expand all Loading... |
90 // scoped_refptr else there would be a cycle between the backend and data | 95 // scoped_refptr else there would be a cycle between the backend and data |
91 // source. | 96 // source. |
92 URLDataManagerBackend* backend_; | 97 URLDataManagerBackend* backend_; |
93 | 98 |
94 std::unique_ptr<URLDataSource> source_; | 99 std::unique_ptr<URLDataSource> source_; |
95 }; | 100 }; |
96 | 101 |
97 } // namespace content | 102 } // namespace content |
98 | 103 |
99 #endif // CONTENT_BROWSER_WEBUI_URL_DATA_SOURCE_IMPL_H_ | 104 #endif // CONTENT_BROWSER_WEBUI_URL_DATA_SOURCE_IMPL_H_ |
OLD | NEW |