| OLD | NEW | 
|   1 // Copyright 2013 The Chromium Authors. All rights reserved. |   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 |   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_url_util.h" |   5 #include "components/translate/core/browser/translate_url_util.h" | 
|   6  |   6  | 
|   7 #include "components/translate/core/browser/translate_download_manager.h" |   7 #include "components/translate/core/browser/translate_download_manager.h" | 
|   8 #include "google_apis/google_api_keys.h" |   8 #include "google_apis/google_api_keys.h" | 
|   9 #include "net/base/url_util.h" |   9 #include "net/base/url_util.h" | 
|  10  |  10  | 
 |  11 namespace translate { | 
 |  12  | 
|  11 namespace { |  13 namespace { | 
|  12  |  14  | 
|  13 // Used in all translate URLs to specify API Key. |  15 // Used in all translate URLs to specify API Key. | 
|  14 const char kApiKeyName[] = "key"; |  16 const char kApiKeyName[] = "key"; | 
|  15  |  17  | 
|  16 // Used in kTranslateScriptURL and kLanguageListFetchURL to specify the |  18 // Used in kTranslateScriptURL and kLanguageListFetchURL to specify the | 
|  17 // application locale. |  19 // application locale. | 
|  18 const char kHostLocaleQueryName[] = "hl"; |  20 const char kHostLocaleQueryName[] = "hl"; | 
|  19  |  21  | 
|  20 }  // namespace |  22 }  // namespace | 
|  21  |  23  | 
|  22 namespace TranslateURLUtil { |  24 namespace TranslateURLUtil { | 
|  23  |  25  | 
|  24 GURL AddApiKeyToUrl(const GURL& url) { |  26 GURL AddApiKeyToUrl(const GURL& url) { | 
|  25   return net::AppendQueryParameter(url, kApiKeyName, google_apis::GetAPIKey()); |  27   return net::AppendQueryParameter(url, kApiKeyName, google_apis::GetAPIKey()); | 
|  26 } |  28 } | 
|  27  |  29  | 
|  28 GURL AddHostLocaleToUrl(const GURL& url) { |  30 GURL AddHostLocaleToUrl(const GURL& url) { | 
|  29   return net::AppendQueryParameter( |  31   return net::AppendQueryParameter( | 
|  30       url, |  32       url, | 
|  31       kHostLocaleQueryName, |  33       kHostLocaleQueryName, | 
|  32       TranslateDownloadManager::GetLanguageCode( |  34       TranslateDownloadManager::GetLanguageCode( | 
|  33           TranslateDownloadManager::GetInstance()->application_locale())); |  35           TranslateDownloadManager::GetInstance()->application_locale())); | 
|  34 } |  36 } | 
|  35  |  37  | 
|  36 }  // namespace TranslateURLUtil |  38 }  // namespace TranslateURLUtil | 
 |  39  | 
 |  40 }  // namespace translate | 
| OLD | NEW |