Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: ui/base/resource/resource_bundle.cc

Issue 2028103002: Do not try to load material design paks if not on Mac OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698