OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/renderer/translate_helper.h" | 5 #include "chrome/renderer/translate_helper.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/common/chrome_constants.h" | 9 #include "chrome/common/chrome_constants.h" |
10 #include "chrome/renderer/render_view.h" | 10 #include "chrome/renderer/render_view.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 222 } |
223 return translate_success; | 223 return translate_success; |
224 } | 224 } |
225 | 225 |
226 std::string TranslateHelper::GetOriginalPageLanguage() { | 226 std::string TranslateHelper::GetOriginalPageLanguage() { |
227 std::string lang; | 227 std::string lang; |
228 ExecuteScriptAndGetStringResult("cr.googleTranslate.sourceLang", &lang); | 228 ExecuteScriptAndGetStringResult("cr.googleTranslate.sourceLang", &lang); |
229 return lang; | 229 return lang; |
230 } | 230 } |
231 | 231 |
| 232 bool TranslateHelper::DontDelayTasks() { |
| 233 return false; |
| 234 } |
| 235 |
232 //////////////////////////////////////////////////////////////////////////////// | 236 //////////////////////////////////////////////////////////////////////////////// |
233 // TranslateHelper, private: | 237 // TranslateHelper, private: |
234 // | 238 // |
235 void TranslateHelper::CheckTranslateStatus() { | 239 void TranslateHelper::CheckTranslateStatus() { |
236 if (page_id_ != render_view_->page_id()) | 240 if (page_id_ != render_view_->page_id()) |
237 return; // This is not the same page, the translation has been canceled. | 241 return; // This is not the same page, the translation has been canceled. |
238 | 242 |
239 // First check if there was an error. | 243 // First check if there was an error. |
240 if (HasTranslationFailed()) { | 244 if (HasTranslationFailed()) { |
241 NotifyBrowserTranslationFailed(TranslateErrors::TRANSLATION_ERROR); | 245 NotifyBrowserTranslationFailed(TranslateErrors::TRANSLATION_ERROR); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 WebView* web_view = render_view_->webview(); | 371 WebView* web_view = render_view_->webview(); |
368 if (!web_view) { | 372 if (!web_view) { |
369 // When the WebView is going away, the render view should have called | 373 // When the WebView is going away, the render view should have called |
370 // CancelPendingTranslation() which should have stopped any pending work, so | 374 // CancelPendingTranslation() which should have stopped any pending work, so |
371 // that case should not happen. | 375 // that case should not happen. |
372 NOTREACHED(); | 376 NOTREACHED(); |
373 return NULL; | 377 return NULL; |
374 } | 378 } |
375 return web_view->mainFrame(); | 379 return web_view->mainFrame(); |
376 } | 380 } |
OLD | NEW |