OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_RENDERER_TRANSLATE_HELPER_H_ | 5 #ifndef CHROME_RENDERER_TRANSLATE_HELPER_H_ |
6 #define CHROME_RENDERER_TRANSLATE_HELPER_H_ | 6 #define CHROME_RENDERER_TRANSLATE_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // The tag may specify several languages, the first one is returned. | 76 // The tag may specify several languages, the first one is returned. |
77 // Example of such meta-tag: | 77 // Example of such meta-tag: |
78 // <meta http-equiv="content-language" content="en, fr"> | 78 // <meta http-equiv="content-language" content="en, fr"> |
79 static std::string GetPageLanguageFromMetaTag(WebKit::WebDocument* document); | 79 static std::string GetPageLanguageFromMetaTag(WebKit::WebDocument* document); |
80 | 80 |
81 // Returns the ISO 639_1 language code of the specified |text|, or 'unknown' | 81 // Returns the ISO 639_1 language code of the specified |text|, or 'unknown' |
82 // if it failed. | 82 // if it failed. |
83 static std::string DetermineTextLanguage(const string16& text); | 83 static std::string DetermineTextLanguage(const string16& text); |
84 | 84 |
85 // RenderViewObserver implementation. | 85 // RenderViewObserver implementation. |
86 virtual bool OnMessageReceived(const IPC::Message& message); | 86 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
87 | 87 |
88 // Cancels any translation that is currently being performed. This does not | 88 // Cancels any translation that is currently being performed. This does not |
89 // revert existing translations. | 89 // revert existing translations. |
90 void CancelPendingTranslation(); | 90 void CancelPendingTranslation(); |
91 | 91 |
92 // Checks if the current running page translation is finished or errored and | 92 // Checks if the current running page translation is finished or errored and |
93 // notifies the browser accordingly. If the translation has not terminated, | 93 // notifies the browser accordingly. If the translation has not terminated, |
94 // posts a task to check again later. | 94 // posts a task to check again later. |
95 void CheckTranslateStatus(); | 95 void CheckTranslateStatus(); |
96 | 96 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 std::string source_lang_; | 130 std::string source_lang_; |
131 std::string target_lang_; | 131 std::string target_lang_; |
132 | 132 |
133 // Method factory used to make calls to TranslatePageImpl. | 133 // Method factory used to make calls to TranslatePageImpl. |
134 base::WeakPtrFactory<TranslateHelper> weak_method_factory_; | 134 base::WeakPtrFactory<TranslateHelper> weak_method_factory_; |
135 | 135 |
136 DISALLOW_COPY_AND_ASSIGN(TranslateHelper); | 136 DISALLOW_COPY_AND_ASSIGN(TranslateHelper); |
137 }; | 137 }; |
138 | 138 |
139 #endif // CHROME_RENDERER_TRANSLATE_HELPER_H_ | 139 #endif // CHROME_RENDERER_TRANSLATE_HELPER_H_ |
OLD | NEW |