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