OLD | NEW |
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/shell/browser/cast_http_user_agent_settings.h" | 5 #include "chromecast/shell/browser/cast_http_user_agent_settings.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chromecast/shell/common/cast_content_client.h" | 8 #include "chromecast/shell/common/cast_content_client.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "grit/chromecast_settings.h" | 10 #include "grit/chromecast_settings.h" |
11 #include "net/http/http_util.h" | 11 #include "net/http/http_util.h" |
12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
13 | 13 |
| 14 #if defined(OS_ANDROID) |
| 15 #include "ui/base/l10n/l10n_util_android.h" |
| 16 #endif // defined(OS_ANDROID) |
| 17 |
14 namespace chromecast { | 18 namespace chromecast { |
15 namespace shell { | 19 namespace shell { |
16 | 20 |
17 CastHttpUserAgentSettings::CastHttpUserAgentSettings() { | 21 CastHttpUserAgentSettings::CastHttpUserAgentSettings() { |
18 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 22 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
19 } | 23 } |
20 | 24 |
21 CastHttpUserAgentSettings::~CastHttpUserAgentSettings() { | 25 CastHttpUserAgentSettings::~CastHttpUserAgentSettings() { |
22 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 26 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
23 } | 27 } |
24 | 28 |
25 std::string CastHttpUserAgentSettings::GetAcceptLanguage() const { | 29 std::string CastHttpUserAgentSettings::GetAcceptLanguage() const { |
26 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 30 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
27 if (accept_language_.empty()) { | 31 if (accept_language_.empty()) { |
28 accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader( | 32 accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader( |
29 l10n_util::GetStringUTF8(IDS_CHROMECAST_SETTINGS_ACCEPT_LANGUAGES)); | 33 #if defined(OS_ANDROID) |
| 34 l10n_util::GetDefaultLocale() |
| 35 #else |
| 36 l10n_util::GetStringUTF8(IDS_CHROMECAST_SETTINGS_ACCEPT_LANGUAGES) |
| 37 #endif // defined(OS_ANDROID) |
| 38 ); |
30 } | 39 } |
31 return accept_language_; | 40 return accept_language_; |
32 } | 41 } |
33 | 42 |
34 std::string CastHttpUserAgentSettings::GetUserAgent() const { | 43 std::string CastHttpUserAgentSettings::GetUserAgent() const { |
35 return chromecast::shell::GetUserAgent(); | 44 return chromecast::shell::GetUserAgent(); |
36 } | 45 } |
37 | 46 |
38 } // namespace shell | 47 } // namespace shell |
39 } // namespace chromecast | 48 } // namespace chromecast |
OLD | NEW |