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

Side by Side Diff: chrome/renderer/translate/translate_helper.h

Issue 14494004: Added the 'Translation Logs' tab to chrome://translate-internals/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: first commit Created 7 years, 7 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 (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_TRANSLATE_HELPER_H_ 5 #ifndef CHROME_RENDERER_TRANSLATE_TRANSLATE_HELPER_H_
6 #define CHROME_RENDERER_TRANSLATE_TRANSLATE_HELPER_H_ 6 #define CHROME_RENDERER_TRANSLATE_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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 static void CorrectLanguageCodeTypo(std::string* code); 101 static void CorrectLanguageCodeTypo(std::string* code);
102 102
103 // Convert language code to the one used in server supporting list. 103 // Convert language code to the one used in server supporting list.
104 static void ConvertLanguageCodeSynonym(std::string* code); 104 static void ConvertLanguageCodeSynonym(std::string* code);
105 105
106 // Reset language code if the specified string is apparently invalid. 106 // Reset language code if the specified string is apparently invalid.
107 static void ResetInvalidLanguageCode(std::string* code); 107 static void ResetInvalidLanguageCode(std::string* code);
108 108
109 // Determine content page language from Content-Language code and contents. 109 // Determine content page language from Content-Language code and contents.
110 static std::string DeterminePageLanguage(const std::string& code, 110 static std::string DeterminePageLanguage(const std::string& code,
111 const string16& contents); 111 const string16& contents,
112 std::string* cld_language = NULL,
MAD 2013/05/07 19:49:05 We don't use default value for function arguments
hajimehoshi 2013/05/08 04:06:17 Done. Added a test to translate_helper_unittest.c
113 bool* is_cld_reliable = NULL);
112 114
113 // Returns whether the page associated with |document| is a candidate for 115 // Returns whether the page associated with |document| is a candidate for
114 // translation. Some pages can explictly specify (via a meta-tag) that they 116 // translation. Some pages can explictly specify (via a meta-tag) that they
115 // should not be translated. 117 // should not be translated.
116 static bool IsPageTranslatable(WebKit::WebDocument* document); 118 static bool IsPageTranslatable(WebKit::WebDocument* document);
117 119
118 #if defined(ENABLE_LANGUAGE_DETECTION) 120 #if defined(ENABLE_LANGUAGE_DETECTION)
119 // Returns the ISO 639_1 language code of the specified |text|, or 'unknown' 121 // Returns the ISO 639_1 language code of the specified |text|, or 'unknown'
120 // if it failed. 122 // if it failed.
121 static std::string DetermineTextLanguage(const string16& text); 123 // |is_cld_reliable| is optional. This will be set as true is CLD saids the
MAD 2013/05/07 19:49:05 is CLD saids -> if CLD says.
hajimehoshi 2013/05/08 04:06:17 Done.
124 // detection is reliable, otherwise not.
MAD 2013/05/07 19:49:05 No need for otherwise in comments when it's bool.
hajimehoshi 2013/05/08 04:06:17 Done.
125 static std::string DetermineTextLanguage(const string16& text,
126 bool* is_cld_reliable = NULL);
MAD 2013/05/07 19:49:05 Again.
hajimehoshi 2013/05/08 04:06:17 Done.
122 #endif 127 #endif
123 128
124 // RenderViewObserver implementation. 129 // RenderViewObserver implementation.
125 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 130 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
126 131
127 // Cancels any translation that is currently being performed. This does not 132 // Cancels any translation that is currently being performed. This does not
128 // revert existing translations. 133 // revert existing translations.
129 void CancelPendingTranslation(); 134 void CancelPendingTranslation();
130 135
131 // Checks if the current running page translation is finished or errored and 136 // Checks if the current running page translation is finished or errored and
(...skipping 19 matching lines...) Expand all
151 std::string source_lang_; 156 std::string source_lang_;
152 std::string target_lang_; 157 std::string target_lang_;
153 158
154 // Method factory used to make calls to TranslatePageImpl. 159 // Method factory used to make calls to TranslatePageImpl.
155 base::WeakPtrFactory<TranslateHelper> weak_method_factory_; 160 base::WeakPtrFactory<TranslateHelper> weak_method_factory_;
156 161
157 DISALLOW_COPY_AND_ASSIGN(TranslateHelper); 162 DISALLOW_COPY_AND_ASSIGN(TranslateHelper);
158 }; 163 };
159 164
160 #endif // CHROME_RENDERER_TRANSLATE_TRANSLATE_HELPER_H_ 165 #endif // CHROME_RENDERER_TRANSLATE_TRANSLATE_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698