| 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 CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Adds a mapping between a path name and a resource to return. | 46 // Adds a mapping between a path name and a resource to return. |
| 47 void add_resource_path(const std::string &path, int resource_id) { | 47 void add_resource_path(const std::string &path, int resource_id) { |
| 48 path_to_idr_map_[path] = resource_id; | 48 path_to_idr_map_[path] = resource_id; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Sets the resource to returned when no other paths match. | 51 // Sets the resource to returned when no other paths match. |
| 52 void set_default_resource(int resource_id) { | 52 void set_default_resource(int resource_id) { |
| 53 default_resource_ = resource_id; | 53 default_resource_ = resource_id; |
| 54 } | 54 } |
| 55 | 55 |
| 56 protected: |
| 56 virtual ~ChromeWebUIDataSource(); | 57 virtual ~ChromeWebUIDataSource(); |
| 57 | 58 |
| 58 protected: | |
| 59 // Completes a request by sending our dictionary of localized strings. | 59 // Completes a request by sending our dictionary of localized strings. |
| 60 void SendLocalizedStringsAsJSON(int request_id); | 60 void SendLocalizedStringsAsJSON(int request_id); |
| 61 | 61 |
| 62 // Completes a request by sending the file specified by |idr|. | 62 // Completes a request by sending the file specified by |idr|. |
| 63 void SendFromResourceBundle(int request_id, int idr); | 63 void SendFromResourceBundle(int request_id, int idr); |
| 64 | 64 |
| 65 // ChromeURLDataManager | 65 // ChromeURLDataManager |
| 66 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; | 66 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; |
| 67 virtual void StartDataRequest(const std::string& path, | 67 virtual void StartDataRequest(const std::string& path, |
| 68 bool is_incognito, | 68 bool is_incognito, |
| 69 int request_id) OVERRIDE; | 69 int request_id) OVERRIDE; |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 int default_resource_; | 72 int default_resource_; |
| 73 bool json_js_format_v2_; | 73 bool json_js_format_v2_; |
| 74 std::string json_path_; | 74 std::string json_path_; |
| 75 std::map<std::string, int> path_to_idr_map_; | 75 std::map<std::string, int> path_to_idr_map_; |
| 76 DictionaryValue localized_strings_; | 76 DictionaryValue localized_strings_; |
| 77 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIDataSource); | 77 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIDataSource); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ | 80 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ |
| OLD | NEW |