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

Side by Side Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2610923005: Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: Rebase Created 3 years, 7 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 | « ios/web/public/origin_util_unittest.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/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 #include <vector> 15 #include <vector>
16 16
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/containers/mru_cache.h" 18 #include "base/containers/mru_cache.h"
19 #import "base/ios/block_types.h" 19 #import "base/ios/block_types.h"
20 #include "base/ios/ios_util.h" 20 #include "base/ios/ios_util.h"
21 #import "base/ios/ns_error_util.h" 21 #import "base/ios/ns_error_util.h"
22 #import "base/ios/weak_nsobject.h" 22 #import "base/ios/weak_nsobject.h"
23 #include "base/json/string_escape.h" 23 #include "base/json/string_escape.h"
24 #include "base/logging.h" 24 #include "base/logging.h"
25 #import "base/mac/bind_objc_block.h" 25 #import "base/mac/bind_objc_block.h"
26 #include "base/mac/bundle_locations.h" 26 #include "base/mac/bundle_locations.h"
27 #include "base/mac/foundation_util.h" 27 #include "base/mac/foundation_util.h"
28 #import "base/mac/objc_property_releaser.h" 28 #include "base/mac/objc_release_properties.h"
29 #include "base/mac/scoped_cftyperef.h" 29 #include "base/mac/scoped_cftyperef.h"
30 #import "base/mac/scoped_nsobject.h" 30 #import "base/mac/scoped_nsobject.h"
31 #include "base/memory/ptr_util.h" 31 #include "base/memory/ptr_util.h"
32 #include "base/metrics/histogram_macros.h" 32 #include "base/metrics/histogram_macros.h"
33 #include "base/metrics/user_metrics.h" 33 #include "base/metrics/user_metrics.h"
34 #include "base/metrics/user_metrics_action.h" 34 #include "base/metrics/user_metrics_action.h"
35 #include "base/strings/string_util.h" 35 #include "base/strings/string_util.h"
36 #include "base/strings/sys_string_conversions.h" 36 #include "base/strings/sys_string_conversions.h"
37 #include "base/strings/utf_string_conversions.h" 37 #include "base/strings/utf_string_conversions.h"
38 #include "base/time/time.h" 38 #include "base/time/time.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return 209 return
210 [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo]; 210 [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo];
211 } 211 }
212 } // namespace 212 } // namespace
213 213
214 #pragma mark - 214 #pragma mark -
215 215
216 // A container object for any navigation information that is only available 216 // A container object for any navigation information that is only available
217 // during pre-commit delegate callbacks, and thus must be held until the 217 // during pre-commit delegate callbacks, and thus must be held until the
218 // navigation commits and the informatino can be used. 218 // navigation commits and the informatino can be used.
219 @interface CRWWebControllerPendingNavigationInfo : NSObject { 219 @interface CRWWebControllerPendingNavigationInfo : NSObject
220 base::mac::ObjCPropertyReleaser
221 _propertyReleaser_CRWWebControllerPendingNavigationInfo;
222 }
223 // The referrer for the page. 220 // The referrer for the page.
224 @property(nonatomic, copy) NSString* referrer; 221 @property(nonatomic, copy) NSString* referrer;
225 // The MIME type for the page. 222 // The MIME type for the page.
226 @property(nonatomic, copy) NSString* MIMEType; 223 @property(nonatomic, copy) NSString* MIMEType;
227 // The navigation type for the load. 224 // The navigation type for the load.
228 @property(nonatomic, assign) WKNavigationType navigationType; 225 @property(nonatomic, assign) WKNavigationType navigationType;
229 // HTTP request method for the load. 226 // HTTP request method for the load.
230 @property(nonatomic, copy) NSString* HTTPMethod; 227 @property(nonatomic, copy) NSString* HTTPMethod;
231 // Whether the pending navigation has been directly cancelled before the 228 // Whether the pending navigation has been directly cancelled before the
232 // navigation is committed. 229 // navigation is committed.
233 // Cancelled navigations should be simply discarded without handling any 230 // Cancelled navigations should be simply discarded without handling any
234 // specific error. 231 // specific error.
235 @property(nonatomic, assign) BOOL cancelled; 232 @property(nonatomic, assign) BOOL cancelled;
236 @end 233 @end
237 234
238 @implementation CRWWebControllerPendingNavigationInfo 235 @implementation CRWWebControllerPendingNavigationInfo
239 @synthesize referrer = _referrer; 236 @synthesize referrer = _referrer;
240 @synthesize MIMEType = _MIMEType; 237 @synthesize MIMEType = _MIMEType;
241 @synthesize navigationType = _navigationType; 238 @synthesize navigationType = _navigationType;
242 @synthesize HTTPMethod = _HTTPMethod; 239 @synthesize HTTPMethod = _HTTPMethod;
243 @synthesize cancelled = _cancelled; 240 @synthesize cancelled = _cancelled;
244 241
245 - (instancetype)init { 242 - (instancetype)init {
246 if ((self = [super init])) { 243 if ((self = [super init])) {
247 _propertyReleaser_CRWWebControllerPendingNavigationInfo.Init(
248 self, [CRWWebControllerPendingNavigationInfo class]);
249 _navigationType = WKNavigationTypeOther; 244 _navigationType = WKNavigationTypeOther;
250 } 245 }
251 return self; 246 return self;
252 } 247 }
248
249 - (void)dealloc {
250 base::mac::ReleaseProperties(self);
251 [super dealloc];
252 }
253
253 @end 254 @end
254 255
255 @interface CRWWebController ()<CRWContextMenuDelegate, 256 @interface CRWWebController ()<CRWContextMenuDelegate,
256 CRWNativeContentDelegate, 257 CRWNativeContentDelegate,
257 CRWSSLStatusUpdaterDataSource, 258 CRWSSLStatusUpdaterDataSource,
258 CRWSSLStatusUpdaterDelegate, 259 CRWSSLStatusUpdaterDelegate,
259 CRWWebControllerContainerViewDelegate, 260 CRWWebControllerContainerViewDelegate,
260 CRWWebViewScrollViewProxyObserver, 261 CRWWebViewScrollViewProxyObserver,
261 WKNavigationDelegate, 262 WKNavigationDelegate,
262 WKUIDelegate> { 263 WKUIDelegate> {
(...skipping 4898 matching lines...) Expand 10 before | Expand all | Expand 10 after
5161 - (NSUInteger)observerCount { 5162 - (NSUInteger)observerCount {
5162 DCHECK_EQ(_observerBridges.size(), [_observers count]); 5163 DCHECK_EQ(_observerBridges.size(), [_observers count]);
5163 return [_observers count]; 5164 return [_observers count];
5164 } 5165 }
5165 5166
5166 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { 5167 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action {
5167 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; 5168 return [action.request valueForHTTPHeaderField:kReferrerHeaderName];
5168 } 5169 }
5169 5170
5170 @end 5171 @end
OLDNEW
« no previous file with comments | « 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