cast_content_client.cc revision 1320f92c476a1ad9d19dba2a48c72b75566198e9
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/common/cast_content_client.h"
6
7#include "chromecast/common/version.h"
8#include "content/public/common/user_agent.h"
9#include "ui/base/l10n/l10n_util.h"
10#include "ui/base/resource/resource_bundle.h"
11
12namespace chromecast {
13namespace shell {
14
15std::string GetUserAgent() {
16  std::string product = "Chrome/" PRODUCT_VERSION;
17  return content::BuildUserAgentFromProduct(product) +
18      " CrKey" CAST_BUILD_REVISION;
19}
20
21CastContentClient::~CastContentClient() {
22}
23
24std::string CastContentClient::GetUserAgent() const {
25  return chromecast::shell::GetUserAgent();
26}
27
28base::string16 CastContentClient::GetLocalizedString(int message_id) const {
29  return l10n_util::GetStringUTF16(message_id);
30}
31
32base::StringPiece CastContentClient::GetDataResource(
33    int resource_id,
34    ui::ScaleFactor scale_factor) const {
35  return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
36      resource_id, scale_factor);
37}
38
39base::RefCountedStaticMemory* CastContentClient::GetDataResourceBytes(
40    int resource_id) const {
41  return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
42      resource_id);
43}
44
45gfx::Image& CastContentClient::GetNativeImageNamed(int resource_id) const {
46  return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
47      resource_id);
48}
49
50}  // namespace shell
51}  // namespace chromecast
52