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

Side by Side Diff: ios/chrome/browser/ui/open_in_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 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/open_in_controller.h" 5 #import "ios/chrome/browser/ui/open_in_controller.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/ios/weak_nsobject.h" 8 #include "base/ios/weak_nsobject.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #import "base/mac/bind_objc_block.h" 11 #import "base/mac/bind_objc_block.h"
12 #include "base/mac/objc_property_releaser.h" 12 #include "base/mac/objc_release_properties.h"
13 #include "base/sequenced_task_runner.h" 13 #include "base/sequenced_task_runner.h"
14 #include "base/strings/sys_string_conversions.h" 14 #include "base/strings/sys_string_conversions.h"
15 #include "base/threading/sequenced_worker_pool.h" 15 #include "base/threading/sequenced_worker_pool.h"
16 #include "base/threading/thread_restrictions.h" 16 #include "base/threading/thread_restrictions.h"
17 #include "components/strings/grit/components_strings.h" 17 #include "components/strings/grit/components_strings.h"
18 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" 18 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h"
19 #import "ios/chrome/browser/ui/open_in_controller_testing.h" 19 #import "ios/chrome/browser/ui/open_in_controller_testing.h"
20 #include "ios/chrome/browser/ui/ui_util.h" 20 #include "ios/chrome/browser/ui/ui_util.h"
21 #import "ios/chrome/browser/ui/uikit_ui_util.h" 21 #import "ios/chrome/browser/ui/uikit_ui_util.h"
22 #include "ios/chrome/grit/ios_strings.h" 22 #include "ios/chrome/grit/ios_strings.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 CGRect anchorLocation_; 191 CGRect anchorLocation_;
192 192
193 // YES if the file download was canceled. 193 // YES if the file download was canceled.
194 BOOL downloadCanceled_; 194 BOOL downloadCanceled_;
195 195
196 // YES if the OpenIn menu is displayed. 196 // YES if the OpenIn menu is displayed.
197 BOOL isOpenInMenuDisplayed_; 197 BOOL isOpenInMenuDisplayed_;
198 198
199 // Task runner on which file operations should happen. 199 // Task runner on which file operations should happen.
200 scoped_refptr<base::SequencedTaskRunner> sequencedTaskRunner_; 200 scoped_refptr<base::SequencedTaskRunner> sequencedTaskRunner_;
201
202 base::mac::ObjCPropertyReleaser propertyReleaser_OpenInController_;
203 } 201 }
204 202
205 - (id)initWithRequestContext:(net::URLRequestContextGetter*)requestContext 203 - (id)initWithRequestContext:(net::URLRequestContextGetter*)requestContext
206 webController:(CRWWebController*)webController { 204 webController:(CRWWebController*)webController {
207 self = [super init]; 205 self = [super init];
208 if (self) { 206 if (self) {
209 requestContext_ = requestContext; 207 requestContext_ = requestContext;
210 webController_.reset([webController retain]); 208 webController_.reset([webController retain]);
211 tapRecognizer_.reset([[UITapGestureRecognizer alloc] 209 tapRecognizer_.reset([[UITapGestureRecognizer alloc]
212 initWithTarget:self 210 initWithTarget:self
213 action:@selector(handleTapFrom:)]); 211 action:@selector(handleTapFrom:)]);
214 [tapRecognizer_ setDelegate:self]; 212 [tapRecognizer_ setDelegate:self];
215 base::SequencedWorkerPool* pool = web::WebThread::GetBlockingPool(); 213 base::SequencedWorkerPool* pool = web::WebThread::GetBlockingPool();
216 sequencedTaskRunner_ = 214 sequencedTaskRunner_ =
217 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); 215 pool->GetSequencedTaskRunner(pool->GetSequenceToken());
218 isOpenInMenuDisplayed_ = NO; 216 isOpenInMenuDisplayed_ = NO;
219 propertyReleaser_OpenInController_.Init(self, [OpenInController class]);
220 } 217 }
221 return self; 218 return self;
222 } 219 }
223 220
224 - (void)enableWithDocumentURL:(const GURL&)documentURL 221 - (void)enableWithDocumentURL:(const GURL&)documentURL
225 suggestedFilename:(NSString*)suggestedFilename { 222 suggestedFilename:(NSString*)suggestedFilename {
226 documentURL_ = GURL(documentURL); 223 documentURL_ = GURL(documentURL);
227 suggestedFilename_.reset([suggestedFilename retain]); 224 suggestedFilename_.reset([suggestedFilename retain]);
228 [webController_ addGestureRecognizerToWebView:tapRecognizer_]; 225 [webController_ addGestureRecognizerToWebView:tapRecognizer_];
229 [self openInToolbar].alpha = 0.0f; 226 [self openInToolbar].alpha = 0.0f;
(...skipping 17 matching lines...) Expand all
247 244
248 - (void)detachFromWebController { 245 - (void)detachFromWebController {
249 [self disable]; 246 [self disable];
250 // Animation blocks may be keeping this object alive; don't extend the 247 // Animation blocks may be keeping this object alive; don't extend the
251 // lifetime of CRWWebController. 248 // lifetime of CRWWebController.
252 webController_.reset(); 249 webController_.reset();
253 } 250 }
254 251
255 - (void)dealloc { 252 - (void)dealloc {
256 [self disable]; 253 [self disable];
254 base::mac::ReleaseProperties(self);
257 [super dealloc]; 255 [super dealloc];
258 } 256 }
259 257
260 - (void)handleTapFrom:(UIGestureRecognizer*)gestureRecognizer { 258 - (void)handleTapFrom:(UIGestureRecognizer*)gestureRecognizer {
261 if ([gestureRecognizer state] == UIGestureRecognizerStateEnded) { 259 if ([gestureRecognizer state] == UIGestureRecognizerStateEnded) {
262 [self showOpenInToolbar]; 260 [self showOpenInToolbar];
263 } 261 }
264 } 262 }
265 263
266 - (void)showOpenInToolbar { 264 - (void)showOpenInToolbar {
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 - (void)setDocumentInteractionController: 641 - (void)setDocumentInteractionController:
644 (UIDocumentInteractionController*)controller { 642 (UIDocumentInteractionController*)controller {
645 documentController_.reset([controller retain]); 643 documentController_.reset([controller retain]);
646 } 644 }
647 645
648 - (NSString*)suggestedFilename { 646 - (NSString*)suggestedFilename {
649 return suggestedFilename_.get(); 647 return suggestedFilename_.get();
650 } 648 }
651 649
652 @end 650 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698