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

Side by Side Diff: components/translate/core/browser/translate_manager.cc

Issue 378253002: Fix translate namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing android build errors Created 6 years, 5 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 "components/translate/core/browser/translate_manager.h" 5 #include "components/translate/core/browser/translate_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 13 matching lines...) Expand all
24 #include "components/translate/core/browser/translate_prefs.h" 24 #include "components/translate/core/browser/translate_prefs.h"
25 #include "components/translate/core/browser/translate_script.h" 25 #include "components/translate/core/browser/translate_script.h"
26 #include "components/translate/core/browser/translate_url_util.h" 26 #include "components/translate/core/browser/translate_url_util.h"
27 #include "components/translate/core/common/language_detection_details.h" 27 #include "components/translate/core/common/language_detection_details.h"
28 #include "components/translate/core/common/translate_constants.h" 28 #include "components/translate/core/common/translate_constants.h"
29 #include "components/translate/core/common/translate_pref_names.h" 29 #include "components/translate/core/common/translate_pref_names.h"
30 #include "components/translate/core/common/translate_switches.h" 30 #include "components/translate/core/common/translate_switches.h"
31 #include "net/base/url_util.h" 31 #include "net/base/url_util.h"
32 #include "net/http/http_status_code.h" 32 #include "net/http/http_status_code.h"
33 33
34 namespace translate {
35
34 namespace { 36 namespace {
35 37
36 // Callbacks for translate errors. 38 // Callbacks for translate errors.
37 TranslateManager::TranslateErrorCallbackList* g_callback_list_ = NULL; 39 TranslateManager::TranslateErrorCallbackList* g_callback_list_ = NULL;
38 40
39 const char kReportLanguageDetectionErrorURL[] = 41 const char kReportLanguageDetectionErrorURL[] =
40 "https://translate.google.com/translate_error?client=cr&action=langidc"; 42 "https://translate.google.com/translate_error?client=cr&action=langidc";
41 43
42 // Used in kReportLanguageDetectionErrorURL to specify the original page 44 // Used in kReportLanguageDetectionErrorURL to specify the original page
43 // language. 45 // language.
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 report_error_url = 267 report_error_url =
266 net::AppendQueryParameter(report_error_url, 268 net::AppendQueryParameter(report_error_url,
267 kUrlQueryName, 269 kUrlQueryName,
268 translate_driver_->GetActiveURL().spec()); 270 translate_driver_->GetActiveURL().spec());
269 271
270 report_error_url = 272 report_error_url =
271 net::AppendQueryParameter(report_error_url, 273 net::AppendQueryParameter(report_error_url,
272 kSourceLanguageQueryName, 274 kSourceLanguageQueryName,
273 language_state_.original_language()); 275 language_state_.original_language());
274 276
275 report_error_url = TranslateURLUtil::AddHostLocaleToUrl(report_error_url); 277 report_error_url = translate::AddHostLocaleToUrl(report_error_url);
276 report_error_url = TranslateURLUtil::AddApiKeyToUrl(report_error_url); 278 report_error_url = translate::AddApiKeyToUrl(report_error_url);
277 279
278 translate_client_->ShowReportLanguageDetectionErrorUI(report_error_url); 280 translate_client_->ShowReportLanguageDetectionErrorUI(report_error_url);
279 } 281 }
280 282
281 void TranslateManager::DoTranslatePage(const std::string& translate_script, 283 void TranslateManager::DoTranslatePage(const std::string& translate_script,
282 const std::string& source_lang, 284 const std::string& source_lang,
283 const std::string& target_lang) { 285 const std::string& target_lang) {
284 language_state_.set_translation_pending(true); 286 language_state_.set_translation_pending(true);
285 translate_driver_->TranslatePage( 287 translate_driver_->TranslatePage(
286 page_seq_no_, translate_script, source_lang, target_lang); 288 page_seq_no_, translate_script, source_lang, target_lang);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 TranslateDownloadManager::GetLanguageCode(auto_target_lang); 382 TranslateDownloadManager::GetLanguageCode(auto_target_lang);
381 if (TranslateDownloadManager::IsSupportedLanguage(auto_target_lang)) 383 if (TranslateDownloadManager::IsSupportedLanguage(auto_target_lang))
382 return auto_target_lang; 384 return auto_target_lang;
383 } 385 }
384 return std::string(); 386 return std::string();
385 } 387 }
386 388
387 LanguageState& TranslateManager::GetLanguageState() { 389 LanguageState& TranslateManager::GetLanguageState() {
388 return language_state_; 390 return language_state_;
389 } 391 }
392
393 } // namespace translate
OLDNEW
« no previous file with comments | « components/translate/core/browser/translate_manager.h ('k') | components/translate/core/browser/translate_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698