OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SHARED_RESOURCES_DATA_SOURCE_H_ | 5 #ifndef CONTENT_BROWSER_WEBUI_SHARED_RESOURCES_DATA_SOURCE_H_ |
6 #define CONTENT_BROWSER_WEBUI_SHARED_RESOURCES_DATA_SOURCE_H_ | 6 #define CONTENT_BROWSER_WEBUI_SHARED_RESOURCES_DATA_SOURCE_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/containers/hash_tables.h" |
9 #include "base/macros.h" | 12 #include "base/macros.h" |
10 #include "content/public/browser/url_data_source.h" | 13 #include "content/public/browser/url_data_source.h" |
| 14 #include "content/common/content_export.h" |
11 | 15 |
12 namespace content { | 16 namespace content { |
13 | 17 |
14 // A DataSource for chrome://resources/ URLs. | 18 // A DataSource for chrome://resources/ URLs. |
15 class SharedResourcesDataSource : public URLDataSource { | 19 class CONTENT_EXPORT SharedResourcesDataSource : public URLDataSource { |
16 public: | 20 public: |
17 SharedResourcesDataSource(); | 21 SharedResourcesDataSource(); |
18 | 22 |
| 23 using ResourcesMap = base::hash_map<std::string, int>; |
| 24 static const ResourcesMap& GetResourcesMap(); |
| 25 |
19 // URLDataSource implementation. | 26 // URLDataSource implementation. |
20 std::string GetSource() const override; | 27 std::string GetSource() const override; |
21 void StartDataRequest( | 28 void StartDataRequest( |
22 const std::string& path, | 29 const std::string& path, |
23 int render_process_id, | 30 int render_process_id, |
24 int render_frame_id, | 31 int render_frame_id, |
25 const URLDataSource::GotDataCallback& callback) override; | 32 const URLDataSource::GotDataCallback& callback) override; |
26 std::string GetMimeType(const std::string& path) const override; | 33 std::string GetMimeType(const std::string& path) const override; |
27 base::MessageLoop* MessageLoopForRequestPath( | 34 base::MessageLoop* MessageLoopForRequestPath( |
28 const std::string& path) const override; | 35 const std::string& path) const override; |
29 std::string GetAccessControlAllowOriginForOrigin( | 36 std::string GetAccessControlAllowOriginForOrigin( |
30 const std::string& origin) const override; | 37 const std::string& origin) const override; |
31 | 38 |
32 private: | 39 private: |
33 ~SharedResourcesDataSource() override; | 40 ~SharedResourcesDataSource() override; |
34 | 41 |
35 DISALLOW_COPY_AND_ASSIGN(SharedResourcesDataSource); | 42 DISALLOW_COPY_AND_ASSIGN(SharedResourcesDataSource); |
36 }; | 43 }; |
37 | 44 |
38 } // namespace content | 45 } // namespace content |
39 | 46 |
40 #endif // CONTENT_BROWSER_WEBUI_SHARED_RESOURCES_DATA_SOURCE_H_ | 47 #endif // CONTENT_BROWSER_WEBUI_SHARED_RESOURCES_DATA_SOURCE_H_ |
OLD | NEW |