| 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 28 matching lines...) Expand all Loading... |
| 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 DisableI18nAndUseGzipForAllPaths() override; | 47 void DisableI18nAndUseGzipForAllPaths() override; |
| 48 | 48 |
| 49 virtual bool IsGzipped(const std::string& path) const; |
| 50 |
| 49 protected: | 51 protected: |
| 52 explicit WebUIDataSourceImpl(const std::string& source_name); |
| 50 ~WebUIDataSourceImpl() override; | 53 ~WebUIDataSourceImpl() override; |
| 51 | 54 |
| 52 // Completes a request by sending our dictionary of localized strings. | 55 // Completes a request by sending our dictionary of localized strings. |
| 53 void SendLocalizedStringsAsJSON( | 56 void SendLocalizedStringsAsJSON( |
| 54 const URLDataSource::GotDataCallback& callback); | 57 const URLDataSource::GotDataCallback& callback); |
| 55 | 58 |
| 56 private: | 59 private: |
| 57 class InternalDataSource; | 60 class InternalDataSource; |
| 58 friend class InternalDataSource; | 61 friend class InternalDataSource; |
| 59 friend class WebUIDataSource; | 62 friend class WebUIDataSource; |
| 60 friend class WebUIDataSourceTest; | 63 friend class WebUIDataSourceTest; |
| 61 | 64 |
| 62 explicit WebUIDataSourceImpl(const std::string& source_name); | |
| 63 | |
| 64 // Methods that match URLDataSource which are called by | 65 // Methods that match URLDataSource which are called by |
| 65 // InternalDataSource. | 66 // InternalDataSource. |
| 66 std::string GetSource() const; | 67 std::string GetSource() const; |
| 67 std::string GetMimeType(const std::string& path) const; | 68 std::string GetMimeType(const std::string& path) const; |
| 68 void StartDataRequest( | 69 void StartDataRequest( |
| 69 const std::string& path, | 70 const std::string& path, |
| 70 const ResourceRequestInfo::WebContentsGetter& wc_getter, | 71 const ResourceRequestInfo::WebContentsGetter& wc_getter, |
| 71 const URLDataSource::GotDataCallback& callback); | 72 const URLDataSource::GotDataCallback& callback); |
| 72 | 73 |
| 73 // Note: this must be called before StartDataRequest() to have an effect. | 74 // Note: this must be called before StartDataRequest() to have an effect. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 97 bool add_load_time_data_defaults_; | 98 bool add_load_time_data_defaults_; |
| 98 bool replace_existing_source_; | 99 bool replace_existing_source_; |
| 99 bool use_gzip_for_all_paths_; | 100 bool use_gzip_for_all_paths_; |
| 100 | 101 |
| 101 DISALLOW_COPY_AND_ASSIGN(WebUIDataSourceImpl); | 102 DISALLOW_COPY_AND_ASSIGN(WebUIDataSourceImpl); |
| 102 }; | 103 }; |
| 103 | 104 |
| 104 } // namespace content | 105 } // namespace content |
| 105 | 106 |
| 106 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ | 107 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_DATA_SOURCE_IMPL_H_ |
| OLD | NEW |