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

Side by Side Diff: ui/base/layout.cc

Issue 1025513004: Ensure that the extension icons show up in the omnibox at fractional scales. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move IsSupportedScale to ui\base\layout.cc/.h Created 5 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
« no previous file with comments | « ui/base/layout.h ('k') | 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/layout.h" 5 #include "ui/base/layout.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return gfx::GetDPIScale(); 85 return gfx::GetDPIScale();
86 #else 86 #else
87 return GetScaleForScaleFactor(scale_factor); 87 return GetScaleForScaleFactor(scale_factor);
88 #endif 88 #endif
89 } 89 }
90 90
91 float GetScaleForScaleFactor(ScaleFactor scale_factor) { 91 float GetScaleForScaleFactor(ScaleFactor scale_factor) {
92 return kScaleFactorScales[scale_factor]; 92 return kScaleFactorScales[scale_factor];
93 } 93 }
94 94
95 bool IsSupportedScale(float scale) {
96 const std::vector<float>& supported_scales =
97 gfx::ImageSkia::GetSupportedScales();
sky 2015/03/25 14:49:10 Why are you using ImageSkia and not g_supported_sc
ananta 2015/03/25 16:56:05 Done.
98 return std::find(supported_scales.begin(), supported_scales.end(), scale)
99 != supported_scales.end();
100 }
101
95 namespace test { 102 namespace test {
96 103
97 ScopedSetSupportedScaleFactors::ScopedSetSupportedScaleFactors( 104 ScopedSetSupportedScaleFactors::ScopedSetSupportedScaleFactors(
98 const std::vector<ui::ScaleFactor>& new_scale_factors) { 105 const std::vector<ui::ScaleFactor>& new_scale_factors) {
99 if (g_supported_scale_factors) { 106 if (g_supported_scale_factors) {
100 original_scale_factors_ = 107 original_scale_factors_ =
101 new std::vector<ScaleFactor>(*g_supported_scale_factors); 108 new std::vector<ScaleFactor>(*g_supported_scale_factors);
102 } else { 109 } else {
103 original_scale_factors_ = NULL; 110 original_scale_factors_ = NULL;
104 } 111 }
(...skipping 14 matching lines...) Expand all
119 126
120 #if !defined(OS_MACOSX) 127 #if !defined(OS_MACOSX)
121 float GetScaleFactorForNativeView(gfx::NativeView view) { 128 float GetScaleFactorForNativeView(gfx::NativeView view) {
122 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); 129 gfx::Screen* screen = gfx::Screen::GetScreenFor(view);
123 gfx::Display display = screen->GetDisplayNearestWindow(view); 130 gfx::Display display = screen->GetDisplayNearestWindow(view);
124 return display.device_scale_factor(); 131 return display.device_scale_factor();
125 } 132 }
126 #endif // !defined(OS_MACOSX) 133 #endif // !defined(OS_MACOSX)
127 134
128 } // namespace ui 135 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/layout.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698