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

Side by Side Diff: chrome/browser/translate/translate_tab_helper.cc

Issue 285293004: Allow browser tests to run with dynamic CLD data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cld_uma
Patch Set: Yet more #ifdefs for compiler cleanliness Created 6 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/browser/translate/translate_tab_helper.h ('k') | chrome/chrome_tests.gypi » ('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 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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_tab_helper.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698