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. | 21 // Adds a string and its equivalent to our dictionary. |
22 void AddString(const std::string& name, const string16& value); | 22 void AddString(const std::string& name, const string16& value); |
23 | 23 |
24 // Adds a name and its equivaled localized string to our dictionary. | 24 // Adds a name and its equivaled localized string to our dictionary. |
25 void AddLocalizedString(const std::string& name, int ids); | 25 void AddLocalizedString(const std::string& name, int ids); |
26 | 26 |
| 27 // Adds a name and its localized string value to our dictionary. |
| 28 void AddLocalizedString(const std::string& name, |
| 29 const string16& localized_string); |
| 30 |
27 // Completes a request by sending our dictionary of localized strings. | 31 // Completes a request by sending our dictionary of localized strings. |
28 void SendLocalizedStringsAsJSON(int request_id); | 32 void SendLocalizedStringsAsJSON(int request_id); |
29 | 33 |
30 // Completes a request by sending the file specified by |idr|. | 34 // Completes a request by sending the file specified by |idr|. |
31 void SendFromResourceBundle(int request_id, int idr); | 35 void SendFromResourceBundle(int request_id, int idr); |
32 | 36 |
33 protected: | 37 protected: |
34 virtual ~ChromeWebUIDataSource(); | 38 virtual ~ChromeWebUIDataSource(); |
35 | 39 |
36 private: | 40 private: |
37 DictionaryValue localized_strings_; | 41 DictionaryValue localized_strings_; |
38 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIDataSource); | 42 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIDataSource); |
39 }; | 43 }; |
40 | 44 |
41 | 45 |
42 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ | 46 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ |
43 | 47 |
OLD | NEW |