Index: ios/web/webui/web_ui_ios_data_source_impl.h |
diff --git a/ios/web/webui/web_ui_ios_data_source_impl.h b/ios/web/webui/web_ui_ios_data_source_impl.h |
index db93781104bc2753c8e698c5b0147a2e0607bed9..b060829fe7d3ad446edc6ea66b7705acf96b9b89 100644 |
--- a/ios/web/webui/web_ui_ios_data_source_impl.h |
+++ b/ios/web/webui/web_ui_ios_data_source_impl.h |
@@ -16,6 +16,7 @@ |
#include "ios/web/public/web_ui_ios_data_source.h" |
#include "ios/web/webui/url_data_manager_ios.h" |
#include "ios/web/webui/url_data_source_ios_impl.h" |
+#include "ui/base/template_expressions.h" |
namespace web { |
@@ -26,6 +27,8 @@ class WebUIIOSDataSourceImpl : public URLDataSourceIOSImpl, |
void AddString(const std::string& name, const base::string16& value) override; |
void AddString(const std::string& name, const std::string& value) override; |
void AddLocalizedString(const std::string& name, int ids) override; |
+ void AddLocalizedStrings( |
+ const base::DictionaryValue& localized_strings) override; |
void AddBoolean(const std::string& name, bool value) override; |
void SetJsonPath(const std::string& path) override; |
void AddResourcePath(const std::string& path, int resource_id) override; |
@@ -40,7 +43,8 @@ class WebUIIOSDataSourceImpl : public URLDataSourceIOSImpl, |
const URLDataSourceIOS::GotDataCallback& callback); |
// Completes a request by sending the file specified by |idr|. |
- void SendFromResourceBundle(const URLDataSourceIOS::GotDataCallback& callback, |
+ void SendFromResourceBundle(const std::string& path, |
Eugene But (OOO till 7-30)
2017/06/21 00:21:46
What is |path|? Is it related to |idr|? Please exp
michaeldo
2017/06/21 16:56:26
Done.
|
+ const URLDataSourceIOS::GotDataCallback& callback, |
int idr); |
private: |
@@ -51,6 +55,9 @@ class WebUIIOSDataSourceImpl : public URLDataSourceIOSImpl, |
explicit WebUIIOSDataSourceImpl(const std::string& source_name); |
+ // Add the locale to the load time data defaults. May be called repeatedly. |
Eugene But (OOO till 7-30)
2017/06/21 00:21:46
s/Add/Adds
michaeldo
2017/06/21 16:56:26
Done.
|
+ void EnsureLoadTimeDataDefaultsAdded(); |
+ |
// Methods that match URLDataSource which are called by |
// InternalDataSource. |
std::string GetSource() const; |
@@ -65,8 +72,14 @@ class WebUIIOSDataSourceImpl : public URLDataSourceIOSImpl, |
int default_resource_; |
std::string json_path_; |
std::map<std::string, int> path_to_idr_map_; |
+ // The replacements are initiallized in the main thread and then used in the |
+ // IO thread. The map is safe to read from multiple threads as long as no |
+ // futher changes are made to it after initialization. |
+ ui::TemplateReplacements replacements_; |
+ // The |replacements_| is intended to replace |localized_strings_|. |
base::DictionaryValue localized_strings_; |
bool deny_xframe_options_; |
+ bool add_load_time_data_defaults_; |
bool replace_existing_source_; |
DISALLOW_COPY_AND_ASSIGN(WebUIIOSDataSourceImpl); |