| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 66 virtual bool IsWebUIDataSourceImpl() const; | 68 virtual bool IsWebUIDataSourceImpl() const; |
| 67 | 69 |
| 70 // Replacements for i18n or null if no replacements are desired. |
| 71 virtual const ui::TemplateReplacements* GetReplacements() const; |
| 72 |
| 68 protected: | 73 protected: |
| 69 virtual ~URLDataSourceImpl(); | 74 virtual ~URLDataSourceImpl(); |
| 70 | 75 |
| 71 private: | 76 private: |
| 72 friend class URLDataManager; | 77 friend class URLDataManager; |
| 73 friend class URLDataManagerBackend; | 78 friend class URLDataManagerBackend; |
| 74 friend class base::DeleteHelper<URLDataSourceImpl>; | 79 friend class base::DeleteHelper<URLDataSourceImpl>; |
| 75 | 80 |
| 76 // SendResponse invokes this on the IO thread. Notifies the backend to | 81 // SendResponse invokes this on the IO thread. Notifies the backend to |
| 77 // handle the actual work of sending the data. | 82 // handle the actual work of sending the data. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 92 // scoped_refptr else there would be a cycle between the backend and data | 97 // scoped_refptr else there would be a cycle between the backend and data |
| 93 // source. | 98 // source. |
| 94 URLDataManagerBackend* backend_; | 99 URLDataManagerBackend* backend_; |
| 95 | 100 |
| 96 std::unique_ptr<URLDataSource> source_; | 101 std::unique_ptr<URLDataSource> source_; |
| 97 }; | 102 }; |
| 98 | 103 |
| 99 } // namespace content | 104 } // namespace content |
| 100 | 105 |
| 101 #endif // CONTENT_BROWSER_WEBUI_URL_DATA_SOURCE_IMPL_H_ | 106 #endif // CONTENT_BROWSER_WEBUI_URL_DATA_SOURCE_IMPL_H_ |
| OLD | NEW |