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

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

Issue 10928093: Adds an iOS implementation of gfx::Image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@skia
Patch Set: Nits. Created 8 years, 3 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
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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "ui/base/ui_base_switches.h" 15 #include "ui/base/ui_base_switches.h"
16 16
17 #if defined(USE_AURA) && !defined(OS_WIN) 17 #if defined(USE_AURA) && !defined(OS_WIN)
18 #include "ui/aura/root_window.h" 18 #include "ui/aura/root_window.h"
19 #include "ui/compositor/compositor.h" 19 #include "ui/compositor/compositor.h"
20 #endif // defined(USE_AURA) && !defined(OS_WIN) 20 #endif // defined(USE_AURA) && !defined(OS_WIN)
21 21
22 #if defined(OS_MACOSX) 22 #if defined(OS_MACOSX) && !defined(OS_IOS)
23 #include "base/mac/mac_util.h" 23 #include "base/mac/mac_util.h"
24 #endif 24 #endif
25 25
26 #if defined(OS_WIN) 26 #if defined(OS_WIN)
27 #include "base/win/metro.h" 27 #include "base/win/metro.h"
28 #include <Windows.h> 28 #include <Windows.h>
29 #endif // defined(OS_WIN) 29 #endif // defined(OS_WIN)
30 30
31 namespace { 31 namespace {
32 32
(...skipping 30 matching lines...) Expand all
63 const float kScaleFactorScales[] = {1.0f, 1.4f, 1.8f, 2.0f}; 63 const float kScaleFactorScales[] = {1.0f, 1.4f, 1.8f, 2.0f};
64 COMPILE_ASSERT(ui::NUM_SCALE_FACTORS == arraysize(kScaleFactorScales), 64 COMPILE_ASSERT(ui::NUM_SCALE_FACTORS == arraysize(kScaleFactorScales),
65 kScaleFactorScales_incorrect_size); 65 kScaleFactorScales_incorrect_size);
66 const size_t kScaleFactorScalesLength = arraysize(kScaleFactorScales); 66 const size_t kScaleFactorScalesLength = arraysize(kScaleFactorScales);
67 67
68 std::vector<ui::ScaleFactor>& GetSupportedScaleFactorsInternal() { 68 std::vector<ui::ScaleFactor>& GetSupportedScaleFactorsInternal() {
69 static std::vector<ui::ScaleFactor>* supported_scale_factors = 69 static std::vector<ui::ScaleFactor>* supported_scale_factors =
70 new std::vector<ui::ScaleFactor>(); 70 new std::vector<ui::ScaleFactor>();
71 if (supported_scale_factors->empty()) { 71 if (supported_scale_factors->empty()) {
72 supported_scale_factors->push_back(ui::SCALE_FACTOR_100P); 72 supported_scale_factors->push_back(ui::SCALE_FACTOR_100P);
73 #if defined(OS_MACOSX) && defined(ENABLE_HIDPI) 73 #if defined(OS_MACOSX) && !defined(OS_IOS) && defined(ENABLE_HIDPI)
Nico 2012/09/14 00:52:19 How does HiDPI code work on iOS? Seems like you'd
rohitrao (ping after 24h) 2012/09/14 01:07:18 This bit is TBD; I still need to work out exactly
Nico 2012/09/14 01:13:37 SGTM. Can you add a "TODO: Figure out ios" comment
rohitrao (ping after 24h) 2012/09/14 01:30:29 Added a TODO. I'll be looking at this either tomo
74 if (base::mac::IsOSLionOrLater()) 74 if (base::mac::IsOSLionOrLater())
75 supported_scale_factors->push_back(ui::SCALE_FACTOR_200P); 75 supported_scale_factors->push_back(ui::SCALE_FACTOR_200P);
76 #elif defined(OS_WIN) && defined(ENABLE_HIDPI) 76 #elif defined(OS_WIN) && defined(ENABLE_HIDPI)
77 if (base::win::IsMetroProcess() && base::win::IsTouchEnabled()) { 77 if (base::win::IsMetroProcess() && base::win::IsTouchEnabled()) {
78 supported_scale_factors->push_back(ui::SCALE_FACTOR_140P); 78 supported_scale_factors->push_back(ui::SCALE_FACTOR_140P);
79 supported_scale_factors->push_back(ui::SCALE_FACTOR_180P); 79 supported_scale_factors->push_back(ui::SCALE_FACTOR_180P);
80 } 80 }
81 #elif defined(USE_ASH) 81 #elif defined(USE_ASH)
82 supported_scale_factors->push_back(ui::SCALE_FACTOR_200P); 82 supported_scale_factors->push_back(ui::SCALE_FACTOR_200P);
83 #endif 83 #endif
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return GetScaleFactorFromScale( 154 return GetScaleFactorFromScale(
155 root_window->compositor()->device_scale_factor()); 155 root_window->compositor()->device_scale_factor());
156 #else 156 #else
157 NOTIMPLEMENTED(); 157 NOTIMPLEMENTED();
158 return SCALE_FACTOR_NONE; 158 return SCALE_FACTOR_NONE;
159 #endif 159 #endif
160 } 160 }
161 #endif // !defined(OS_MACOSX) 161 #endif // !defined(OS_MACOSX)
162 162
163 } // namespace ui 163 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698