ProjectingObserverChromeos: Drop DBusThreadManager dependency for better testing.
[chromium-blink-merge.git] / components / translate / core / browser / translate_url_util.cc
blobfc4105ca9fb401b1bfdbfd6efb86980cf5928a4d
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/translate/core/browser/translate_url_util.h"
7 #include "components/translate/core/browser/translate_download_manager.h"
8 #include "google_apis/google_api_keys.h"
9 #include "net/base/url_util.h"
11 namespace translate {
13 namespace {
15 // Used in all translate URLs to specify API Key.
16 const char kApiKeyName[] = "key";
18 // Used in kTranslateScriptURL and kLanguageListFetchURL to specify the
19 // application locale.
20 const char kHostLocaleQueryName[] = "hl";
22 } // namespace
24 GURL AddApiKeyToUrl(const GURL& url) {
25 return net::AppendQueryParameter(url, kApiKeyName, google_apis::GetAPIKey());
28 GURL AddHostLocaleToUrl(const GURL& url) {
29 return net::AppendQueryParameter(
30 url,
31 kHostLocaleQueryName,
32 TranslateDownloadManager::GetLanguageCode(
33 TranslateDownloadManager::GetInstance()->application_locale()));
36 } // namespace translate