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

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

Issue 2567203002: Revert of [ObjC ARC] Converts ios/chrome/browser/ui:ui to ARC. (Closed)
Patch Set: Created 4 years 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 | « ios/chrome/browser/ui/ui_util.mm ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #import "ios/chrome/browser/ui/uikit_ui_util.h" 5 #import "ios/chrome/browser/ui/uikit_ui_util.h"
6 6
7 #import <Accelerate/Accelerate.h> 7 #import <Accelerate/Accelerate.h>
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 #import <QuartzCore/QuartzCore.h> 9 #import <QuartzCore/QuartzCore.h>
10 #include <stddef.h> 10 #include <stddef.h>
11 #include <stdint.h> 11 #include <stdint.h>
12 #import <UIKit/UIKit.h> 12 #import <UIKit/UIKit.h>
13 #include <cmath> 13 #include <cmath>
14 14
15 #include "base/ios/ios_util.h" 15 #include "base/ios/ios_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/mac/foundation_util.h" 17 #include "base/mac/foundation_util.h"
18 #include "base/mac/scoped_nsobject.h"
18 #include "ios/chrome/browser/experimental_flags.h" 19 #include "ios/chrome/browser/experimental_flags.h"
19 #include "ios/chrome/browser/ui/ui_util.h" 20 #include "ios/chrome/browser/ui/ui_util.h"
20 #include "ios/web/public/web_thread.h" 21 #include "ios/web/public/web_thread.h"
21 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/l10n/l10n_util_mac.h" 23 #include "ui/base/l10n/l10n_util_mac.h"
23 #include "ui/gfx/ios/uikit_util.h" 24 #include "ui/gfx/ios/uikit_util.h"
24 #include "ui/gfx/scoped_cg_context_save_gstate_mac.h" 25 #include "ui/gfx/scoped_cg_context_save_gstate_mac.h"
25 26
26 #if !defined(__has_feature) || !__has_feature(objc_arc)
27 #error "This file requires ARC support."
28 #endif
29
30 namespace { 27 namespace {
31 28
32 // Linearly interpolate between |a| and |b| by fraction |f|. Satisfies 29 // Linearly interpolate between |a| and |b| by fraction |f|. Satisfies
33 // |Lerp(a,b,0) == a| and |Lerp(a,b,1) == b|. 30 // |Lerp(a,b,0) == a| and |Lerp(a,b,1) == b|.
34 CGFloat Lerp(CGFloat a, CGFloat b, CGFloat fraction) { 31 CGFloat Lerp(CGFloat a, CGFloat b, CGFloat fraction) {
35 return a * (1.0f - fraction) + b * fraction; 32 return a * (1.0f - fraction) + b * fraction;
36 } 33 }
37 34
38 // Gets the RGBA components from a UIColor in RBG or monochrome color space. 35 // Gets the RGBA components from a UIColor in RBG or monochrome color space.
39 void GetRGBA(UIColor* color, CGFloat* r, CGFloat* g, CGFloat* b, CGFloat* a) { 36 void GetRGBA(UIColor* color, CGFloat* r, CGFloat* g, CGFloat* b, CGFloat* a) {
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 NSDictionary* metrics, 545 NSDictionary* metrics,
549 UIView* unused_parentView) { 546 UIView* unused_parentView) {
550 ApplyVisualConstraintsWithMetrics(constraints, subviewsDictionary, metrics); 547 ApplyVisualConstraintsWithMetrics(constraints, subviewsDictionary, metrics);
551 } 548 }
552 549
553 void ApplyVisualConstraintsWithMetricsAndOptions( 550 void ApplyVisualConstraintsWithMetricsAndOptions(
554 NSArray* constraints, 551 NSArray* constraints,
555 NSDictionary* subviewsDictionary, 552 NSDictionary* subviewsDictionary,
556 NSDictionary* metrics, 553 NSDictionary* metrics,
557 NSLayoutFormatOptions options) { 554 NSLayoutFormatOptions options) {
558 NSMutableArray* layoutConstraints = 555 base::scoped_nsobject<NSMutableArray> layoutConstraints(
559 [NSMutableArray arrayWithCapacity:constraints.count * 3]; 556 [[NSMutableArray arrayWithCapacity:constraints.count * 3] retain]);
560 for (NSString* constraint in constraints) { 557 for (NSString* constraint in constraints) {
561 DCHECK([constraint isKindOfClass:[NSString class]]); 558 DCHECK([constraint isKindOfClass:[NSString class]]);
562 [layoutConstraints addObjectsFromArray: 559 [layoutConstraints addObjectsFromArray:
563 [NSLayoutConstraint 560 [NSLayoutConstraint
564 constraintsWithVisualFormat:constraint 561 constraintsWithVisualFormat:constraint
565 options:options 562 options:options
566 metrics:metrics 563 metrics:metrics
567 views:subviewsDictionary]]; 564 views:subviewsDictionary]];
568 } 565 }
569 [NSLayoutConstraint activateConstraints:layoutConstraints]; 566 [NSLayoutConstraint activateConstraints:layoutConstraints];
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 DCHECK(!gFirstResponder); 636 DCHECK(!gFirstResponder);
640 [[UIApplication sharedApplication] 637 [[UIApplication sharedApplication]
641 sendAction:@selector(cr_markSelfCurrentFirstResponder) 638 sendAction:@selector(cr_markSelfCurrentFirstResponder)
642 to:nil 639 to:nil
643 from:nil 640 from:nil
644 forEvent:nil]; 641 forEvent:nil];
645 UIResponder* firstResponder = gFirstResponder; 642 UIResponder* firstResponder = gFirstResponder;
646 gFirstResponder = nil; 643 gFirstResponder = nil;
647 return firstResponder; 644 return firstResponder;
648 } 645 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/ui_util.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698