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

Unified Diff: chromecast/browser/cast_http_user_agent_settings.cc

Issue 964713002: Chromecast: get locale from ICU instead of caching permanently. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromecast/browser/cast_http_user_agent_settings.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/browser/cast_http_user_agent_settings.cc
diff --git a/chromecast/browser/cast_http_user_agent_settings.cc b/chromecast/browser/cast_http_user_agent_settings.cc
index 9eb2705866683f22b9c0ed31c8a5fd400c42e7ab..c8bffe52178af5b2a8e990424dbe3b1f395080cc 100644
--- a/chromecast/browser/cast_http_user_agent_settings.cc
+++ b/chromecast/browser/cast_http_user_agent_settings.cc
@@ -4,6 +4,7 @@
#include "chromecast/browser/cast_http_user_agent_settings.h"
+#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "chromecast/common/cast_content_client.h"
#include "content/public/browser/browser_thread.h"
@@ -28,14 +29,24 @@ CastHttpUserAgentSettings::~CastHttpUserAgentSettings() {
std::string CastHttpUserAgentSettings::GetAcceptLanguage() const {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
- if (accept_language_.empty()) {
+ std::string new_locale(
+#if defined(OS_ANDROID)
+ // TODO(byungchul): Use transient locale set when new app starts.
+ base::android::GetDefaultLocale()
+#else
+ base::i18n::GetConfiguredLocale()
+#endif
+ );
+ if (new_locale != last_locale_ || accept_language_.empty()) {
+ last_locale_ = new_locale;
accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader(
#if defined(OS_ANDROID)
- base::android::GetDefaultLocale()
+ last_locale_
#else
l10n_util::GetStringUTF8(IDS_CHROMECAST_SETTINGS_ACCEPT_LANGUAGES)
-#endif // defined(OS_ANDROID)
+#endif
);
+ LOG(INFO) << "Locale changed: accept_language=" << accept_language_;
}
return accept_language_;
}
« no previous file with comments | « chromecast/browser/cast_http_user_agent_settings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698