We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0].
[chromium-blink-merge.git] / chromecast / browser / cast_http_user_agent_settings.cc
blobef752dc328710c7a22f2aa7a579fcc63b484e809
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
3 // found in the LICENSE file.
5 #include "chromecast/browser/cast_http_user_agent_settings.h"
7 #include "base/i18n/rtl.h"
8 #include "base/logging.h"
9 #include "chromecast/common/cast_content_client.h"
10 #include "content/public/browser/browser_thread.h"
11 #include "grit/chromecast_settings.h"
12 #include "net/http/http_util.h"
13 #include "ui/base/l10n/l10n_util.h"
15 #if defined(OS_ANDROID)
16 #include "base/android/locale_utils.h"
17 #endif // defined(OS_ANDROID)
19 namespace chromecast {
20 namespace shell {
22 CastHttpUserAgentSettings::CastHttpUserAgentSettings() {
23 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
26 CastHttpUserAgentSettings::~CastHttpUserAgentSettings() {
27 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
30 std::string CastHttpUserAgentSettings::GetAcceptLanguage() const {
31 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
32 std::string new_locale(
33 #if defined(OS_ANDROID)
34 // TODO(byungchul): Use transient locale set when new app starts.
35 base::android::GetDefaultLocale()
36 #else
37 base::i18n::GetConfiguredLocale()
38 #endif
40 if (new_locale != last_locale_ || accept_language_.empty()) {
41 last_locale_ = new_locale;
42 accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader(
43 #if defined(OS_ANDROID)
44 last_locale_
45 #else
46 l10n_util::GetStringUTF8(IDS_CHROMECAST_SETTINGS_ACCEPT_LANGUAGES)
47 #endif
49 LOG(INFO) << "Locale changed: accept_language=" << accept_language_;
51 return accept_language_;
54 std::string CastHttpUserAgentSettings::GetUserAgent() const {
55 return chromecast::shell::GetUserAgent();
58 } // namespace shell
59 } // namespace chromecast