| 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/common/cast_content_client.h" | 5 #include "chromecast/common/cast_content_client.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 std::string os_info; | 49 std::string os_info; |
| 50 base::StringAppendF( | 50 base::StringAppendF( |
| 51 &os_info, | 51 &os_info, |
| 52 "Android %s%s", | 52 "Android %s%s", |
| 53 android_version_str.c_str(), | 53 android_version_str.c_str(), |
| 54 android_info_str.c_str()); | 54 android_info_str.c_str()); |
| 55 return os_info; | 55 return os_info; |
| 56 } | 56 } |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 const url::SchemeWithType kChromeResourceSchemeWithType = { | |
| 60 kChromeResourceScheme, url::SCHEME_WITHOUT_PORT | |
| 61 }; | |
| 62 | |
| 63 } // namespace | 59 } // namespace |
| 64 | 60 |
| 65 std::string GetUserAgent() { | 61 std::string GetUserAgent() { |
| 66 std::string product = "Chrome/" PRODUCT_VERSION; | 62 std::string product = "Chrome/" PRODUCT_VERSION; |
| 67 std::string os_info; | 63 std::string os_info; |
| 68 base::StringAppendF( | 64 base::StringAppendF( |
| 69 &os_info, | 65 &os_info, |
| 70 "%s%s", | 66 "%s%s", |
| 71 #if defined(OS_ANDROID) | 67 #if defined(OS_ANDROID) |
| 72 "Linux; ", | 68 "Linux; ", |
| 73 BuildAndroidOsInfo().c_str() | 69 BuildAndroidOsInfo().c_str() |
| 74 #else | 70 #else |
| 75 "X11; ", | 71 "X11; ", |
| 76 content::BuildOSCpuInfo().c_str() | 72 content::BuildOSCpuInfo().c_str() |
| 77 #endif | 73 #endif |
| 78 ); | 74 ); |
| 79 return content::BuildUserAgentFromOSAndProduct(os_info, product) + | 75 return content::BuildUserAgentFromOSAndProduct(os_info, product) + |
| 80 " CrKey/" CAST_BUILD_REVISION; | 76 " CrKey/" CAST_BUILD_REVISION; |
| 81 } | 77 } |
| 82 | 78 |
| 83 CastContentClient::~CastContentClient() { | 79 CastContentClient::~CastContentClient() { |
| 84 } | 80 } |
| 85 | 81 |
| 86 void CastContentClient::AddAdditionalSchemes( | 82 void CastContentClient::AddAdditionalSchemes(Schemes* schemes) { |
| 87 std::vector<url::SchemeWithType>* standard_schemes, | 83 schemes->standard_schemes.push_back(kChromeResourceScheme); |
| 88 std::vector<url::SchemeWithType>* referrer_schemes, | |
| 89 std::vector<std::string>* savable_schemes) { | |
| 90 standard_schemes->push_back(kChromeResourceSchemeWithType); | |
| 91 } | 84 } |
| 92 | 85 |
| 93 std::string CastContentClient::GetUserAgent() const { | 86 std::string CastContentClient::GetUserAgent() const { |
| 94 return chromecast::shell::GetUserAgent(); | 87 return chromecast::shell::GetUserAgent(); |
| 95 } | 88 } |
| 96 | 89 |
| 97 base::string16 CastContentClient::GetLocalizedString(int message_id) const { | 90 base::string16 CastContentClient::GetLocalizedString(int message_id) const { |
| 98 return l10n_util::GetStringUTF16(message_id); | 91 return l10n_util::GetStringUTF16(message_id); |
| 99 } | 92 } |
| 100 | 93 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 117 } | 110 } |
| 118 | 111 |
| 119 #if defined(OS_ANDROID) | 112 #if defined(OS_ANDROID) |
| 120 ::media::MediaClientAndroid* CastContentClient::GetMediaClientAndroid() { | 113 ::media::MediaClientAndroid* CastContentClient::GetMediaClientAndroid() { |
| 121 return new media::CastMediaClientAndroid(); | 114 return new media::CastMediaClientAndroid(); |
| 122 } | 115 } |
| 123 #endif // OS_ANDROID | 116 #endif // OS_ANDROID |
| 124 | 117 |
| 125 } // namespace shell | 118 } // namespace shell |
| 126 } // namespace chromecast | 119 } // namespace chromecast |
| OLD | NEW |