Chromium Code Reviews| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 | 21 |
| 22 class TranslateHelper : public content::RenderViewObserver { | 22 class TranslateHelper : public content::RenderViewObserver { |
| 23 public: | 23 public: |
| 24 explicit TranslateHelper(content::RenderView* render_view); | 24 explicit TranslateHelper(content::RenderView* render_view); |
| 25 virtual ~TranslateHelper(); | 25 virtual ~TranslateHelper(); |
| 26 | 26 |
| 27 // Informs us that the page's text has been extracted. | 27 // Informs us that the page's text has been extracted. |
| 28 void PageCaptured(const string16& contents); | 28 void PageCaptured(const string16& contents); |
| 29 | 29 |
| 30 protected: | 30 protected: |
| 31 // Correct language coed if it contains well-known mistakes. | |
|
sky
2013/02/11 21:10:14
coed->code
Takashi Toyoshima
2013/02/12 06:46:02
Done.
| |
| 32 static void CorrectLanguageCodeTypo(std::string* code); | |
| 33 | |
| 31 // Convert language code to the one used in server supporting list. | 34 // Convert language code to the one used in server supporting list. |
| 32 static void ConvertLanguageCodeSynonym(std::string* code); | 35 static void ConvertLanguageCodeSynonym(std::string* code); |
| 33 | 36 |
| 34 // The following methods are protected so they can be overridden in | 37 // The following methods are protected so they can be overridden in |
| 35 // unit-tests. | 38 // unit-tests. |
| 36 void OnTranslatePage(int page_id, | 39 void OnTranslatePage(int page_id, |
| 37 const std::string& translate_script, | 40 const std::string& translate_script, |
| 38 const std::string& source_lang, | 41 const std::string& source_lang, |
| 39 const std::string& target_lang); | 42 const std::string& target_lang); |
| 40 void OnRevertTranslation(int page_id); | 43 void OnRevertTranslation(int page_id); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 std::string source_lang_; | 130 std::string source_lang_; |
| 128 std::string target_lang_; | 131 std::string target_lang_; |
| 129 | 132 |
| 130 // Method factory used to make calls to TranslatePageImpl. | 133 // Method factory used to make calls to TranslatePageImpl. |
| 131 base::WeakPtrFactory<TranslateHelper> weak_method_factory_; | 134 base::WeakPtrFactory<TranslateHelper> weak_method_factory_; |
| 132 | 135 |
| 133 DISALLOW_COPY_AND_ASSIGN(TranslateHelper); | 136 DISALLOW_COPY_AND_ASSIGN(TranslateHelper); |
| 134 }; | 137 }; |
| 135 | 138 |
| 136 #endif // CHROME_RENDERER_TRANSLATE_HELPER_H_ | 139 #endif // CHROME_RENDERER_TRANSLATE_HELPER_H_ |
| OLD | NEW |