OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEB_UI_DATA_SOURCE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ |
6 #define CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ | 6 #define CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 #include <unordered_set> | |
13 | 12 |
14 #include "base/callback.h" | 13 #include "base/callback.h" |
15 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
16 #include "base/macros.h" | 15 #include "base/macros.h" |
17 #include "base/values.h" | 16 #include "base/values.h" |
18 #include "content/browser/webui/url_data_manager.h" | 17 #include "content/browser/webui/url_data_manager.h" |
19 #include "content/browser/webui/url_data_source_impl.h" | 18 #include "content/browser/webui/url_data_source_impl.h" |
20 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
21 #include "content/public/browser/url_data_source.h" | 20 #include "content/public/browser/url_data_source.h" |
22 #include "content/public/browser/web_ui_data_source.h" | 21 #include "content/public/browser/web_ui_data_source.h" |
(...skipping 19 matching lines...) Expand all Loading... |
42 void AddResourcePath(const std::string& path, int resource_id) override; | 41 void AddResourcePath(const std::string& path, int resource_id) override; |
43 void SetDefaultResource(int resource_id) override; | 42 void SetDefaultResource(int resource_id) override; |
44 void SetRequestFilter( | 43 void SetRequestFilter( |
45 const WebUIDataSource::HandleRequestCallback& callback) override; | 44 const WebUIDataSource::HandleRequestCallback& callback) override; |
46 void DisableReplaceExistingSource() override; | 45 void DisableReplaceExistingSource() override; |
47 void DisableContentSecurityPolicy() override; | 46 void DisableContentSecurityPolicy() override; |
48 void OverrideContentSecurityPolicyScriptSrc(const std::string& data) override; | 47 void OverrideContentSecurityPolicyScriptSrc(const std::string& data) override; |
49 void OverrideContentSecurityPolicyObjectSrc(const std::string& data) override; | 48 void OverrideContentSecurityPolicyObjectSrc(const std::string& data) override; |
50 void OverrideContentSecurityPolicyChildSrc(const std::string& data) override; | 49 void OverrideContentSecurityPolicyChildSrc(const std::string& data) override; |
51 void DisableDenyXFrameOptions() override; | 50 void DisableDenyXFrameOptions() override; |
52 void DisableI18nAndUseGzipForAllPaths() override; | 51 void UseGzip(const std::unordered_set<std::string>& excluded_paths) override; |
53 const ui::TemplateReplacements* GetReplacements() const override; | 52 const ui::TemplateReplacements* GetReplacements() const override; |
54 | 53 |
55 // Add the locale to the load time data defaults. May be called repeatedly. | 54 // Add the locale to the load time data defaults. May be called repeatedly. |
56 void EnsureLoadTimeDataDefaultsAdded(); | 55 void EnsureLoadTimeDataDefaultsAdded(); |
57 | 56 |
58 // When DisableI18nAndUseGzipForAllPaths is enabled, exclude the given |path|. | |
59 void ExcludePathFromGzip(const std::string& path); | |
60 | |
61 bool IsWebUIDataSourceImpl() const override; | 57 bool IsWebUIDataSourceImpl() const override; |
62 | 58 |
63 protected: | 59 protected: |
64 ~WebUIDataSourceImpl() override; | 60 ~WebUIDataSourceImpl() override; |
65 | 61 |
66 // Completes a request by sending our dictionary of localized strings. | 62 // Completes a request by sending our dictionary of localized strings. |
67 void SendLocalizedStringsAsJSON( | 63 void SendLocalizedStringsAsJSON( |
68 const URLDataSource::GotDataCallback& callback); | 64 const URLDataSource::GotDataCallback& callback); |
69 | 65 |
70 private: | 66 private: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 bool add_csp_; | 105 bool add_csp_; |
110 bool script_src_set_; | 106 bool script_src_set_; |
111 std::string script_src_; | 107 std::string script_src_; |
112 bool object_src_set_; | 108 bool object_src_set_; |
113 std::string object_src_; | 109 std::string object_src_; |
114 bool frame_src_set_; | 110 bool frame_src_set_; |
115 std::string frame_src_; | 111 std::string frame_src_; |
116 bool deny_xframe_options_; | 112 bool deny_xframe_options_; |
117 bool add_load_time_data_defaults_; | 113 bool add_load_time_data_defaults_; |
118 bool replace_existing_source_; | 114 bool replace_existing_source_; |
119 bool use_gzip_for_all_paths_; | 115 bool use_gzip_; |
120 | 116 |
121 DISALLOW_COPY_AND_ASSIGN(WebUIDataSourceImpl); | 117 DISALLOW_COPY_AND_ASSIGN(WebUIDataSourceImpl); |
122 }; | 118 }; |
123 | 119 |
124 } // namespace content | 120 } // namespace content |
125 | 121 |
126 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ | 122 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ |
OLD | NEW |