| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "blimp/engine/common/blimp_content_client.h" | 5 #include "blimp/engine/common/blimp_content_client.h" |
| 6 | 6 |
| 7 #include "components/version_info/version_info.h" | 7 #include "components/version_info/version_info.h" |
| 8 #include "content/public/common/user_agent.h" | 8 #include "content/public/common/user_agent.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| 11 | 11 |
| 12 namespace blimp { | 12 namespace blimp { |
| 13 namespace engine { | 13 namespace engine { |
| 14 | 14 |
| 15 std::string GetBlimpEngineUserAgent() { | 15 std::string GetBlimpEngineUserAgent() { |
| 16 return content::BuildUserAgentFromProduct( | 16 return content::BuildUserAgentFromProduct( |
| 17 version_info::GetProductNameAndVersionForUserAgent() + " Mobile"); | 17 version_info::GetProductNameAndVersionForUserAgent() + " Mobile"); |
| 18 } | 18 } |
| 19 | 19 |
| 20 BlimpContentClient::~BlimpContentClient() {} | 20 BlimpContentClient::~BlimpContentClient() {} |
| 21 | 21 |
| 22 std::string BlimpContentClient::GetUserAgent() const { | 22 std::string BlimpContentClient::GetUserAgent() const { |
| 23 return GetBlimpEngineUserAgent(); | 23 return GetBlimpEngineUserAgent(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 base::string16 BlimpContentClient::GetLocalizedString(int message_id) const { | 26 base::string16 BlimpContentClient::GetLocalizedString(int message_id) const { |
| 27 return l10n_util::GetStringUTF16(message_id); | 27 return l10n_util::GetStringUTF16(message_id); |
| 28 } | 28 } |
| 29 | 29 |
| 30 base::string16 BlimpContentClient::GetLocalizedStringF( |
| 31 int message_id, |
| 32 const base::string16& string0) const { |
| 33 return l10n_util::GetStringFUTF16(message_id, string0); |
| 34 } |
| 35 |
| 30 base::StringPiece BlimpContentClient::GetDataResource( | 36 base::StringPiece BlimpContentClient::GetDataResource( |
| 31 int resource_id, | 37 int resource_id, |
| 32 ui::ScaleFactor scale_factor) const { | 38 ui::ScaleFactor scale_factor) const { |
| 33 return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( | 39 return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( |
| 34 resource_id, scale_factor); | 40 resource_id, scale_factor); |
| 35 } | 41 } |
| 36 | 42 |
| 37 base::RefCountedStaticMemory* BlimpContentClient::GetDataResourceBytes( | 43 base::RefCountedStaticMemory* BlimpContentClient::GetDataResourceBytes( |
| 38 int resource_id) const { | 44 int resource_id) const { |
| 39 return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 45 return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
| 40 resource_id); | 46 resource_id); |
| 41 } | 47 } |
| 42 | 48 |
| 43 gfx::Image& BlimpContentClient::GetNativeImageNamed(int resource_id) const { | 49 gfx::Image& BlimpContentClient::GetNativeImageNamed(int resource_id) const { |
| 44 return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 50 return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 45 resource_id); | 51 resource_id); |
| 46 } | 52 } |
| 47 | 53 |
| 48 } // namespace engine | 54 } // namespace engine |
| 49 } // namespace blimp | 55 } // namespace blimp |
| OLD | NEW |