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