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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 void SetJsonPath(const std::string& path) override; | 37 void SetJsonPath(const std::string& path) override; |
38 void AddResourcePath(const std::string& path, int resource_id) override; | 38 void AddResourcePath(const std::string& path, int resource_id) override; |
39 void SetDefaultResource(int resource_id) override; | 39 void SetDefaultResource(int resource_id) override; |
40 void SetRequestFilter( | 40 void SetRequestFilter( |
41 const WebUIDataSource::HandleRequestCallback& callback) override; | 41 const WebUIDataSource::HandleRequestCallback& callback) override; |
42 void DisableReplaceExistingSource() override; | 42 void DisableReplaceExistingSource() override; |
43 void DisableContentSecurityPolicy() override; | 43 void DisableContentSecurityPolicy() override; |
44 void OverrideContentSecurityPolicyObjectSrc(const std::string& data) override; | 44 void OverrideContentSecurityPolicyObjectSrc(const std::string& data) override; |
45 void OverrideContentSecurityPolicyChildSrc(const std::string& data) override; | 45 void OverrideContentSecurityPolicyChildSrc(const std::string& data) override; |
46 void DisableDenyXFrameOptions() override; | 46 void DisableDenyXFrameOptions() override; |
| 47 void AddPreloadHeader(const std::string& preload_header) override; |
47 | 48 |
48 protected: | 49 protected: |
49 ~WebUIDataSourceImpl() override; | 50 ~WebUIDataSourceImpl() override; |
50 | 51 |
51 // Completes a request by sending our dictionary of localized strings. | 52 // Completes a request by sending our dictionary of localized strings. |
52 void SendLocalizedStringsAsJSON( | 53 void SendLocalizedStringsAsJSON( |
53 const URLDataSource::GotDataCallback& callback); | 54 const URLDataSource::GotDataCallback& callback); |
54 | 55 |
55 private: | 56 private: |
56 class InternalDataSource; | 57 class InternalDataSource; |
(...skipping 18 matching lines...) Expand all Loading... |
75 add_load_time_data_defaults_ = false; | 76 add_load_time_data_defaults_ = false; |
76 } | 77 } |
77 | 78 |
78 // The name of this source. | 79 // The name of this source. |
79 // E.g., for favicons, this could be "favicon", which results in paths for | 80 // E.g., for favicons, this could be "favicon", which results in paths for |
80 // specific resources like "favicon/34" getting sent to this source. | 81 // specific resources like "favicon/34" getting sent to this source. |
81 std::string source_name_; | 82 std::string source_name_; |
82 int default_resource_; | 83 int default_resource_; |
83 std::string json_path_; | 84 std::string json_path_; |
84 std::map<std::string, int> path_to_idr_map_; | 85 std::map<std::string, int> path_to_idr_map_; |
| 86 |
| 87 const std::map<std::string, int>& path_to_idr_map() const override; |
| 88 |
85 // The |replacements_| is intended to replace |localized_strings_|. | 89 // The |replacements_| is intended to replace |localized_strings_|. |
86 // TODO(dschuyler): phase out |localized_strings_| in Q1 2016. (Or rename | 90 // TODO(dschuyler): phase out |localized_strings_| in Q1 2016. (Or rename |
87 // to |load_time_flags_| if the usage is reduced to storing flags only). | 91 // to |load_time_flags_| if the usage is reduced to storing flags only). |
88 ui::TemplateReplacements replacements_; | 92 ui::TemplateReplacements replacements_; |
89 base::DictionaryValue localized_strings_; | 93 base::DictionaryValue localized_strings_; |
90 WebUIDataSource::HandleRequestCallback filter_callback_; | 94 WebUIDataSource::HandleRequestCallback filter_callback_; |
91 bool add_csp_; | 95 bool add_csp_; |
92 bool object_src_set_; | 96 bool object_src_set_; |
93 std::string object_src_; | 97 std::string object_src_; |
94 bool frame_src_set_; | 98 bool frame_src_set_; |
95 std::string frame_src_; | 99 std::string frame_src_; |
96 bool deny_xframe_options_; | 100 bool deny_xframe_options_; |
97 bool add_load_time_data_defaults_; | 101 bool add_load_time_data_defaults_; |
98 bool replace_existing_source_; | 102 bool replace_existing_source_; |
| 103 std::vector<std::string> preload_headers_; |
99 | 104 |
100 DISALLOW_COPY_AND_ASSIGN(WebUIDataSourceImpl); | 105 DISALLOW_COPY_AND_ASSIGN(WebUIDataSourceImpl); |
101 }; | 106 }; |
102 | 107 |
103 } // namespace content | 108 } // namespace content |
104 | 109 |
105 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ | 110 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ |
OLD | NEW |