Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDLER_ H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDLER_ H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDLER_ H_ | 6 #define CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDLER_ H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 void OnTranslateError(const translate::TranslateErrorDetails& details); | 54 void OnTranslateError(const translate::TranslateErrorDetails& details); |
| 55 | 55 |
| 56 // Callback for translate events. | 56 // Callback for translate events. |
| 57 virtual void OnTranslateEvent( | 57 virtual void OnTranslateEvent( |
| 58 const translate::TranslateEventDetails& details); | 58 const translate::TranslateEventDetails& details); |
| 59 | 59 |
| 60 // Handles the Javascript message 'removePrefItem'. This message is sent | 60 // Handles the Javascript message 'removePrefItem'. This message is sent |
| 61 // when UI requests to remove an item in the preference. | 61 // when UI requests to remove an item in the preference. |
| 62 void OnRemovePrefItem(const base::ListValue* args); | 62 void OnRemovePrefItem(const base::ListValue* args); |
| 63 | 63 |
| 64 // Handles the Javascript message 'overrideCountry'. This message is sent | |
| 65 // when UI requests to override the stored country. | |
| 66 void OnOverrideCountry(const base::ListValue* country); | |
| 67 | |
| 64 // Handles the Javascript message 'requestInfo'. This message is sent | 68 // Handles the Javascript message 'requestInfo'. This message is sent |
| 65 // when UI needs to show information concerned with the translation. | 69 // when UI needs to show information concerned with the translation. |
| 66 // For now, this returns only prefs to Javascript. | 70 // For now, this returns only prefs to Javascript. |
| 67 // |args| is not used. | 71 // |args| is not used. |
| 68 void OnRequestInfo(const base::ListValue* args); | 72 void OnRequestInfo(const base::ListValue* args); |
| 69 | 73 |
| 70 // Sends a messsage to Javascript. | 74 // Sends a messsage to Javascript. |
| 71 void SendMessageToJs(const std::string& message, const base::Value& value); | 75 void SendMessageToJs(const std::string& message, const base::Value& value); |
| 72 | 76 |
| 73 // Sends the current preference to Javascript. | 77 // Sends the current preference to Javascript. |
| 74 void SendPrefsToJs(); | 78 void SendPrefsToJs(); |
| 75 | 79 |
| 76 // Sends the languages currently supported by the server to JavaScript. | 80 // Sends the languages currently supported by the server to JavaScript. |
| 77 void SendSupportedLanguagesToJs(); | 81 void SendSupportedLanguagesToJs(); |
| 78 | 82 |
| 83 // Sends the stored permanent country to Javascript. | |
| 84 // |is_update| tells Javascript if the country has been updated or not. | |
|
Alexei Svitkine (slow)
2016/04/20 21:46:44
Nit: Maybe a better name is |was_updated|?
hamelphi
2016/04/21 14:25:09
Done.
| |
| 85 void SendCountryToJs(bool is_update); | |
| 86 | |
| 79 // Subscription for translate events coming from the translate language list. | 87 // Subscription for translate events coming from the translate language list. |
| 80 std::unique_ptr< | 88 std::unique_ptr< |
| 81 translate::TranslateLanguageList::EventCallbackList::Subscription> | 89 translate::TranslateLanguageList::EventCallbackList::Subscription> |
| 82 event_subscription_; | 90 event_subscription_; |
| 83 | 91 |
| 84 // Subscription for translate errors coming from the translate manager. | 92 // Subscription for translate errors coming from the translate manager. |
| 85 std::unique_ptr< | 93 std::unique_ptr< |
| 86 translate::TranslateManager::TranslateErrorCallbackList::Subscription> | 94 translate::TranslateManager::TranslateErrorCallbackList::Subscription> |
| 87 error_subscription_; | 95 error_subscription_; |
| 88 | 96 |
| 89 content::NotificationRegistrar notification_registrar_; | 97 content::NotificationRegistrar notification_registrar_; |
| 90 | 98 |
| 91 DISALLOW_COPY_AND_ASSIGN(TranslateInternalsHandler); | 99 DISALLOW_COPY_AND_ASSIGN(TranslateInternalsHandler); |
| 92 }; | 100 }; |
| 93 | 101 |
| 94 #endif // CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDL ER_H_ | 102 #endif // CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDL ER_H_ |
| OLD | NEW |