| 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_resource_delegate.h" | 5 #include "chromecast/common/cast_resource_delegate.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "ui/gfx/image/image.h" | 9 #include "ui/gfx/image/image.h" |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 CastResourceDelegate::~CastResourceDelegate() { | 30 CastResourceDelegate::~CastResourceDelegate() { |
| 31 DCHECK_EQ(g_instance, this); | 31 DCHECK_EQ(g_instance, this); |
| 32 g_instance = NULL; | 32 g_instance = NULL; |
| 33 } | 33 } |
| 34 | 34 |
| 35 base::FilePath CastResourceDelegate::GetPathForResourcePack( | 35 base::FilePath CastResourceDelegate::GetPathForResourcePack( |
| 36 const base::FilePath& pack_path, | 36 const base::FilePath& pack_path, |
| 37 ui::ScaleFactor scale_factor) { | 37 ui::ScaleFactor scale_factor) { |
| 38 return pack_path; | 38 return pack_path; |
| 39 }; | 39 } |
| 40 | 40 |
| 41 base::FilePath CastResourceDelegate::GetPathForLocalePack( | 41 base::FilePath CastResourceDelegate::GetPathForLocalePack( |
| 42 const base::FilePath& pack_path, | 42 const base::FilePath& pack_path, |
| 43 const std::string& locale) { | 43 const std::string& locale) { |
| 44 base::FilePath product_dir; | 44 base::FilePath product_dir; |
| 45 if (!PathService::Get(base::DIR_MODULE, &product_dir)) { | 45 if (!PathService::Get(base::DIR_MODULE, &product_dir)) { |
| 46 NOTREACHED(); | 46 NOTREACHED(); |
| 47 } | 47 } |
| 48 return product_dir. | 48 return product_dir. |
| 49 Append(FILE_PATH_LITERAL("chromecast_locales")). | 49 Append(FILE_PATH_LITERAL("chromecast_locales")). |
| 50 Append(FILE_PATH_LITERAL(locale)). | 50 Append(FILE_PATH_LITERAL(locale)). |
| 51 AddExtension(FILE_PATH_LITERAL("pak")); | 51 AddExtension(FILE_PATH_LITERAL("pak")); |
| 52 }; | 52 } |
| 53 | 53 |
| 54 gfx::Image CastResourceDelegate::GetImageNamed(int resource_id) { | 54 gfx::Image CastResourceDelegate::GetImageNamed(int resource_id) { |
| 55 return gfx::Image(); | 55 return gfx::Image(); |
| 56 }; | 56 } |
| 57 | 57 |
| 58 gfx::Image CastResourceDelegate::GetNativeImageNamed( | 58 gfx::Image CastResourceDelegate::GetNativeImageNamed(int resource_id) { |
| 59 int resource_id, | |
| 60 ui::ResourceBundle::ImageRTL rtl) { | |
| 61 return gfx::Image(); | 59 return gfx::Image(); |
| 62 }; | 60 } |
| 63 | 61 |
| 64 base::RefCountedStaticMemory* CastResourceDelegate::LoadDataResourceBytes( | 62 base::RefCountedStaticMemory* CastResourceDelegate::LoadDataResourceBytes( |
| 65 int resource_id, | 63 int resource_id, |
| 66 ui::ScaleFactor scale_factor) { | 64 ui::ScaleFactor scale_factor) { |
| 67 return NULL; | 65 return NULL; |
| 68 }; | 66 } |
| 69 | 67 |
| 70 bool CastResourceDelegate::GetRawDataResource(int resource_id, | 68 bool CastResourceDelegate::GetRawDataResource(int resource_id, |
| 71 ui::ScaleFactor scale_factor, | 69 ui::ScaleFactor scale_factor, |
| 72 base::StringPiece* value) { | 70 base::StringPiece* value) { |
| 73 return false; | 71 return false; |
| 74 }; | 72 } |
| 75 | 73 |
| 76 bool CastResourceDelegate::GetLocalizedString(int message_id, | 74 bool CastResourceDelegate::GetLocalizedString(int message_id, |
| 77 base::string16* value) { | 75 base::string16* value) { |
| 78 ExtraLocaledStringMap::const_iterator it = | 76 ExtraLocaledStringMap::const_iterator it = |
| 79 extra_localized_strings_.find(message_id); | 77 extra_localized_strings_.find(message_id); |
| 80 if (it != extra_localized_strings_.end()) { | 78 if (it != extra_localized_strings_.end()) { |
| 81 *value = it->second; | 79 *value = it->second; |
| 82 return true; | 80 return true; |
| 83 } | 81 } |
| 84 return false; | 82 return false; |
| 85 }; | 83 } |
| 86 | 84 |
| 87 void CastResourceDelegate::AddExtraLocalizedString( | 85 void CastResourceDelegate::AddExtraLocalizedString( |
| 88 int resource_id, | 86 int resource_id, |
| 89 const base::string16& localized) { | 87 const base::string16& localized) { |
| 90 RemoveExtraLocalizedString(resource_id); | 88 RemoveExtraLocalizedString(resource_id); |
| 91 extra_localized_strings_.insert(std::make_pair(resource_id, localized)); | 89 extra_localized_strings_.insert(std::make_pair(resource_id, localized)); |
| 92 } | 90 } |
| 93 | 91 |
| 94 void CastResourceDelegate::RemoveExtraLocalizedString(int resource_id) { | 92 void CastResourceDelegate::RemoveExtraLocalizedString(int resource_id) { |
| 95 extra_localized_strings_.erase(resource_id); | 93 extra_localized_strings_.erase(resource_id); |
| 96 } | 94 } |
| 97 | 95 |
| 98 void CastResourceDelegate::ClearAllExtraLocalizedStrings() { | 96 void CastResourceDelegate::ClearAllExtraLocalizedStrings() { |
| 99 extra_localized_strings_.clear(); | 97 extra_localized_strings_.clear(); |
| 100 } | 98 } |
| 101 | 99 |
| 102 scoped_ptr<gfx::Font> CastResourceDelegate::GetFont( | 100 scoped_ptr<gfx::Font> CastResourceDelegate::GetFont( |
| 103 ui::ResourceBundle::FontStyle style) { | 101 ui::ResourceBundle::FontStyle style) { |
| 104 return scoped_ptr<gfx::Font>(); | 102 return scoped_ptr<gfx::Font>(); |
| 105 }; | 103 } |
| 106 | 104 |
| 107 } // namespace chromecast | 105 } // namespace chromecast |
| OLD | NEW |