Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: chrome/browser/ui/webui/translate_internals/translate_internals_handler.h

Issue 378253002: Fix translate namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing android build errors Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string> 8 #include <string>
9 9
10 #include "base/callback_list.h" 10 #include "base/callback_list.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "components/translate/core/browser/translate_language_list.h" 12 #include "components/translate/core/browser/translate_language_list.h"
13 #include "components/translate/core/browser/translate_manager.h" 13 #include "components/translate/core/browser/translate_manager.h"
14 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
16 #include "content/public/browser/web_ui_message_handler.h" 16 #include "content/public/browser/web_ui_message_handler.h"
17 #include "content/public/common/webplugininfo.h" 17 #include "content/public/common/webplugininfo.h"
18 18
19 namespace translate {
19 struct LanguageDetectionDetails; 20 struct LanguageDetectionDetails;
20 struct TranslateErrorDetails; 21 struct TranslateErrorDetails;
21 struct TranslateEventDetails; 22 struct TranslateEventDetails;
23 }
22 24
23 namespace base { 25 namespace base {
24 class DictionaryValue; 26 class DictionaryValue;
25 class ListValue; 27 class ListValue;
26 class Value; 28 class Value;
27 } 29 }
28 30
29 namespace content { 31 namespace content {
30 class NotificationDetails; 32 class NotificationDetails;
31 class NotificationSource; 33 class NotificationSource;
32 } 34 }
33 35
34 // The handler class for TranslateInternals page operations. 36 // The handler class for TranslateInternals page operations.
35 class TranslateInternalsHandler : public content::WebUIMessageHandler, 37 class TranslateInternalsHandler : public content::WebUIMessageHandler,
36 public content::NotificationObserver { 38 public content::NotificationObserver {
37 public: 39 public:
38 TranslateInternalsHandler(); 40 TranslateInternalsHandler();
39 virtual ~TranslateInternalsHandler(); 41 virtual ~TranslateInternalsHandler();
40 42
41 // content::WebUIMessageHandler methods: 43 // content::WebUIMessageHandler methods:
42 virtual void RegisterMessages() OVERRIDE; 44 virtual void RegisterMessages() OVERRIDE;
43 45
44 private: 46 private:
45 // content::NotificationObserver implementation: 47 // content::NotificationObserver implementation:
46 virtual void Observe(int type, 48 virtual void Observe(int type,
47 const content::NotificationSource& source, 49 const content::NotificationSource& source,
48 const content::NotificationDetails& details) OVERRIDE; 50 const content::NotificationDetails& details) OVERRIDE;
49 51
50 // Callback for translate errors. 52 // Callback for translate errors.
51 void OnTranslateError(const TranslateErrorDetails& details); 53 void OnTranslateError(const translate::TranslateErrorDetails& details);
52 54
53 // Callback for translate events. 55 // Callback for translate events.
54 virtual void OnTranslateEvent(const TranslateEventDetails& details); 56 virtual void OnTranslateEvent(
57 const translate::TranslateEventDetails& details);
55 58
56 // Handles the Javascript message 'removePrefItem'. This message is sent 59 // Handles the Javascript message 'removePrefItem'. This message is sent
57 // when UI requests to remove an item in the preference. 60 // when UI requests to remove an item in the preference.
58 void OnRemovePrefItem(const base::ListValue* args); 61 void OnRemovePrefItem(const base::ListValue* args);
59 62
60 // Handles the Javascript message 'requestInfo'. This message is sent 63 // Handles the Javascript message 'requestInfo'. This message is sent
61 // when UI needs to show information concerned with the translation. 64 // when UI needs to show information concerned with the translation.
62 // For now, this returns only prefs to Javascript. 65 // For now, this returns only prefs to Javascript.
63 // |args| is not used. 66 // |args| is not used.
64 void OnRequestInfo(const base::ListValue* args); 67 void OnRequestInfo(const base::ListValue* args);
65 68
66 // Sends a messsage to Javascript. 69 // Sends a messsage to Javascript.
67 void SendMessageToJs(const std::string& message, const base::Value& value); 70 void SendMessageToJs(const std::string& message, const base::Value& value);
68 71
69 // Sends the current preference to Javascript. 72 // Sends the current preference to Javascript.
70 void SendPrefsToJs(); 73 void SendPrefsToJs();
71 74
72 // Sends the languages currently supported by the server to JavaScript. 75 // Sends the languages currently supported by the server to JavaScript.
73 void SendSupportedLanguagesToJs(); 76 void SendSupportedLanguagesToJs();
74 77
75 // Subscription for translate events coming from the translate language list. 78 // Subscription for translate events coming from the translate language list.
76 scoped_ptr<TranslateLanguageList::EventCallbackList::Subscription> 79 scoped_ptr<translate::TranslateLanguageList::EventCallbackList::Subscription>
77 event_subscription_; 80 event_subscription_;
78 81
79 // Subscription for translate errors coming from the translate manager. 82 // Subscription for translate errors coming from the translate manager.
80 scoped_ptr<TranslateManager::TranslateErrorCallbackList::Subscription> 83 scoped_ptr<
84 translate::TranslateManager::TranslateErrorCallbackList::Subscription>
81 error_subscription_; 85 error_subscription_;
82 86
83 content::NotificationRegistrar notification_registrar_; 87 content::NotificationRegistrar notification_registrar_;
84 88
85 DISALLOW_COPY_AND_ASSIGN(TranslateInternalsHandler); 89 DISALLOW_COPY_AND_ASSIGN(TranslateInternalsHandler);
86 }; 90 };
87 91
88 #endif // CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDL ER_H_ 92 #endif // CHROME_BROWSER_UI_WEBUI_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HANDL ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698