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

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

Issue 211493009: Ensure that extension resources are loaded with the correct scaling applied on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix try server errors Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/image_loader.cc ('k') | ui/base/resource/resource_bundle.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 #ifndef UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ 5 #ifndef UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_
6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ 6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // string if no locale data files are found and |test_file_exists| is true. 249 // string if no locale data files are found and |test_file_exists| is true.
250 // Used on Android to load the local file in the browser process and pass it 250 // Used on Android to load the local file in the browser process and pass it
251 // to the sandboxed renderer process. 251 // to the sandboxed renderer process.
252 base::FilePath GetLocaleFilePath(const std::string& app_locale, 252 base::FilePath GetLocaleFilePath(const std::string& app_locale,
253 bool test_file_exists); 253 bool test_file_exists);
254 254
255 // Returns the maximum scale factor currently loaded. 255 // Returns the maximum scale factor currently loaded.
256 // Returns SCALE_FACTOR_100P if no resource is loaded. 256 // Returns SCALE_FACTOR_100P if no resource is loaded.
257 ScaleFactor GetMaxScaleFactor() const; 257 ScaleFactor GetMaxScaleFactor() const;
258 258
259 // Returns the scale to be used for loading an image. In all platforms except
260 // windows this is based on the scale factors of the loaded resource packs.
261 // On Windows this returns the device scale factor if high dpi is enabled.
262 // |scale_factor| contains the loaded scale factor for the image.
263 static float PlatformGetImageScale(ui::ScaleFactor scale_factor);
sky 2014/03/26 13:45:37 This name is wordy (it was before, but when privat
ananta 2014/03/26 19:40:10 Removed this function. Moved this logic to ui::Get
264
259 private: 265 private:
260 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetPathForLocalePack); 266 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetPathForLocalePack);
261 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetImageNamed); 267 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetImageNamed);
262 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetNativeImageNamed); 268 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetNativeImageNamed);
263 269
264 friend class ResourceBundleImageTest; 270 friend class ResourceBundleImageTest;
265 friend class ResourceBundleTest; 271 friend class ResourceBundleTest;
266 272
267 class ResourceBundleImageSource; 273 class ResourceBundleImageSource;
268 friend class ResourceBundleImageSource; 274 friend class ResourceBundleImageSource;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 // Platform specific image scaling is done here. Currently only implemented 362 // Platform specific image scaling is done here. Currently only implemented
357 // for Windows. 363 // for Windows.
358 // |image| is the bitmap to be scaled. 364 // |image| is the bitmap to be scaled.
359 // |loaded_image_scale| is the current scale of the bitmap. 365 // |loaded_image_scale| is the current scale of the bitmap.
360 // |desired_scale| is the desired scale of the bitmap. 366 // |desired_scale| is the desired scale of the bitmap.
361 // Returns the scaled bitmap or the original bitmap. 367 // Returns the scaled bitmap or the original bitmap.
362 static SkBitmap PlatformScaleImage(const SkBitmap& image, 368 static SkBitmap PlatformScaleImage(const SkBitmap& image,
363 float loaded_image_scale, 369 float loaded_image_scale,
364 float desired_scale); 370 float desired_scale);
365 371
366 // Returns the scale to be used for loading an image. In all platforms except
367 // windows this is based on the scale factors of the loaded resource packs.
368 // On Windows this returns the device scale factor if high dpi is enabled.
369 float PlatformGetImageScale();
370
371 // This pointer is guaranteed to outlive the ResourceBundle instance and may 372 // This pointer is guaranteed to outlive the ResourceBundle instance and may
372 // be NULL. 373 // be NULL.
373 Delegate* delegate_; 374 Delegate* delegate_;
374 375
375 // Protects |images_| and font-related members. 376 // Protects |images_| and font-related members.
376 scoped_ptr<base::Lock> images_and_fonts_lock_; 377 scoped_ptr<base::Lock> images_and_fonts_lock_;
377 378
378 // Protects |locale_resources_data_|. 379 // Protects |locale_resources_data_|.
379 scoped_ptr<base::Lock> locale_resources_data_lock_; 380 scoped_ptr<base::Lock> locale_resources_data_lock_;
380 381
(...skipping 27 matching lines...) Expand all
408 409
409 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); 410 DISALLOW_COPY_AND_ASSIGN(ResourceBundle);
410 }; 411 };
411 412
412 } // namespace ui 413 } // namespace ui
413 414
414 // TODO(beng): Someday, maybe, get rid of this. 415 // TODO(beng): Someday, maybe, get rid of this.
415 using ui::ResourceBundle; 416 using ui::ResourceBundle;
416 417
417 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ 418 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/image_loader.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698