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