Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / webui / translate_internals / translate_internals_handler.h
blobe6a3444d8f92d104739b155138b03f8df0b128ab
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 "chrome/browser/translate/translate_manager.h"
11 #include "content/public/browser/web_ui_message_handler.h"
12 #include "content/public/common/webplugininfo.h"
14 struct LanguageDetectionDetails;
15 struct TranslateErrorDetails;
16 struct TranslateEventDetails;
18 namespace base {
19 class DictionaryValue;
20 class ListValue;
21 class Value;
24 // The handler class for TranslateInternals page operations.
25 class TranslateInternalsHandler : public content::WebUIMessageHandler,
26 public TranslateManager::Observer {
27 public:
28 TranslateInternalsHandler();
29 virtual ~TranslateInternalsHandler();
31 // content::WebUIMessageHandler methods:
32 virtual void RegisterMessages() OVERRIDE;
34 // TranslateManager::Observer methods:
35 virtual void OnLanguageDetection(
36 const LanguageDetectionDetails& details) OVERRIDE;
37 virtual void OnTranslateError(
38 const TranslateErrorDetails& details) OVERRIDE;
39 virtual void OnTranslateEvent(
40 const TranslateEventDetails& details) OVERRIDE;
42 private:
43 // Handles the Javascript message 'removePrefItem'. This message is sent
44 // when UI requests to remove an item in the preference.
45 void OnRemovePrefItem(const base::ListValue* args);
47 // Handles the Javascript message 'requestInfo'. This message is sent
48 // when UI needs to show information concerned with the translation.
49 // For now, this returns only prefs to Javascript.
50 // |args| is not used.
51 void OnRequestInfo(const base::ListValue* args);
53 // Sends a messsage to Javascript.
54 void SendMessageToJs(const std::string& message, const base::Value& value);
56 // Sends the current preference to Javascript.
57 void SendPrefsToJs();
59 // Sends the languages currently supported by the server to JavaScript.
60 void SendSupportedLanguagesToJs();
62 DISALLOW_COPY_AND_ASSIGN(TranslateInternalsHandler);
65 #endif // CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDLER_H_