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

Side by Side Diff: ios/chrome/browser/ui/ui_util.mm

Issue 2430463003: Removed use of IsRunningOnIOS8OrLater from ui_util and uikit_ui_util (Closed)
Patch Set: one line!!!1! Created 4 years, 2 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 | « no previous file | ios/chrome/browser/ui/uikit_ui_util.mm » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ios/chrome/browser/ui/ui_util.h" 5 #include "ios/chrome/browser/ui/ui_util.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include "base/ios/ios_util.h"
10 #include "base/logging.h" 9 #include "base/logging.h"
11 #import "ios/chrome/browser/ui/uikit_ui_util.h" 10 #import "ios/chrome/browser/ui/uikit_ui_util.h"
12 #include "ui/gfx/ios/uikit_util.h" 11 #include "ui/gfx/ios/uikit_util.h"
13 12
14 bool IsIPadIdiom() { 13 bool IsIPadIdiom() {
15 UIUserInterfaceIdiom idiom = [[UIDevice currentDevice] userInterfaceIdiom]; 14 UIUserInterfaceIdiom idiom = [[UIDevice currentDevice] userInterfaceIdiom];
16 return idiom == UIUserInterfaceIdiomPad; 15 return idiom == UIUserInterfaceIdiomPad;
17 } 16 }
18 17
19 const CGFloat kPortraitWidth[INTERFACE_IDIOM_COUNT] = { 18 const CGFloat kPortraitWidth[INTERFACE_IDIOM_COUNT] = {
(...skipping 15 matching lines...) Expand all
35 return UIInterfaceOrientationIsPortrait(orient) || 34 return UIInterfaceOrientationIsPortrait(orient) ||
36 orient == UIInterfaceOrientationUnknown; 35 orient == UIInterfaceOrientationUnknown;
37 #endif // SDK 36 #endif // SDK
38 } 37 }
39 38
40 bool IsLandscape() { 39 bool IsLandscape() {
41 return UIInterfaceOrientationIsLandscape(GetInterfaceOrientation()); 40 return UIInterfaceOrientationIsLandscape(GetInterfaceOrientation());
42 } 41 }
43 42
44 CGFloat CurrentScreenHeight() { 43 CGFloat CurrentScreenHeight() {
45 CGSize screenSize = [UIScreen mainScreen].bounds.size; 44 return [UIScreen mainScreen].bounds.size.height;
46 if (base::ios::IsRunningOnIOS8OrLater()) {
47 return screenSize.height;
48 } else {
49 return IsPortrait() ? screenSize.height : screenSize.width;
50 }
51 } 45 }
52 46
53 CGFloat CurrentScreenWidth() { 47 CGFloat CurrentScreenWidth() {
54 CGSize screenSize = [UIScreen mainScreen].bounds.size; 48 return [UIScreen mainScreen].bounds.size.width;
55 if (base::ios::IsRunningOnIOS8OrLater()) {
56 return screenSize.width;
57 } else {
58 return IsPortrait() ? screenSize.width : screenSize.height;
59 }
60 } 49 }
61 50
62 CGFloat StatusBarHeight() { 51 CGFloat StatusBarHeight() {
63 // Checking [UIApplication sharedApplication].statusBarFrame will return the 52 // Checking [UIApplication sharedApplication].statusBarFrame will return the
64 // wrong offset when the application is started while in a phone call, so 53 // wrong offset when the application is started while in a phone call, so
65 // simply return 20 here. 54 // simply return 20 here.
66 return 20; 55 return 20;
67 } 56 }
68 57
69 CGFloat AlignValueToPixel(CGFloat value) { 58 CGFloat AlignValueToPixel(CGFloat value) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 projectTo.size = targetSize; 144 projectTo.size = targetSize;
156 break; 145 break;
157 } 146 }
158 147
159 projectTo = CGRectIntegral(projectTo); 148 projectTo = CGRectIntegral(projectTo);
160 // There's no CGSizeIntegral, faking one instead. 149 // There's no CGSizeIntegral, faking one instead.
161 CGRect integralRect = CGRectZero; 150 CGRect integralRect = CGRectZero;
162 integralRect.size = targetSize; 151 integralRect.size = targetSize;
163 targetSize = CGRectIntegral(integralRect).size; 152 targetSize = CGRectIntegral(integralRect).size;
164 } 153 }
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/ui/uikit_ui_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698