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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "content/browser/webui/url_data_manager.h" | 15 #include "content/browser/webui/url_data_manager.h" |
16 #include "content/browser/webui/url_data_source_impl.h" | 16 #include "content/browser/webui/url_data_source_impl.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 #include "content/public/browser/url_data_source.h" | 18 #include "content/public/browser/url_data_source.h" |
19 #include "content/public/browser/web_ui_data_source.h" | 19 #include "content/public/browser/web_ui_data_source.h" |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 // A data source that can help with implementing the common operations | 23 // A data source that can help with implementing the common operations |
24 // needed by the chrome WEBUI settings/history/downloads pages. | 24 // needed by the chrome WEBUI settings/history/downloads pages. |
25 class CONTENT_EXPORT WebUIDataSourceImpl | 25 class CONTENT_EXPORT WebUIDataSourceImpl |
26 : public NON_EXPORTED_BASE(URLDataSourceImpl), | 26 : public NON_EXPORTED_BASE(URLDataSourceImpl), |
27 public NON_EXPORTED_BASE(WebUIDataSource) { | 27 public NON_EXPORTED_BASE(WebUIDataSource) { |
28 public: | 28 public: |
29 // WebUIDataSource implementation: | 29 // WebUIDataSource implementation: |
30 virtual void AddString(const std::string& name, | 30 void AddString(const std::string& name, const base::string16& value) override; |
31 const base::string16& value) override; | 31 void AddString(const std::string& name, const std::string& value) override; |
32 virtual void AddString(const std::string& name, | 32 void AddLocalizedString(const std::string& name, int ids) override; |
33 const std::string& value) override; | 33 void AddLocalizedStrings( |
34 virtual void AddLocalizedString(const std::string& name, int ids) override; | |
35 virtual void AddLocalizedStrings( | |
36 const base::DictionaryValue& localized_strings) override; | 34 const base::DictionaryValue& localized_strings) override; |
37 virtual void AddBoolean(const std::string& name, bool value) override; | 35 void AddBoolean(const std::string& name, bool value) override; |
38 virtual void SetJsonPath(const std::string& path) override; | 36 void SetJsonPath(const std::string& path) override; |
39 virtual void AddResourcePath(const std::string &path, | 37 void AddResourcePath(const std::string& path, int resource_id) override; |
40 int resource_id) override; | 38 void SetDefaultResource(int resource_id) override; |
41 virtual void SetDefaultResource(int resource_id) override; | 39 void SetRequestFilter( |
42 virtual void SetRequestFilter( | |
43 const WebUIDataSource::HandleRequestCallback& callback) override; | 40 const WebUIDataSource::HandleRequestCallback& callback) override; |
44 virtual void DisableReplaceExistingSource() override; | 41 void DisableReplaceExistingSource() override; |
45 virtual void DisableContentSecurityPolicy() override; | 42 void DisableContentSecurityPolicy() override; |
46 virtual void OverrideContentSecurityPolicyObjectSrc( | 43 void OverrideContentSecurityPolicyObjectSrc(const std::string& data) override; |
47 const std::string& data) override; | 44 void OverrideContentSecurityPolicyFrameSrc(const std::string& data) override; |
48 virtual void OverrideContentSecurityPolicyFrameSrc( | 45 void DisableDenyXFrameOptions() override; |
49 const std::string& data) override; | |
50 virtual void DisableDenyXFrameOptions() override; | |
51 | 46 |
52 protected: | 47 protected: |
53 virtual ~WebUIDataSourceImpl(); | 48 ~WebUIDataSourceImpl() override; |
54 | 49 |
55 // Completes a request by sending our dictionary of localized strings. | 50 // Completes a request by sending our dictionary of localized strings. |
56 void SendLocalizedStringsAsJSON( | 51 void SendLocalizedStringsAsJSON( |
57 const URLDataSource::GotDataCallback& callback); | 52 const URLDataSource::GotDataCallback& callback); |
58 | 53 |
59 // Completes a request by sending the file specified by |idr|. | 54 // Completes a request by sending the file specified by |idr|. |
60 void SendFromResourceBundle( | 55 void SendFromResourceBundle( |
61 const URLDataSource::GotDataCallback& callback, int idr); | 56 const URLDataSource::GotDataCallback& callback, int idr); |
62 | 57 |
63 private: | 58 private: |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 bool deny_xframe_options_; | 94 bool deny_xframe_options_; |
100 bool disable_set_font_strings_; | 95 bool disable_set_font_strings_; |
101 bool replace_existing_source_; | 96 bool replace_existing_source_; |
102 | 97 |
103 DISALLOW_COPY_AND_ASSIGN(WebUIDataSourceImpl); | 98 DISALLOW_COPY_AND_ASSIGN(WebUIDataSourceImpl); |
104 }; | 99 }; |
105 | 100 |
106 } // content | 101 } // content |
107 | 102 |
108 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ | 103 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ |
OLD | NEW |