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

Side by Side Diff: ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.mm

Issue 2610923005: Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: weak -> assign Created 3 years, 11 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 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/first_run/welcome_to_chrome_view_controller.h" 5 #include "ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/ios/weak_nsobject.h" 8 #include "base/ios/weak_nsobject.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/bundle_locations.h" 10 #include "base/mac/bundle_locations.h"
11 #include "base/mac/foundation_util.h" 11 #include "base/mac/foundation_util.h"
12 #include "base/mac/objc_property_releaser.h" 12 #include "base/mac/objc_release_properties.h"
13 #include "base/mac/scoped_nsobject.h" 13 #include "base/mac/scoped_nsobject.h"
14 #include "base/strings/sys_string_conversions.h" 14 #include "base/strings/sys_string_conversions.h"
15 #include "components/metrics/metrics_pref_names.h" 15 #include "components/metrics/metrics_pref_names.h"
16 #include "components/metrics/metrics_reporting_default_state.h" 16 #include "components/metrics/metrics_reporting_default_state.h"
17 #include "components/prefs/pref_service.h" 17 #include "components/prefs/pref_service.h"
18 #include "ios/chrome/browser/application_context.h" 18 #include "ios/chrome/browser/application_context.h"
19 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 19 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
20 #include "ios/chrome/browser/first_run/first_run_configuration.h" 20 #include "ios/chrome/browser/first_run/first_run_configuration.h"
21 #include "ios/chrome/browser/tabs/tab_model.h" 21 #include "ios/chrome/browser/tabs/tab_model.h"
22 #include "ios/chrome/browser/ui/fancy_ui/primary_action_button.h" 22 #include "ios/chrome/browser/ui/fancy_ui/primary_action_button.h"
(...skipping 18 matching lines...) Expand all
41 const CGFloat kFadeOutAnimationDuration = 0.16f; 41 const CGFloat kFadeOutAnimationDuration = 0.16f;
42 42
43 // Default value for metrics reporting state. "YES" corresponding to "opt-out" 43 // Default value for metrics reporting state. "YES" corresponding to "opt-out"
44 // state. 44 // state.
45 const BOOL kDefaultStatsCheckboxValue = YES; 45 const BOOL kDefaultStatsCheckboxValue = YES;
46 } 46 }
47 47
48 @interface WelcomeToChromeViewController ()<WelcomeToChromeViewDelegate> { 48 @interface WelcomeToChromeViewController ()<WelcomeToChromeViewDelegate> {
49 ios::ChromeBrowserState* browserState_; // weak 49 ios::ChromeBrowserState* browserState_; // weak
50 TabModel* tabModel_; // weak 50 TabModel* tabModel_; // weak
51 base::mac::ObjCPropertyReleaser
52 propertyReleaser_WelcomeToChromeViewController_;
53 } 51 }
54 52
55 // The animation which occurs at launch has run. 53 // The animation which occurs at launch has run.
56 @property(nonatomic, assign) BOOL ranLaunchAnimation; 54 @property(nonatomic, assign) BOOL ranLaunchAnimation;
57 55
58 @end 56 @end
59 57
60 @implementation WelcomeToChromeViewController 58 @implementation WelcomeToChromeViewController
61 59
62 @synthesize ranLaunchAnimation = _ranLaunchAnimation; 60 @synthesize ranLaunchAnimation = _ranLaunchAnimation;
(...skipping 11 matching lines...) Expand all
74 } 72 }
75 73
76 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState 74 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
77 tabModel:(TabModel*)tabModel { 75 tabModel:(TabModel*)tabModel {
78 DCHECK(browserState); 76 DCHECK(browserState);
79 DCHECK(tabModel); 77 DCHECK(tabModel);
80 self = [super initWithNibName:nil bundle:nil]; 78 self = [super initWithNibName:nil bundle:nil];
81 if (self) { 79 if (self) {
82 browserState_ = browserState; 80 browserState_ = browserState;
83 tabModel_ = tabModel; 81 tabModel_ = tabModel;
84 propertyReleaser_WelcomeToChromeViewController_.Init(
85 self, [WelcomeToChromeViewController class]);
86 } 82 }
87 return self; 83 return self;
88 } 84 }
89 85
90 - (instancetype)initWithNibName:(nullable NSString*)nibNameOrNil 86 - (instancetype)initWithNibName:(nullable NSString*)nibNameOrNil
91 bundle:(nullable NSBundle*)nibBundleOrNil { 87 bundle:(nullable NSBundle*)nibBundleOrNil {
92 NOTREACHED(); 88 NOTREACHED();
93 return nil; 89 return nil;
94 } 90 }
95 91
96 - (instancetype)initWithCoder:(nonnull NSCoder*)aDecoder { 92 - (instancetype)initWithCoder:(nonnull NSCoder*)aDecoder {
97 NOTREACHED(); 93 NOTREACHED();
98 return nil; 94 return nil;
99 } 95 }
100 96
97 - (void)dealloc {
98 base::mac::ReleaseProperties(self);
99 [super dealloc];
100 }
101
101 - (void)loadView { 102 - (void)loadView {
102 base::scoped_nsobject<WelcomeToChromeView> welcomeToChromeView( 103 base::scoped_nsobject<WelcomeToChromeView> welcomeToChromeView(
103 [[WelcomeToChromeView alloc] initWithFrame:CGRectZero]); 104 [[WelcomeToChromeView alloc] initWithFrame:CGRectZero]);
104 [welcomeToChromeView setDelegate:self]; 105 [welcomeToChromeView setDelegate:self];
105 [welcomeToChromeView 106 [welcomeToChromeView
106 setCheckBoxSelected:[[self class] defaultStatsCheckboxValue]]; 107 setCheckBoxSelected:[[self class] defaultStatsCheckboxValue]];
107 self.view = welcomeToChromeView; 108 self.view = welcomeToChromeView;
108 } 109 }
109 110
110 - (void)viewDidLoad { 111 - (void)viewDidLoad {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 176
176 CATransition* transition = [CATransition animation]; 177 CATransition* transition = [CATransition animation];
177 transition.duration = kFadeOutAnimationDuration; 178 transition.duration = kFadeOutAnimationDuration;
178 transition.type = kCATransitionFade; 179 transition.type = kCATransitionFade;
179 [self.navigationController.view.layer addAnimation:transition 180 [self.navigationController.view.layer addAnimation:transition
180 forKey:kCATransition]; 181 forKey:kCATransition];
181 [self.navigationController pushViewController:signInController animated:NO]; 182 [self.navigationController pushViewController:signInController animated:NO];
182 } 183 }
183 184
184 @end 185 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698