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

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

Issue 2930573005: Use ContainsValue() instead of std::find() in ui/android, ui/base and ui/views (Closed)
Patch Set: Changed EXPECT_FALSE to EXPECT_TRUE Created 3 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 | « ui/base/models/list_selection_model.cc ('k') | ui/base/x/selection_utils.cc » ('j') | 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 #if defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_LINUX) 679 #if defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_LINUX)
680 return max_scale_factor_; 680 return max_scale_factor_;
681 #else 681 #else
682 return GetSupportedScaleFactors().back(); 682 return GetSupportedScaleFactors().back();
683 #endif 683 #endif
684 } 684 }
685 685
686 bool ResourceBundle::IsScaleFactorSupported(ScaleFactor scale_factor) { 686 bool ResourceBundle::IsScaleFactorSupported(ScaleFactor scale_factor) {
687 const std::vector<ScaleFactor>& supported_scale_factors = 687 const std::vector<ScaleFactor>& supported_scale_factors =
688 ui::GetSupportedScaleFactors(); 688 ui::GetSupportedScaleFactors();
689 return std::find(supported_scale_factors.begin(), 689 return base::ContainsValue(supported_scale_factors, scale_factor);
690 supported_scale_factors.end(),
691 scale_factor) != supported_scale_factors.end();
692 } 690 }
693 691
694 ResourceBundle::ResourceBundle(Delegate* delegate) 692 ResourceBundle::ResourceBundle(Delegate* delegate)
695 : delegate_(delegate), 693 : delegate_(delegate),
696 locale_resources_data_lock_(new base::Lock), 694 locale_resources_data_lock_(new base::Lock),
697 max_scale_factor_(SCALE_FACTOR_100P) { 695 max_scale_factor_(SCALE_FACTOR_100P) {
698 } 696 }
699 697
700 ResourceBundle::~ResourceBundle() { 698 ResourceBundle::~ResourceBundle() {
701 FreeImages(); 699 FreeImages();
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 // static 922 // static
925 bool ResourceBundle::DecodePNG(const unsigned char* buf, 923 bool ResourceBundle::DecodePNG(const unsigned char* buf,
926 size_t size, 924 size_t size,
927 SkBitmap* bitmap, 925 SkBitmap* bitmap,
928 bool* fell_back_to_1x) { 926 bool* fell_back_to_1x) {
929 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 927 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
930 return gfx::PNGCodec::Decode(buf, size, bitmap); 928 return gfx::PNGCodec::Decode(buf, size, bitmap);
931 } 929 }
932 930
933 } // namespace ui 931 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/models/list_selection_model.cc ('k') | ui/base/x/selection_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698