Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/base/resource/resource_bundle.h" | 5 #include "ui/base/resource/resource_bundle.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 690 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
| 691 #endif | 691 #endif |
| 692 ui::SetSupportedScaleFactors(supported_scale_factors); | 692 ui::SetSupportedScaleFactors(supported_scale_factors); |
| 693 } | 693 } |
| 694 | 694 |
| 695 void ResourceBundle::FreeImages() { | 695 void ResourceBundle::FreeImages() { |
| 696 images_.clear(); | 696 images_.clear(); |
| 697 } | 697 } |
| 698 | 698 |
| 699 void ResourceBundle::LoadChromeResources() { | 699 void ResourceBundle::LoadChromeResources() { |
| 700 // TODO(estade): remove material design specific resources. | |
| 701 // See crbug.com/613593 | |
| 700 // The material design data packs contain some of the same asset IDs as in | 702 // The material design data packs contain some of the same asset IDs as in |
| 701 // the non-material design data packs. Add these to the ResourceBundle | 703 // the non-material design data packs. Add these to the ResourceBundle |
| 702 // first so that they are searched first when a request for an asset is | 704 // first so that they are searched first when a request for an asset is |
| 703 // made. | 705 // made. |
| 704 if (MaterialDesignController::IsModeMaterial()) { | 706 if (MaterialDesignController::IsModeMaterial()) { |
|
Evan Stade
2016/06/01 19:14:14
hmm, is this check necessary on !osx? Can we move
mfomitchev
2016/06/01 21:09:45
Good point. Done.
| |
| 707 #if defined(OS_MACOSX) | |
| 705 if (IsScaleFactorSupported(SCALE_FACTOR_100P)) { | 708 if (IsScaleFactorSupported(SCALE_FACTOR_100P)) { |
| 706 AddMaterialDesignDataPackFromPath( | 709 AddMaterialDesignDataPackFromPath( |
| 707 GetResourcesPakFilePath("chrome_material_100_percent.pak"), | 710 GetResourcesPakFilePath("chrome_material_100_percent.pak"), |
| 708 SCALE_FACTOR_100P); | 711 SCALE_FACTOR_100P); |
| 709 } | 712 } |
| 710 | 713 |
| 711 if (IsScaleFactorSupported(SCALE_FACTOR_200P)) { | 714 if (IsScaleFactorSupported(SCALE_FACTOR_200P)) { |
| 712 AddOptionalMaterialDesignDataPackFromPath( | 715 AddOptionalMaterialDesignDataPackFromPath( |
| 713 GetResourcesPakFilePath("chrome_material_200_percent.pak"), | 716 GetResourcesPakFilePath("chrome_material_200_percent.pak"), |
| 714 SCALE_FACTOR_200P); | 717 SCALE_FACTOR_200P); |
| 715 } | 718 } |
| 719 #endif | |
| 716 } | 720 } |
| 717 | 721 |
| 718 // Always load the 1x data pack first as the 2x data pack contains both 1x and | 722 // Always load the 1x data pack first as the 2x data pack contains both 1x and |
| 719 // 2x images. The 1x data pack only has 1x images, thus passes in an accurate | 723 // 2x images. The 1x data pack only has 1x images, thus passes in an accurate |
| 720 // scale factor to gfx::ImageSkia::AddRepresentation. | 724 // scale factor to gfx::ImageSkia::AddRepresentation. |
| 721 if (IsScaleFactorSupported(SCALE_FACTOR_100P)) { | 725 if (IsScaleFactorSupported(SCALE_FACTOR_100P)) { |
| 722 AddDataPackFromPath(GetResourcesPakFilePath( | 726 AddDataPackFromPath(GetResourcesPakFilePath( |
| 723 "chrome_100_percent.pak"), SCALE_FACTOR_100P); | 727 "chrome_100_percent.pak"), SCALE_FACTOR_100P); |
| 724 } | 728 } |
| 725 | 729 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 896 // static | 900 // static |
| 897 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 901 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 898 size_t size, | 902 size_t size, |
| 899 SkBitmap* bitmap, | 903 SkBitmap* bitmap, |
| 900 bool* fell_back_to_1x) { | 904 bool* fell_back_to_1x) { |
| 901 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 905 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 902 return gfx::PNGCodec::Decode(buf, size, bitmap); | 906 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 903 } | 907 } |
| 904 | 908 |
| 905 } // namespace ui | 909 } // namespace ui |
| OLD | NEW |