Ben Murdoch | 116680a | 2014-07-20 18:25:52 -0700 | [diff] [blame] | 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. |
| 4 | |
| 5 | #include "chromecast/shell/browser/cast_http_user_agent_settings.h" |
| 6 | |
| 7 | #include "base/logging.h" |
| 8 | #include "chromecast/shell/common/cast_content_client.h" |
| 9 | #include "content/public/browser/browser_thread.h" |
Torne (Richard Coles) | 6e8cce6 | 2014-08-19 13:00:08 +0100 | [diff] [blame^] | 10 | #include "grit/chromecast_settings.h" |
Ben Murdoch | 116680a | 2014-07-20 18:25:52 -0700 | [diff] [blame] | 11 | #include "net/http/http_util.h" |
Torne (Richard Coles) | 6e8cce6 | 2014-08-19 13:00:08 +0100 | [diff] [blame^] | 12 | #include "ui/base/l10n/l10n_util.h" |
Ben Murdoch | 116680a | 2014-07-20 18:25:52 -0700 | [diff] [blame] | 13 | |
| 14 | namespace chromecast { |
| 15 | namespace shell { |
| 16 | |
| 17 | CastHttpUserAgentSettings::CastHttpUserAgentSettings() { |
| 18 | DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 19 | } |
| 20 | |
| 21 | CastHttpUserAgentSettings::~CastHttpUserAgentSettings() { |
| 22 | DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 23 | } |
| 24 | |
| 25 | std::string CastHttpUserAgentSettings::GetAcceptLanguage() const { |
Torne (Richard Coles) | 6e8cce6 | 2014-08-19 13:00:08 +0100 | [diff] [blame^] | 26 | DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 27 | if (accept_language_.empty()) { |
| 28 | accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader( |
| 29 | l10n_util::GetStringUTF8(IDS_CHROMECAST_SETTINGS_ACCEPT_LANGUAGES)); |
| 30 | } |
Ben Murdoch | 116680a | 2014-07-20 18:25:52 -0700 | [diff] [blame] | 31 | return accept_language_; |
| 32 | } |
| 33 | |
| 34 | std::string CastHttpUserAgentSettings::GetUserAgent() const { |
| 35 | return chromecast::shell::GetUserAgent(); |
| 36 | } |
| 37 | |
| 38 | } // namespace shell |
| 39 | } // namespace chromecast |