| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/webui/options/language_options_handler_common.h" | 11 #include "chrome/browser/ui/webui/options/language_options_handler_common.h" |
| 10 | 12 |
| 13 namespace base { |
| 14 class ListValue; |
| 15 } |
| 16 |
| 11 namespace options { | 17 namespace options { |
| 12 | 18 |
| 13 // Language options UI page handler for non-Chrome OS platforms. For Chrome OS, | 19 // Language options UI page handler for non-Chrome OS platforms. For Chrome OS, |
| 14 // see chromeos::CrosLanguageOptionsHandler. | 20 // see chromeos::CrosLanguageOptionsHandler. |
| 15 class LanguageOptionsHandler : public LanguageOptionsHandlerCommon { | 21 class LanguageOptionsHandler : public LanguageOptionsHandlerCommon { |
| 16 public: | 22 public: |
| 17 LanguageOptionsHandler(); | 23 LanguageOptionsHandler(); |
| 18 ~LanguageOptionsHandler() override; | 24 ~LanguageOptionsHandler() override; |
| 19 | 25 |
| 20 // OptionsPageUIHandler implementation. | 26 // OptionsPageUIHandler implementation. |
| 21 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 27 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
| 22 | 28 |
| 23 // WebUIMessageHandler implementation. | 29 // WebUIMessageHandler implementation. |
| 24 void RegisterMessages() override; | 30 void RegisterMessages() override; |
| 25 | 31 |
| 26 // The following static method is public for ease of testing. | 32 // The following static method is public for ease of testing. |
| 27 | 33 |
| 28 // Gets the list of languages from the given input descriptors. | 34 // Gets the list of languages from the given input descriptors. |
| 29 // The return value will look like: | 35 // The return value will look like: |
| 30 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, | 36 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, |
| 31 // ...] | 37 // ...] |
| 32 static base::ListValue* GetLanguageList(); | 38 static std::unique_ptr<base::ListValue> GetLanguageList(); |
| 33 | 39 |
| 34 private: | 40 private: |
| 35 // LanguageOptionsHandlerCommon implementation. | 41 // LanguageOptionsHandlerCommon implementation. |
| 36 void SetApplicationLocale(const std::string& language_code) override; | 42 void SetApplicationLocale(const std::string& language_code) override; |
| 37 | 43 |
| 38 // Called when the restart button is clicked. | 44 // Called when the restart button is clicked. |
| 39 void RestartCallback(const base::ListValue* args); | 45 void RestartCallback(const base::ListValue* args); |
| 40 | 46 |
| 41 DISALLOW_COPY_AND_ASSIGN(LanguageOptionsHandler); | 47 DISALLOW_COPY_AND_ASSIGN(LanguageOptionsHandler); |
| 42 }; | 48 }; |
| 43 | 49 |
| 44 } // namespace options | 50 } // namespace options |
| 45 | 51 |
| 46 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ | 52 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_LANGUAGE_OPTIONS_HANDLER_H_ |
| OLD | NEW |