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

Side by Side Diff: chromecast/browser/cast_http_user_agent_settings.cc

Issue 2406203002: Use BCP47 compliant format for locale representation (Closed)
Patch Set: BCP 47, change in description Created 4 years, 1 month 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 "chromecast/browser/cast_http_user_agent_settings.h" 5 #include "chromecast/browser/cast_http_user_agent_settings.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chromecast/common/cast_content_client.h" 10 #include "chromecast/common/cast_content_client.h"
(...skipping 15 matching lines...) Expand all
26 26
27 CastHttpUserAgentSettings::~CastHttpUserAgentSettings() { 27 CastHttpUserAgentSettings::~CastHttpUserAgentSettings() {
28 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 28 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
29 } 29 }
30 30
31 std::string CastHttpUserAgentSettings::GetAcceptLanguage() const { 31 std::string CastHttpUserAgentSettings::GetAcceptLanguage() const {
32 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 32 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
33 std::string new_locale( 33 std::string new_locale(
34 #if defined(OS_ANDROID) 34 #if defined(OS_ANDROID)
35 // TODO(byungchul): Use transient locale set when new app starts. 35 // TODO(byungchul): Use transient locale set when new app starts.
36 base::android::GetDefaultLocale() 36 base::android::GetDefaultLocaleString()
37 #else 37 #else
38 base::i18n::GetConfiguredLocale() 38 base::i18n::GetConfiguredLocale()
39 #endif 39 #endif
40 ); 40 );
41 if (new_locale != last_locale_ || accept_language_.empty()) { 41 if (new_locale != last_locale_ || accept_language_.empty()) {
42 last_locale_ = new_locale; 42 last_locale_ = new_locale;
43 accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader( 43 accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader(
44 #if defined(OS_ANDROID) 44 #if defined(OS_ANDROID)
45 last_locale_ 45 last_locale_
46 #else 46 #else
47 l10n_util::GetStringUTF8(IDS_CHROMECAST_SETTINGS_ACCEPT_LANGUAGES) 47 l10n_util::GetStringUTF8(IDS_CHROMECAST_SETTINGS_ACCEPT_LANGUAGES)
48 #endif 48 #endif
49 ); 49 );
50 LOG(INFO) << "Locale changed: accept_language=" << accept_language_; 50 LOG(INFO) << "Locale changed: accept_language=" << accept_language_;
51 } 51 }
52 return accept_language_; 52 return accept_language_;
53 } 53 }
54 54
55 std::string CastHttpUserAgentSettings::GetUserAgent() const { 55 std::string CastHttpUserAgentSettings::GetUserAgent() const {
56 return chromecast::shell::GetUserAgent(); 56 return chromecast::shell::GetUserAgent();
57 } 57 }
58 58
59 } // namespace shell 59 } // namespace shell
60 } // namespace chromecast 60 } // namespace chromecast
OLDNEW
« no previous file with comments | « chrome/browser/android/preferences/pref_service_bridge_unittest.cc ('k') | ui/base/l10n/l10n_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698