OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/browser/translate/translate_tab_helper.h" | 5 #include "chrome/browser/translate/translate_tab_helper.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 if (s_cached_file_) { | 437 if (s_cached_file_) { |
438 // Idempotence: Racing another request on the blocking pool, abort. | 438 // Idempotence: Racing another request on the blocking pool, abort. |
439 } else { | 439 } else { |
440 // Else, this request has taken care of it all. Cache all info. | 440 // Else, this request has taken care of it all. Cache all info. |
441 s_cached_file_ = file.release(); | 441 s_cached_file_ = file.release(); |
442 s_cached_data_offset_ = data_offset; | 442 s_cached_data_offset_ = data_offset; |
443 s_cached_data_length_ = data_length; | 443 s_cached_data_length_ = data_length; |
444 } | 444 } |
445 } | 445 } |
446 } | 446 } |
| 447 |
447 #endif // defined(CLD2_DYNAMIC_MODE) | 448 #endif // defined(CLD2_DYNAMIC_MODE) |
448 | 449 |
449 void TranslateTabHelper::InitiateTranslation(const std::string& page_lang, | 450 void TranslateTabHelper::InitiateTranslation(const std::string& page_lang, |
450 int attempt) { | 451 int attempt) { |
451 if (translate_driver_.GetLanguageState().translation_pending()) | 452 if (translate_driver_.GetLanguageState().translation_pending()) |
452 return; | 453 return; |
453 | 454 |
454 // During a reload we need web content to be available before the | 455 // During a reload we need web content to be available before the |
455 // translate script is executed. Otherwise we will run the translate script on | 456 // translate script is executed. Otherwise we will run the translate script on |
456 // an empty DOM which will fail. Therefore we wait a bit to see if the page | 457 // an empty DOM which will fail. Therefore we wait a bit to see if the page |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 if (GetLanguageState().InTranslateNavigation()) | 541 if (GetLanguageState().InTranslateNavigation()) |
541 return; | 542 return; |
542 } | 543 } |
543 | 544 |
544 TranslateBubbleFactory::Show( | 545 TranslateBubbleFactory::Show( |
545 browser->window(), web_contents(), step, error_type); | 546 browser->window(), web_contents(), step, error_type); |
546 #else | 547 #else |
547 NOTREACHED(); | 548 NOTREACHED(); |
548 #endif | 549 #endif |
549 } | 550 } |
OLD | NEW |