NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / webui / translate_internals / translate_internals_handler.h
bloba8417f432c870c10b4b18f8c99b2b9cdd8fa71be
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDLER_H_
8 #include <string>
10 #include "base/callback_list.h"
11 #include "chrome/browser/translate/translate_manager.h"
12 #include "content/public/browser/web_ui_message_handler.h"
13 #include "content/public/common/webplugininfo.h"
15 struct LanguageDetectionDetails;
16 struct TranslateErrorDetails;
17 struct TranslateEventDetails;
19 namespace base {
20 class DictionaryValue;
21 class ListValue;
22 class Value;
25 // The handler class for TranslateInternals page operations.
26 class TranslateInternalsHandler : public content::WebUIMessageHandler,
27 public TranslateManager::Observer {
28 public:
29 TranslateInternalsHandler();
30 virtual ~TranslateInternalsHandler();
32 // content::WebUIMessageHandler methods:
33 virtual void RegisterMessages() OVERRIDE;
35 // TranslateManager::Observer methods:
36 virtual void OnLanguageDetection(
37 const LanguageDetectionDetails& details) OVERRIDE;
38 virtual void OnTranslateError(
39 const TranslateErrorDetails& details) OVERRIDE;
41 // Callback for translate events.
42 virtual void OnTranslateEvent(const TranslateEventDetails& details);
44 private:
45 // Handles the Javascript message 'removePrefItem'. This message is sent
46 // when UI requests to remove an item in the preference.
47 void OnRemovePrefItem(const base::ListValue* args);
49 // Handles the Javascript message 'requestInfo'. This message is sent
50 // when UI needs to show information concerned with the translation.
51 // For now, this returns only prefs to Javascript.
52 // |args| is not used.
53 void OnRequestInfo(const base::ListValue* args);
55 // Sends a messsage to Javascript.
56 void SendMessageToJs(const std::string& message, const base::Value& value);
58 // Sends the current preference to Javascript.
59 void SendPrefsToJs();
61 // Sends the languages currently supported by the server to JavaScript.
62 void SendSupportedLanguagesToJs();
64 // Subscription for translate events comming from the translate language list.
65 scoped_ptr<base::CallbackList<
66 void(const TranslateEventDetails&)>::Subscription> event_subscription_;
68 DISALLOW_COPY_AND_ASSIGN(TranslateInternalsHandler);
71 #endif // CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDLER_H_