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