| 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 | |
| 31 // Completes a request by sending our dictionary of localized strings. | 27 // Completes a request by sending our dictionary of localized strings. |
| 32 void SendLocalizedStringsAsJSON(int request_id); | 28 void SendLocalizedStringsAsJSON(int request_id); |
| 33 | 29 |
| 34 // Completes a request by sending the file specified by |idr|. | 30 // Completes a request by sending the file specified by |idr|. |
| 35 void SendFromResourceBundle(int request_id, int idr); | 31 void SendFromResourceBundle(int request_id, int idr); |
| 36 | 32 |
| 37 protected: | 33 protected: |
| 38 virtual ~ChromeWebUIDataSource(); | 34 virtual ~ChromeWebUIDataSource(); |
| 39 | 35 |
| 40 private: | 36 private: |
| 41 DictionaryValue localized_strings_; | 37 DictionaryValue localized_strings_; |
| 42 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIDataSource); | 38 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIDataSource); |
| 43 }; | 39 }; |
| 44 | 40 |
| 45 | 41 |
| 46 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ | 42 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ |
| 47 | 43 |
| OLD | NEW |