| 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 COMPONENTS_TRANSLATE_CONTENT_RENDERER_TRANSLATE_HELPER_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CONTENT_RENDERER_TRANSLATE_HELPER_H_ |
| 6 #define COMPONENTS_TRANSLATE_CONTENT_RENDERER_TRANSLATE_HELPER_H_ | 6 #define COMPONENTS_TRANSLATE_CONTENT_RENDERER_TRANSLATE_HELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 // Converts language code to the one used in server supporting list. | 174 // Converts language code to the one used in server supporting list. |
| 175 static void ConvertLanguageCodeSynonym(std::string* code); | 175 static void ConvertLanguageCodeSynonym(std::string* code); |
| 176 | 176 |
| 177 // Returns whether the page associated with |document| is a candidate for | 177 // Returns whether the page associated with |document| is a candidate for |
| 178 // translation. Some pages can explictly specify (via a meta-tag) that they | 178 // translation. Some pages can explictly specify (via a meta-tag) that they |
| 179 // should not be translated. | 179 // should not be translated. |
| 180 static bool IsTranslationAllowed(blink::WebDocument* document); | 180 static bool IsTranslationAllowed(blink::WebDocument* document); |
| 181 | 181 |
| 182 // RenderViewObserver implementation. | 182 // RenderViewObserver implementation. |
| 183 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 183 virtual bool OnMessageReceived(const IPC::Message& message) override; |
| 184 | 184 |
| 185 // Informs us that the page's text has been extracted. | 185 // Informs us that the page's text has been extracted. |
| 186 void PageCapturedImpl(int page_seq_no, const base::string16& contents); | 186 void PageCapturedImpl(int page_seq_no, const base::string16& contents); |
| 187 | 187 |
| 188 // Cancels any translation that is currently being performed. This does not | 188 // Cancels any translation that is currently being performed. This does not |
| 189 // revert existing translations. | 189 // revert existing translations. |
| 190 void CancelPendingTranslation(); | 190 void CancelPendingTranslation(); |
| 191 | 191 |
| 192 // Checks if the current running page translation is finished or errored and | 192 // Checks if the current running page translation is finished or errored and |
| 193 // notifies the browser accordingly. If the translation has not terminated, | 193 // notifies the browser accordingly. If the translation has not terminated, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 // Method factory used to make calls to TranslatePageImpl. | 276 // Method factory used to make calls to TranslatePageImpl. |
| 277 base::WeakPtrFactory<TranslateHelper> weak_method_factory_; | 277 base::WeakPtrFactory<TranslateHelper> weak_method_factory_; |
| 278 | 278 |
| 279 DISALLOW_COPY_AND_ASSIGN(TranslateHelper); | 279 DISALLOW_COPY_AND_ASSIGN(TranslateHelper); |
| 280 }; | 280 }; |
| 281 | 281 |
| 282 } // namespace translate | 282 } // namespace translate |
| 283 | 283 |
| 284 #endif // COMPONENTS_TRANSLATE_CONTENT_RENDERER_TRANSLATE_HELPER_H_ | 284 #endif // COMPONENTS_TRANSLATE_CONTENT_RENDERER_TRANSLATE_HELPER_H_ |
| OLD | NEW |