OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
14 | 14 |
15 // A data source that can help with implementing the common operations | 15 // A data source that can help with implementing the common operations |
16 // needed by the chrome WEBUI settings/history/downloads pages. | 16 // needed by the chrome WEBUI settings/history/downloads pages. |
17 class ChromeWebUIDataSource : public ChromeURLDataManager::DataSource { | 17 class ChromeWebUIDataSource : public ChromeURLDataManager::DataSource { |
18 public: | 18 public: |
19 explicit ChromeWebUIDataSource(const std::string& source_name); | 19 explicit ChromeWebUIDataSource(const std::string& source_name); |
20 | 20 |
| 21 // Adds a string and its equivalent to our dictionary. |
| 22 void AddString(const std::string& name, const string16& value); |
| 23 |
21 // Adds a name and its equivaled localized string to our dictionary. | 24 // Adds a name and its equivaled localized string to our dictionary. |
22 void AddLocalizedString(const std::string& name, int ids); | 25 void AddLocalizedString(const std::string& name, int ids); |
23 | 26 |
24 // Completes a request by sending our dictionary of localized strings. | 27 // Completes a request by sending our dictionary of localized strings. |
25 void SendLocalizedStringsAsJSON(int request_id); | 28 void SendLocalizedStringsAsJSON(int request_id); |
26 | 29 |
27 // Completes a request by sending the file specified by |idr|. | 30 // Completes a request by sending the file specified by |idr|. |
28 void SendFromResourceBundle(int request_id, int idr); | 31 void SendFromResourceBundle(int request_id, int idr); |
29 | 32 |
30 protected: | 33 protected: |
31 virtual ~ChromeWebUIDataSource(); | 34 virtual ~ChromeWebUIDataSource(); |
32 | 35 |
33 private: | 36 private: |
34 DictionaryValue localized_strings_; | 37 DictionaryValue localized_strings_; |
35 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIDataSource); | 38 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIDataSource); |
36 }; | 39 }; |
37 | 40 |
38 | 41 |
39 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ | 42 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ |
40 | 43 |
OLD | NEW |