Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / translate / translate_url_util.cc
blob03718e7812415f311ba33294a738920191bb3768
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 "chrome/browser/translate/translate_url_util.h"
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/translate/translate_manager.h"
9 #include "google_apis/google_api_keys.h"
10 #include "net/base/url_util.h"
12 namespace {
14 // Used in all translate URLs to specify API Key.
15 const char kApiKeyName[] = "key";
17 // Used in kTranslateScriptURL and kLanguageListFetchURL to specify the
18 // application locale.
19 const char kHostLocaleQueryName[] = "hl";
21 } // namespace
23 namespace TranslateURLUtil {
25 GURL AddApiKeyToUrl(const GURL& url) {
26 return net::AppendQueryParameter(url, kApiKeyName, google_apis::GetAPIKey());
29 GURL AddHostLocaleToUrl(const GURL& url) {
30 return net::AppendQueryParameter(
31 url,
32 kHostLocaleQueryName,
33 TranslateManager::GetLanguageCode(
34 g_browser_process->GetApplicationLocale()));
37 } // namespace TranslateURLUtil