summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/api/downloads/downloads_api.cc4
-rw-r--r--chrome/browser/thumbnails/thumbnail_tab_helper.cc5
-rw-r--r--chrome/browser/thumbnails/thumbnailing_algorithm.h1
-rw-r--r--chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc4
-rw-r--r--chrome/browser/ui/views/create_application_shortcut_view.cc5
-rw-r--r--chrome/browser/ui/webui/chromeos/login/network_dropdown.cc5
-rw-r--r--chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc10
-rw-r--r--chrome/browser/ui/webui/sync_setup_handler_unittest.cc4
-rw-r--r--content/browser/renderer_host/dip_util.cc16
-rw-r--r--content/browser/renderer_host/dip_util.h6
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_browsertest.cc19
-rw-r--r--content/browser/renderer_host/render_widget_host_view_mac.mm12
-rw-r--r--content/browser/web_contents/aura/overscroll_navigation_overlay.cc4
-rw-r--r--content/browser/web_contents/web_contents_view_aura.cc3
-rw-r--r--content/browser/webui/web_ui_impl.cc2
-rw-r--r--content/browser/webui/web_ui_impl.h2
-rw-r--r--content/public/browser/web_ui.h3
-rw-r--r--ui/app_list/views/app_list_main_view.cc7
-rw-r--r--ui/base/layout.cc6
-rw-r--r--ui/base/layout.h2
-rw-r--r--ui/base/layout_mac.mm4
-rw-r--r--ui/message_center/views/notification_view.cc10
23 files changed, 59 insertions, 77 deletions
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc
index 46f1d4e..04e7e32 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -1519,8 +1519,8 @@ bool DownloadsGetFileIconFunction::RunAsync() {
content::WebContents* web_contents =
dispatcher()->delegate()->GetVisibleWebContents();
if (web_contents) {
- scale = ui::GetImageScale(ui::GetScaleFactorForNativeView(
- web_contents->GetRenderWidgetHostView()->GetNativeView()));
+ scale = ui::GetScaleFactorForNativeView(
+ web_contents->GetRenderWidgetHostView()->GetNativeView());
}
EXTENSION_FUNCTION_VALIDATE(icon_extractor_->ExtractIconURLForPath(
download_item->GetTargetFilePath(),
diff --git a/chrome/browser/thumbnails/thumbnail_tab_helper.cc b/chrome/browser/thumbnails/thumbnail_tab_helper.cc
index 43fba1a..7206373 100644
--- a/chrome/browser/thumbnails/thumbnail_tab_helper.cc
+++ b/chrome/browser/thumbnails/thumbnail_tab_helper.cc
@@ -96,9 +96,12 @@ void AsyncProcessThumbnail(content::WebContents* web_contents,
if (copy_rect.IsEmpty())
return;
+ ui::ScaleFactor scale_factor =
+ ui::GetSupportedScaleFactor(
+ ui::GetScaleFactorForNativeView(view->GetNativeView()));
context->clip_result = algorithm->GetCanvasCopyInfo(
copy_rect.size(),
- ui::GetScaleFactorForNativeView(view->GetNativeView()),
+ scale_factor,
&copy_rect,
&context->requested_copy_size);
render_widget_host->CopyFromBackingStore(
diff --git a/chrome/browser/thumbnails/thumbnailing_algorithm.h b/chrome/browser/thumbnails/thumbnailing_algorithm.h
index 3211af2..11b44763 100644
--- a/chrome/browser/thumbnails/thumbnailing_algorithm.h
+++ b/chrome/browser/thumbnails/thumbnailing_algorithm.h
@@ -7,6 +7,7 @@
#include "base/memory/ref_counted.h"
#include "chrome/browser/thumbnails/thumbnailing_context.h"
+#include "ui/base/layout.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index 77b01ae..5585aba 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -1432,9 +1432,9 @@ gfx::Image AutofillDialogControllerImpl::GetGeneratedCardImage(
const int kCardWidthPx = 300;
const int kCardHeightPx = 190;
const gfx::Size size(kCardWidthPx, kCardHeightPx);
- ui::ScaleFactor scale_factor = ui::GetScaleFactorForNativeView(
+ float scale_factor = ui::GetScaleFactorForNativeView(
web_contents()->GetNativeView());
- gfx::Canvas canvas(size, ui::GetImageScale(scale_factor), false);
+ gfx::Canvas canvas(size, scale_factor, false);
gfx::Rect display_rect(size);
diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc
index a84cc04..b0e6e25 100644
--- a/chrome/browser/ui/views/create_application_shortcut_view.cc
+++ b/chrome/browser/ui/views/create_application_shortcut_view.cc
@@ -495,8 +495,9 @@ void CreateUrlApplicationShortcutView::DidDownloadFavicon(
if (!bitmaps.empty()) {
std::vector<ui::ScaleFactor> scale_factors;
- ui::ScaleFactor scale_factor = ui::GetScaleFactorForNativeView(
- web_contents_->GetRenderViewHost()->GetView()->GetNativeView());
+ ui::ScaleFactor scale_factor = ui::GetSupportedScaleFactor(
+ ui::GetScaleFactorForNativeView(
+ web_contents_->GetRenderViewHost()->GetView()->GetNativeView()));
scale_factors.push_back(scale_factor);
std::vector<size_t> closest_indices;
SelectFaviconFrameIndices(original_bitmap_sizes,
diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
index 7c0ee03..19fe7ed 100644
--- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
+++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc
@@ -90,8 +90,7 @@ base::ListValue* NetworkMenuWebUI::ConvertMenuModel(ui::MenuModel* model) {
gfx::Image icon;
if (model->GetIconAt(i, &icon)) {
SkBitmap icon_bitmap = icon.ToImageSkia()->GetRepresentation(
- ui::GetImageScale(
- web_ui_->GetDeviceScaleFactor())).sk_bitmap();
+ web_ui_->GetDeviceScaleFactor()).sk_bitmap();
item->SetString("icon", webui::GetBitmapDataUrl(icon_bitmap));
}
if (id >= 0) {
@@ -192,7 +191,7 @@ void NetworkDropdown::SetNetworkIconAndText() {
RemoveObserver(this);
}
SkBitmap icon_bitmap = icon_image.GetRepresentation(
- ui::GetImageScale(web_ui_->GetDeviceScaleFactor())).sk_bitmap();
+ web_ui_->GetDeviceScaleFactor()).sk_bitmap();
std::string icon_str;
if (!icon_image.isNull())
icon_str = webui::GetBitmapDataUrl(icon_bitmap);
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index 03740a9..098bbb1d5 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -314,10 +314,10 @@ bool HasPolicyForNetwork(const NetworkState* network,
void SetCommonNetworkInfo(const ManagedState* state,
const gfx::ImageSkia& icon,
- ui::ScaleFactor icon_scale_factor,
+ float icon_scale_factor,
base::DictionaryValue* network_info) {
gfx::ImageSkiaRep image_rep =
- icon.GetRepresentation(ui::GetImageScale(icon_scale_factor));
+ icon.GetRepresentation(icon_scale_factor);
std::string icon_url =
icon.isNull() ? "" : webui::GetBitmapDataUrl(image_rep.sk_bitmap());
network_info->SetString(kNetworkInfoKeyIconURL, icon_url);
@@ -337,7 +337,7 @@ void SetCommonNetworkInfo(const ManagedState* state,
// transferred to the caller.
base::DictionaryValue* BuildNetworkDictionary(
const NetworkState* network,
- ui::ScaleFactor icon_scale_factor,
+ float icon_scale_factor,
const PrefService* profile_prefs) {
scoped_ptr<base::DictionaryValue> network_info(new base::DictionaryValue());
network_info->SetBoolean(kNetworkInfoKeyConnectable, network->connectable());
@@ -356,7 +356,7 @@ base::DictionaryValue* BuildNetworkDictionary(
base::DictionaryValue* BuildFavoriteDictionary(
const FavoriteState* favorite,
- ui::ScaleFactor icon_scale_factor,
+ float icon_scale_factor,
const PrefService* profile_prefs) {
scoped_ptr<base::DictionaryValue> network_info(new base::DictionaryValue());
network_info->SetBoolean(kNetworkInfoKeyConnectable, false);
@@ -1262,7 +1262,7 @@ std::string InternetOptionsHandler::GetIconDataUrl(int resource_id) const {
gfx::ImageSkia* icon =
ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id);
gfx::ImageSkiaRep image_rep = icon->GetRepresentation(
- ui::GetImageScale(web_ui()->GetDeviceScaleFactor()));
+ web_ui()->GetDeviceScaleFactor());
return webui::GetBitmapDataUrl(image_rep.sk_bitmap());
}
diff --git a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc
index 6a888dc..dc79472 100644
--- a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc
+++ b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc
@@ -194,8 +194,8 @@ class TestWebUI : public content::WebUI {
return NULL;
}
virtual void SetController(content::WebUIController* controller) OVERRIDE {}
- virtual ui::ScaleFactor GetDeviceScaleFactor() const OVERRIDE {
- return ui::SCALE_FACTOR_100P;
+ virtual float GetDeviceScaleFactor() const OVERRIDE {
+ return 1.0f;
}
virtual const base::string16& GetOverriddenTitle() const OVERRIDE {
return temp_string_;
diff --git a/content/browser/renderer_host/dip_util.cc b/content/browser/renderer_host/dip_util.cc
index a41c4d1..3049015 100644
--- a/content/browser/renderer_host/dip_util.cc
+++ b/content/browser/renderer_host/dip_util.cc
@@ -5,6 +5,7 @@
#include "content/browser/renderer_host/dip_util.h"
#include "content/public/browser/render_widget_host_view.h"
+#include "ui/base/layout.h"
#include "ui/gfx/display.h"
#include "ui/gfx/point.h"
#include "ui/gfx/point_conversions.h"
@@ -15,32 +16,25 @@
#include "ui/gfx/size_conversions.h"
namespace content {
-namespace {
-float GetScaleForView(const RenderWidgetHostView* view) {
- return ui::GetImageScale(GetScaleFactorForView(view));
-}
-
-} // namespace
-
-ui::ScaleFactor GetScaleFactorForView(const RenderWidgetHostView* view) {
+float GetScaleFactorForView(const RenderWidgetHostView* view) {
return ui::GetScaleFactorForNativeView(view ? view->GetNativeView() : NULL);
}
gfx::Point ConvertViewPointToDIP(const RenderWidgetHostView* view,
const gfx::Point& point_in_pixel) {
return gfx::ToFlooredPoint(
- gfx::ScalePoint(point_in_pixel, 1.0f / GetScaleForView(view)));
+ gfx::ScalePoint(point_in_pixel, 1.0f / GetScaleFactorForView(view)));
}
gfx::Size ConvertViewSizeToPixel(const RenderWidgetHostView* view,
const gfx::Size& size_in_dip) {
- return ConvertSizeToPixel(GetScaleForView(view), size_in_dip);
+ return ConvertSizeToPixel(GetScaleFactorForView(view), size_in_dip);
}
gfx::Rect ConvertViewRectToPixel(const RenderWidgetHostView* view,
const gfx::Rect& rect_in_dip) {
- return ConvertRectToPixel(GetScaleForView(view), rect_in_dip);
+ return ConvertRectToPixel(GetScaleFactorForView(view), rect_in_dip);
}
gfx::Size ConvertSizeToDIP(float scale_factor,
diff --git a/content/browser/renderer_host/dip_util.h b/content/browser/renderer_host/dip_util.h
index 82c9772..27e7dd1 100644
--- a/content/browser/renderer_host/dip_util.h
+++ b/content/browser/renderer_host/dip_util.h
@@ -6,7 +6,6 @@
#define CONTENT_BROWSER_RENDERER_HOST_DIP_UTIL_H_
#include "content/common/content_export.h"
-#include "ui/base/layout.h"
namespace gfx {
class Point;
@@ -18,9 +17,8 @@ namespace content {
class RenderWidgetHostView;
// Returns scale factor of the display nearest to |view|.
-// Returns ui::SCALE_FACTOR_100P if the platform does not support DIP.
-CONTENT_EXPORT ui::ScaleFactor GetScaleFactorForView(
- const RenderWidgetHostView* view);
+// Returns 1.0f if the platform does not support DIP.
+CONTENT_EXPORT float GetScaleFactorForView(const RenderWidgetHostView* view);
// Utility functions that convert point/size/rect between DIP and pixel
// coordinate system.
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 28cd264..24f9222 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -1289,7 +1289,7 @@ void RenderViewHostImpl::OnStartDragging(
filtered_data.file_system_files.push_back(drop_data.file_system_files[i]);
}
- float scale = ui::GetImageScale(GetScaleFactorForView(GetView()));
+ float scale = GetScaleFactorForView(GetView());
gfx::ImageSkia image(gfx::ImageSkiaRep(bitmap, scale));
view->StartDragging(filtered_data, drag_operations_mask, image,
bitmap_offset_in_dip, event_info);
diff --git a/content/browser/renderer_host/render_widget_host_view_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_browsertest.cc
index d987b2a..2a54985 100644
--- a/content/browser/renderer_host/render_widget_host_view_browsertest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_browsertest.cc
@@ -27,6 +27,7 @@
#include "net/base/filename_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
+#include "ui/base/layout.h"
#include "ui/base/ui_base_switches.h"
#include "ui/gfx/size_conversions.h"
#include "ui/gfx/switches.h"
@@ -54,16 +55,6 @@ namespace {
return; \
}
-// Convenience macro: Short-circuit a pass for platforms where setting up
-// high-DPI fails.
-#define PASS_TEST_IF_SCALE_FACTOR_NOT_SUPPORTED(factor) \
- if (ui::GetScaleForScaleFactor( \
- GetScaleFactorForView(GetRenderWidgetHostView())) != factor) { \
- LOG(WARNING) << "Blindly passing this test: failed to set up " \
- "scale factor: " << factor; \
- return false; \
- }
-
// Common base class for browser tests. This is subclassed twice: Once to test
// the browser in forced-compositing mode, and once to test with compositing
// mode disabled.
@@ -810,7 +801,13 @@ class CompositingRenderWidgetHostViewTabCaptureHighDPI
private:
virtual bool ShouldContinueAfterTestURLLoad() OVERRIDE {
- PASS_TEST_IF_SCALE_FACTOR_NOT_SUPPORTED(scale());
+ // Short-circuit a pass for platforms where setting up high-DPI fails.
+ if (ui::GetScaleForScaleFactor(ui::GetSupportedScaleFactor(
+ GetScaleFactorForView(GetRenderWidgetHostView()))) != scale()) {
+ LOG(WARNING) << "Blindly passing this test: failed to set up "
+ "scale factor: " << scale();
+ return false;
+ }
return true;
}
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index b50fd99..df7b921 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -149,10 +149,6 @@ static BOOL SupportsBackingPropertiesChangedNotification() {
return methodDescription.name != NULL || methodDescription.types != NULL;
}
-static float ScaleFactorForView(NSView* view) {
- return ui::GetImageScale(ui::GetScaleFactorForNativeView(view));
-}
-
// Private methods:
@interface RenderWidgetHostViewCocoa ()
@property(nonatomic, assign) NSRange selectedRange;
@@ -809,7 +805,7 @@ int RenderWidgetHostViewMac::window_number() const {
}
float RenderWidgetHostViewMac::ViewScaleFactor() const {
- return ScaleFactorForView(cocoa_view_);
+ return ui::GetScaleFactorForNativeView(cocoa_view_);
}
void RenderWidgetHostViewMac::UpdateDisplayLink() {
@@ -847,7 +843,7 @@ void RenderWidgetHostViewMac::UpdateBackingStoreScaleFactor() {
if (!render_widget_host_)
return;
- float new_scale_factor = ScaleFactorForView(cocoa_view_);
+ float new_scale_factor = ui::GetScaleFactorForNativeView(cocoa_view_);
if (new_scale_factor == backing_store_scale_factor_)
return;
backing_store_scale_factor_ = new_scale_factor;
@@ -1251,7 +1247,7 @@ void RenderWidgetHostViewMac::CopyFromCompositingSurface(
}
base::ScopedClosureRunner scoped_callback_runner(
base::Bind(callback, false, SkBitmap()));
- float scale = ScaleFactorForView(cocoa_view_);
+ float scale = ui::GetScaleFactorForNativeView(cocoa_view_);
gfx::Size dst_pixel_size = gfx::ToFlooredSize(
gfx::ScaleSize(dst_size, scale));
if (compositing_iosurface_ && compositing_iosurface_->HasIOSurface()) {
@@ -2495,7 +2491,7 @@ SkBitmap::Config RenderWidgetHostViewMac::PreferredReadbackFormat() {
canBeKeyView_ = YES;
focusedPluginIdentifier_ = -1;
renderWidgetHostView_->backing_store_scale_factor_ =
- ScaleFactorForView(self);
+ ui::GetScaleFactorForNativeView(self);
// OpenGL support:
if ([self respondsToSelector:
diff --git a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc
index 0d66ff1..226f97b 100644
--- a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc
+++ b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc
@@ -12,6 +12,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_widget_host_view.h"
#include "ui/aura/window.h"
+#include "ui/base/layout.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_observer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
@@ -196,8 +197,7 @@ ui::Layer* OverscrollNavigationOverlay::CreateSlideLayer(int offset) {
if (entry && entry->screenshot().get()) {
std::vector<gfx::ImagePNGRep> image_reps;
image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(),
- ui::GetImageScale(
- ui::GetScaleFactorForNativeView(window_.get()))));
+ ui::GetScaleFactorForNativeView(window_.get())));
image = gfx::Image(image_reps);
}
if (!layer_delegate_)
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index 2b29df7..f87411e 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -132,8 +132,7 @@ class OverscrollWindowDelegate : public ImageWindowDelegate {
if (entry && entry->screenshot().get()) {
std::vector<gfx::ImagePNGRep> image_reps;
image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(),
- ui::GetImageScale(
- ui::GetScaleFactorForNativeView(web_contents_window()))));
+ ui::GetScaleFactorForNativeView(web_contents_window())));
image = gfx::Image(image_reps);
}
SetImage(image);
diff --git a/content/browser/webui/web_ui_impl.cc b/content/browser/webui/web_ui_impl.cc
index 72261c3..340a047 100644
--- a/content/browser/webui/web_ui_impl.cc
+++ b/content/browser/webui/web_ui_impl.cc
@@ -98,7 +98,7 @@ WebContents* WebUIImpl::GetWebContents() const {
return web_contents_;
}
-ui::ScaleFactor WebUIImpl::GetDeviceScaleFactor() const {
+float WebUIImpl::GetDeviceScaleFactor() const {
return GetScaleFactorForView(web_contents_->GetRenderWidgetHostView());
}
diff --git a/content/browser/webui/web_ui_impl.h b/content/browser/webui/web_ui_impl.h
index b718dad..40cb559 100644
--- a/content/browser/webui/web_ui_impl.h
+++ b/content/browser/webui/web_ui_impl.h
@@ -34,7 +34,7 @@ class CONTENT_EXPORT WebUIImpl : public WebUI,
virtual WebContents* GetWebContents() const OVERRIDE;
virtual WebUIController* GetController() const OVERRIDE;
virtual void SetController(WebUIController* controller) OVERRIDE;
- virtual ui::ScaleFactor GetDeviceScaleFactor() const OVERRIDE;
+ virtual float GetDeviceScaleFactor() const OVERRIDE;
virtual const base::string16& GetOverriddenTitle() const OVERRIDE;
virtual void OverrideTitle(const base::string16& title) OVERRIDE;
virtual PageTransition GetLinkTransitionType() const OVERRIDE;
diff --git a/content/public/browser/web_ui.h b/content/public/browser/web_ui.h
index 9d13240..52ce114 100644
--- a/content/public/browser/web_ui.h
+++ b/content/public/browser/web_ui.h
@@ -12,7 +12,6 @@
#include "base/strings/string16.h"
#include "content/common/content_export.h"
#include "content/public/common/page_transition_types.h"
-#include "ui/base/layout.h"
class GURL;
@@ -55,7 +54,7 @@ class CONTENT_EXPORT WebUI {
// Returns the device scale factor of the monitor that the renderer is on.
// Whenever possible, WebUI should push resources with this scale factor to
// Javascript.
- virtual ui::ScaleFactor GetDeviceScaleFactor() const = 0;
+ virtual float GetDeviceScaleFactor() const = 0;
// Gets a custom tab title provided by the Web UI. If there is no title
// override, the string will be empty which should trigger the default title
diff --git a/ui/app_list/views/app_list_main_view.cc b/ui/app_list/views/app_list_main_view.cc
index 19b2983..dcb5780 100644
--- a/ui/app_list/views/app_list_main_view.cc
+++ b/ui/app_list/views/app_list_main_view.cc
@@ -188,11 +188,10 @@ bool AppListMainView::ShouldCenterWindow() const {
}
void AppListMainView::PreloadIcons(gfx::NativeView parent) {
- ui::ScaleFactor scale_factor = ui::SCALE_FACTOR_100P;
+ float scale_factor = 1.0f;
if (parent)
scale_factor = ui::GetScaleFactorForNativeView(parent);
- float scale = ui::GetImageScale(scale_factor);
// |pagination_model| could have -1 as the initial selected page and
// assumes first page (i.e. index 0) will be used in this case.
const int selected_page = std::max(0, pagination_model_->selected_page());
@@ -206,10 +205,10 @@ void AppListMainView::PreloadIcons(gfx::NativeView parent) {
pending_icon_loaders_.clear();
for (int i = start_model_index; i < end_model_index; ++i) {
AppListItem* item = model_->top_level_item_list()->item_at(i);
- if (item->icon().HasRepresentation(scale))
+ if (item->icon().HasRepresentation(scale_factor))
continue;
- pending_icon_loaders_.push_back(new IconLoader(this, item, scale));
+ pending_icon_loaders_.push_back(new IconLoader(this, item, scale_factor));
}
}
diff --git a/ui/base/layout.cc b/ui/base/layout.cc
index 783ab5a..6ce0ccc 100644
--- a/ui/base/layout.cc
+++ b/ui/base/layout.cc
@@ -144,13 +144,13 @@ ScopedSetSupportedScaleFactors::~ScopedSetSupportedScaleFactors() {
} // namespace test
#if !defined(OS_MACOSX)
-ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view) {
+float GetScaleFactorForNativeView(gfx::NativeView view) {
gfx::Screen* screen = gfx::Screen::GetScreenFor(view);
if (screen->IsDIPEnabled()) {
gfx::Display display = screen->GetDisplayNearestWindow(view);
- return GetSupportedScaleFactor(display.device_scale_factor());
+ return display.device_scale_factor();
}
- return ui::SCALE_FACTOR_100P;
+ return 1.0f;
}
#endif // !defined(OS_MACOSX)
diff --git a/ui/base/layout.h b/ui/base/layout.h
index df9f6cc..846bb21 100644
--- a/ui/base/layout.h
+++ b/ui/base/layout.h
@@ -53,7 +53,7 @@ UI_BASE_EXPORT float GetImageScale(ScaleFactor scale_factor);
UI_BASE_EXPORT ScaleFactor GetSupportedScaleFactor(float image_scale);
// Returns the ScaleFactor used by |view|.
-UI_BASE_EXPORT ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view);
+UI_BASE_EXPORT float GetScaleFactorForNativeView(gfx::NativeView view);
// Returns true if |scale_factor| is supported by this platform.
UI_BASE_EXPORT bool IsScaleFactorSupported(ScaleFactor scale_factor);
diff --git a/ui/base/layout_mac.mm b/ui/base/layout_mac.mm
index 6e50de1..62331e9 100644
--- a/ui/base/layout_mac.mm
+++ b/ui/base/layout_mac.mm
@@ -31,8 +31,8 @@ float GetScaleFactorScaleForNativeView(gfx::NativeView view) {
namespace ui {
-ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view) {
- return GetSupportedScaleFactor(GetScaleFactorScaleForNativeView(view));
+float GetScaleFactorForNativeView(gfx::NativeView view) {
+ return GetScaleFactorScaleForNativeView(view);
}
} // namespace ui
diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc
index 0884205..a0e78f7 100644
--- a/ui/message_center/views/notification_view.cc
+++ b/ui/message_center/views/notification_view.cc
@@ -82,16 +82,12 @@ scoped_ptr<views::Border> MakeSeparatorBorder(int top,
// Return true if and only if the image is null or has alpha.
bool HasAlpha(gfx::ImageSkia& image, views::Widget* widget) {
// Determine which bitmap to use.
- ui::ScaleFactor factor = ui::SCALE_FACTOR_100P;
- if (widget) {
+ float factor = 1.0f;
+ if (widget)
factor = ui::GetScaleFactorForNativeView(widget->GetNativeView());
- if (factor == ui::SCALE_FACTOR_NONE)
- factor = ui::SCALE_FACTOR_100P;
- }
// Extract that bitmap's alpha and look for a non-opaque pixel there.
- SkBitmap bitmap =
- image.GetRepresentation(ui::GetImageScale(factor)).sk_bitmap();
+ SkBitmap bitmap = image.GetRepresentation(factor).sk_bitmap();
if (!bitmap.isNull()) {
SkBitmap alpha;
bitmap.extractAlpha(&alpha);