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 <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/message_loop.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
16 | 17 |
17 // A data source that can help with implementing the common operations | 18 // A data source that can help with implementing the common operations |
18 // needed by the chrome WEBUI settings/history/downloads pages. | 19 // needed by the chrome WEBUI settings/history/downloads pages. |
19 class ChromeWebUIDataSource : public ChromeURLDataManager::DataSource { | 20 class ChromeWebUIDataSource : public ChromeURLDataManager::DataSource { |
20 public: | 21 public: |
21 explicit ChromeWebUIDataSource(const std::string& source_name); | 22 explicit ChromeWebUIDataSource(const std::string& source_name); |
| 23 ChromeWebUIDataSource(const std::string& source_name, MessageLoop* loop); |
22 | 24 |
23 // Adds a string and its equivalent to our dictionary. | 25 // Adds a string and its equivalent to our dictionary. |
24 void AddString(const std::string& name, const string16& value); | 26 void AddString(const std::string& name, const string16& value); |
25 | 27 |
26 // Adds a name and its equivaled localized string to our dictionary. | 28 // Adds a name and its equivaled localized string to our dictionary. |
27 void AddLocalizedString(const std::string& name, int ids); | 29 void AddLocalizedString(const std::string& name, int ids); |
28 | 30 |
29 // Sets the path which will return the JSON strings. | 31 // Sets the path which will return the JSON strings. |
30 void set_json_path(const std::string& path) { json_path_ = path; } | 32 void set_json_path(const std::string& path) { json_path_ = path; } |
31 | 33 |
(...skipping 24 matching lines...) Expand all Loading... |
56 | 58 |
57 private: | 59 private: |
58 int default_resource_; | 60 int default_resource_; |
59 std::string json_path_; | 61 std::string json_path_; |
60 std::map<std::string, int> path_to_idr_map_; | 62 std::map<std::string, int> path_to_idr_map_; |
61 DictionaryValue localized_strings_; | 63 DictionaryValue localized_strings_; |
62 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIDataSource); | 64 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIDataSource); |
63 }; | 65 }; |
64 | 66 |
65 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ | 67 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_DATA_SOURCE_H_ |
OLD | NEW |