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

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

Issue 1903593002: Allows to manually change the stored permanent country in Variations from the translate-internals d… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: UI polishing Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chrome_translate_client.h" 5 #include "chrome/browser/translate/chrome_translate_client.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 if (!auto_translate_language.empty()) { 162 if (!auto_translate_language.empty()) {
163 *target = auto_translate_language; 163 *target = auto_translate_language;
164 return; 164 return;
165 } 165 }
166 } 166 }
167 167
168 *target = 168 *target =
169 translate::TranslateManager::GetTargetLanguage(translate_prefs.get()); 169 translate::TranslateManager::GetTargetLanguage(translate_prefs.get());
170 } 170 }
171 171
172 // static
173 bool ChromeTranslateClient::OverrideStoredPermanentCountry(
174 const std::string& country) {
175 variations::VariationsService* variations_service =
176 g_browser_process->variations_service();
177 if (variations_service) {
178 return variations_service->ForceSetStoredPermanentCountry(country);
179 } else {
Alexei Svitkine (slow) 2016/04/20 20:30:23 No need for else if there's an early return.
hamelphi 2016/04/20 21:39:46 Removed changes from chrome_translate_client.
180 LOG(ERROR) << "Could not get variations service.";
Alexei Svitkine (slow) 2016/04/20 20:30:23 Nit: Make this a DLOG() so we don't bloat the prod
hamelphi 2016/04/20 21:39:46 Removed changes from chrome_translate_client.
181 }
182 return false;
183 }
184
172 translate::TranslateManager* ChromeTranslateClient::GetTranslateManager() { 185 translate::TranslateManager* ChromeTranslateClient::GetTranslateManager() {
173 return translate_manager_.get(); 186 return translate_manager_.get();
174 } 187 }
175 188
176 void ChromeTranslateClient::ShowTranslateUI( 189 void ChromeTranslateClient::ShowTranslateUI(
177 translate::TranslateStep step, 190 translate::TranslateStep step,
178 const std::string& source_language, 191 const std::string& source_language,
179 const std::string& target_language, 192 const std::string& target_language,
180 translate::TranslateErrors::Type error_type, 193 translate::TranslateErrors::Type error_type,
181 bool triggered_from_menu) { 194 bool triggered_from_menu) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 if (GetLanguageState().InTranslateNavigation()) 353 if (GetLanguageState().InTranslateNavigation())
341 return; 354 return;
342 } 355 }
343 356
344 TranslateBubbleFactory::Show( 357 TranslateBubbleFactory::Show(
345 browser->window(), web_contents(), step, error_type); 358 browser->window(), web_contents(), step, error_type);
346 #else 359 #else
347 NOTREACHED(); 360 NOTREACHED();
348 #endif 361 #endif
349 } 362 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698