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

Side by Side Diff: ios/web/web_state/ui/crw_web_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/web/web_state/ui/crw_web_controller.h" 5 #import "ios/web/web_state/ui/crw_web_controller.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #import <objc/runtime.h> 9 #import <objc/runtime.h>
10 #include <stddef.h> 10 #include <stddef.h>
11 11
12 #include <cmath> 12 #include <cmath>
13 #include <memory> 13 #include <memory>
14 #include <utility> 14 #include <utility>
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/containers/mru_cache.h" 17 #include "base/containers/mru_cache.h"
18 #import "base/ios/block_types.h" 18 #import "base/ios/block_types.h"
19 #include "base/ios/ios_util.h" 19 #include "base/ios/ios_util.h"
20 #import "base/ios/ns_error_util.h" 20 #import "base/ios/ns_error_util.h"
21 #import "base/ios/weak_nsobject.h" 21 #import "base/ios/weak_nsobject.h"
22 #include "base/json/string_escape.h" 22 #include "base/json/string_escape.h"
23 #include "base/logging.h" 23 #include "base/logging.h"
24 #import "base/mac/bind_objc_block.h" 24 #import "base/mac/bind_objc_block.h"
25 #include "base/mac/bundle_locations.h" 25 #include "base/mac/bundle_locations.h"
26 #include "base/mac/foundation_util.h" 26 #include "base/mac/foundation_util.h"
27 #import "base/mac/objc_property_releaser.h" 27 #include "base/mac/objc_release_properties.h"
28 #include "base/mac/scoped_cftyperef.h" 28 #include "base/mac/scoped_cftyperef.h"
29 #import "base/mac/scoped_nsobject.h" 29 #import "base/mac/scoped_nsobject.h"
30 #include "base/metrics/histogram.h" 30 #include "base/metrics/histogram.h"
31 #include "base/metrics/user_metrics.h" 31 #include "base/metrics/user_metrics.h"
32 #include "base/metrics/user_metrics_action.h" 32 #include "base/metrics/user_metrics_action.h"
33 #include "base/strings/string_util.h" 33 #include "base/strings/string_util.h"
34 #include "base/strings/sys_string_conversions.h" 34 #include "base/strings/sys_string_conversions.h"
35 #include "base/strings/utf_string_conversions.h" 35 #include "base/strings/utf_string_conversions.h"
36 #include "base/time/time.h" 36 #include "base/time/time.h"
37 #include "base/values.h" 37 #include "base/values.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return 243 return
244 [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo]; 244 [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo];
245 } 245 }
246 } // namespace 246 } // namespace
247 247
248 #pragma mark - 248 #pragma mark -
249 249
250 // A container object for any navigation information that is only available 250 // A container object for any navigation information that is only available
251 // during pre-commit delegate callbacks, and thus must be held until the 251 // during pre-commit delegate callbacks, and thus must be held until the
252 // navigation commits and the informatino can be used. 252 // navigation commits and the informatino can be used.
253 @interface CRWWebControllerPendingNavigationInfo : NSObject { 253 @interface CRWWebControllerPendingNavigationInfo : NSObject
254 base::mac::ObjCPropertyReleaser
255 _propertyReleaser_CRWWebControllerPendingNavigationInfo;
256 }
257 // The referrer for the page. 254 // The referrer for the page.
258 @property(nonatomic, copy) NSString* referrer; 255 @property(nonatomic, copy) NSString* referrer;
259 // The MIME type for the page. 256 // The MIME type for the page.
260 @property(nonatomic, copy) NSString* MIMEType; 257 @property(nonatomic, copy) NSString* MIMEType;
261 // The navigation type for the load. 258 // The navigation type for the load.
262 @property(nonatomic, assign) WKNavigationType navigationType; 259 @property(nonatomic, assign) WKNavigationType navigationType;
263 // HTTP request method for the load. 260 // HTTP request method for the load.
264 @property(nonatomic, copy) NSString* HTTPMethod; 261 @property(nonatomic, copy) NSString* HTTPMethod;
265 // Whether the pending navigation has been directly cancelled before the 262 // Whether the pending navigation has been directly cancelled before the
266 // navigation is committed. 263 // navigation is committed.
267 // Cancelled navigations should be simply discarded without handling any 264 // Cancelled navigations should be simply discarded without handling any
268 // specific error. 265 // specific error.
269 @property(nonatomic, assign) BOOL cancelled; 266 @property(nonatomic, assign) BOOL cancelled;
270 @end 267 @end
271 268
272 @implementation CRWWebControllerPendingNavigationInfo 269 @implementation CRWWebControllerPendingNavigationInfo
273 @synthesize referrer = _referrer; 270 @synthesize referrer = _referrer;
274 @synthesize MIMEType = _MIMEType; 271 @synthesize MIMEType = _MIMEType;
275 @synthesize navigationType = _navigationType; 272 @synthesize navigationType = _navigationType;
276 @synthesize HTTPMethod = _HTTPMethod; 273 @synthesize HTTPMethod = _HTTPMethod;
277 @synthesize cancelled = _cancelled; 274 @synthesize cancelled = _cancelled;
278 275
279 - (instancetype)init { 276 - (instancetype)init {
280 if ((self = [super init])) { 277 if ((self = [super init])) {
281 _propertyReleaser_CRWWebControllerPendingNavigationInfo.Init(
282 self, [CRWWebControllerPendingNavigationInfo class]);
283 _navigationType = WKNavigationTypeOther; 278 _navigationType = WKNavigationTypeOther;
284 } 279 }
285 return self; 280 return self;
286 } 281 }
282
283 - (void)dealloc {
284 base::mac::ReleaseProperties(self);
285 [super dealloc];
286 }
287
287 @end 288 @end
288 289
289 @interface CRWWebController ()<CRWNativeContentDelegate, 290 @interface CRWWebController ()<CRWNativeContentDelegate,
290 CRWSSLStatusUpdaterDataSource, 291 CRWSSLStatusUpdaterDataSource,
291 CRWSSLStatusUpdaterDelegate, 292 CRWSSLStatusUpdaterDelegate,
292 CRWWebControllerContainerViewDelegate, 293 CRWWebControllerContainerViewDelegate,
293 CRWWebViewScrollViewProxyObserver, 294 CRWWebViewScrollViewProxyObserver,
294 WKNavigationDelegate, 295 WKNavigationDelegate,
295 WKUIDelegate> { 296 WKUIDelegate> {
296 base::WeakNSProtocol<id<CRWWebDelegate>> _delegate; 297 base::WeakNSProtocol<id<CRWWebDelegate>> _delegate;
(...skipping 5508 matching lines...) Expand 10 before | Expand all | Expand 10 after
5805 } 5806 }
5806 5807
5807 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 5808 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
5808 } 5809 }
5809 5810
5810 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { 5811 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action {
5811 return [action.request valueForHTTPHeaderField:@"Referer"]; 5812 return [action.request valueForHTTPHeaderField:@"Referer"];
5812 } 5813 }
5813 5814
5814 @end 5815 @end
OLDNEW
« ios/chrome/browser/ui/ntp/new_tab_page_view.h ('K') | « ios/web/public/origin_util_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698