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

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: (Rebasing) 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
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/translate/translate_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
113 bool* is_cld_reliable);
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 IsTranslationAllowed(WebKit::WebDocument* document); 118 static bool IsTranslationAllowed(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| will be set as true if CLD says the detection is
124 // reliable.
125 static std::string DetermineTextLanguage(const string16& text,
126 bool* is_cld_reliable);
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 23 matching lines...) Expand all
155 // time from showing infobar to requesting translation. 160 // time from showing infobar to requesting translation.
156 base::TimeTicks language_determined_time_; 161 base::TimeTicks language_determined_time_;
157 162
158 // Method factory used to make calls to TranslatePageImpl. 163 // Method factory used to make calls to TranslatePageImpl.
159 base::WeakPtrFactory<TranslateHelper> weak_method_factory_; 164 base::WeakPtrFactory<TranslateHelper> weak_method_factory_;
160 165
161 DISALLOW_COPY_AND_ASSIGN(TranslateHelper); 166 DISALLOW_COPY_AND_ASSIGN(TranslateHelper);
162 }; 167 };
163 168
164 #endif // CHROME_RENDERER_TRANSLATE_TRANSLATE_HELPER_H_ 169 #endif // CHROME_RENDERER_TRANSLATE_TRANSLATE_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/translate/translate_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698