Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(656)

Side by Side Diff: content/browser/webui/web_ui_data_source_impl.h

Issue 2544683002: [MD settings] i18n source stream filtering (Closed)
Patch Set: review nits Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 void SetDefaultResource(int resource_id) override; 43 void SetDefaultResource(int resource_id) override;
44 void SetRequestFilter( 44 void SetRequestFilter(
45 const WebUIDataSource::HandleRequestCallback& callback) override; 45 const WebUIDataSource::HandleRequestCallback& callback) override;
46 void DisableReplaceExistingSource() override; 46 void DisableReplaceExistingSource() override;
47 void DisableContentSecurityPolicy() override; 47 void DisableContentSecurityPolicy() override;
48 void OverrideContentSecurityPolicyScriptSrc(const std::string& data) override; 48 void OverrideContentSecurityPolicyScriptSrc(const std::string& data) override;
49 void OverrideContentSecurityPolicyObjectSrc(const std::string& data) override; 49 void OverrideContentSecurityPolicyObjectSrc(const std::string& data) override;
50 void OverrideContentSecurityPolicyChildSrc(const std::string& data) override; 50 void OverrideContentSecurityPolicyChildSrc(const std::string& data) override;
51 void DisableDenyXFrameOptions() override; 51 void DisableDenyXFrameOptions() override;
52 void DisableI18nAndUseGzipForAllPaths() override; 52 void DisableI18nAndUseGzipForAllPaths() override;
53 const ui::TemplateReplacements* GetReplacements() const override;
54
55 // Add the locale to the load time data defaults. May be called repeatedly.
56 void EnsureLoadTimeDataDefaultsAdded();
53 57
54 // When DisableI18nAndUseGzipForAllPaths is enabled, exclude the given |path|. 58 // When DisableI18nAndUseGzipForAllPaths is enabled, exclude the given |path|.
55 void ExcludePathFromGzip(const std::string& path); 59 void ExcludePathFromGzip(const std::string& path);
56 60
57 bool IsWebUIDataSourceImpl() const override; 61 bool IsWebUIDataSourceImpl() const override;
58 62
59 protected: 63 protected:
60 ~WebUIDataSourceImpl() override; 64 ~WebUIDataSourceImpl() override;
61 65
62 // Completes a request by sending our dictionary of localized strings. 66 // Completes a request by sending our dictionary of localized strings.
(...skipping 23 matching lines...) Expand all
86 } 90 }
87 91
88 // The name of this source. 92 // The name of this source.
89 // E.g., for favicons, this could be "favicon", which results in paths for 93 // E.g., for favicons, this could be "favicon", which results in paths for
90 // specific resources like "favicon/34" getting sent to this source. 94 // specific resources like "favicon/34" getting sent to this source.
91 std::string source_name_; 95 std::string source_name_;
92 int default_resource_; 96 int default_resource_;
93 std::string json_path_; 97 std::string json_path_;
94 std::map<std::string, int> path_to_idr_map_; 98 std::map<std::string, int> path_to_idr_map_;
95 std::unordered_set<std::string> excluded_paths_; 99 std::unordered_set<std::string> excluded_paths_;
100 // The replacements are initiallized in the main thread and then used in the
101 // IO thread. The map is safe to read from multiple threads as long as no
102 // futher changes are made to it after initialization.
103 ui::TemplateReplacements replacements_;
96 // The |replacements_| is intended to replace |localized_strings_|. 104 // The |replacements_| is intended to replace |localized_strings_|.
97 // TODO(dschuyler): phase out |localized_strings_| in Q1 2016. (Or rename 105 // TODO(dschuyler): phase out |localized_strings_| in Q1 2017. (Or rename
98 // to |load_time_flags_| if the usage is reduced to storing flags only). 106 // to |load_time_flags_| if the usage is reduced to storing flags only).
99 ui::TemplateReplacements replacements_;
100 base::DictionaryValue localized_strings_; 107 base::DictionaryValue localized_strings_;
101 WebUIDataSource::HandleRequestCallback filter_callback_; 108 WebUIDataSource::HandleRequestCallback filter_callback_;
102 bool add_csp_; 109 bool add_csp_;
103 bool script_src_set_; 110 bool script_src_set_;
104 std::string script_src_; 111 std::string script_src_;
105 bool object_src_set_; 112 bool object_src_set_;
106 std::string object_src_; 113 std::string object_src_;
107 bool frame_src_set_; 114 bool frame_src_set_;
108 std::string frame_src_; 115 std::string frame_src_;
109 bool deny_xframe_options_; 116 bool deny_xframe_options_;
110 bool add_load_time_data_defaults_; 117 bool add_load_time_data_defaults_;
111 bool replace_existing_source_; 118 bool replace_existing_source_;
112 bool use_gzip_for_all_paths_; 119 bool use_gzip_for_all_paths_;
113 120
114 DISALLOW_COPY_AND_ASSIGN(WebUIDataSourceImpl); 121 DISALLOW_COPY_AND_ASSIGN(WebUIDataSourceImpl);
115 }; 122 };
116 123
117 } // namespace content 124 } // namespace content
118 125
119 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ 126 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/webui/url_data_source_impl.cc ('k') | content/browser/webui/web_ui_data_source_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698