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

Side by Side Diff: ios/chrome/browser/ui/payments/payment_request_manager.mm

Issue 2949883002: [Payment Request] null checks _webState instance before calling a method on. (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/payments/payment_request_manager.h" 5 #import "ios/chrome/browser/ui/payments/payment_request_manager.h"
6 6
7 #include "base/ios/block_types.h" 7 #include "base/ios/block_types.h"
8 #include "base/ios/ios_util.h" 8 #include "base/ios/ios_util.h"
9 #import "base/mac/bind_objc_block.h" 9 #import "base/mac/bind_objc_block.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 [self webState]->AddScriptCommandCallback(callback, kCommandPrefix); 303 [self webState]->AddScriptCommandCallback(callback, kCommandPrefix);
304 304
305 _webStateEnabled = YES; 305 _webStateEnabled = YES;
306 } 306 }
307 } else { 307 } else {
308 [self disableCurrentWebState]; 308 [self disableCurrentWebState];
309 } 309 }
310 } 310 }
311 311
312 - (void)disableCurrentWebState { 312 - (void)disableCurrentWebState {
313 if (_webStateEnabled) { 313 if (_webState && _webStateEnabled) {
314 _webState->RemoveScriptCommandCallback(kCommandPrefix); 314 _webState->RemoveScriptCommandCallback(kCommandPrefix);
315 _webStateEnabled = NO; 315 _webStateEnabled = NO;
316 } 316 }
317 } 317 }
318 318
319 - (void)disconnectWebState { 319 - (void)disconnectWebState {
320 if (_webState) { 320 if (_webState) {
321 _paymentRequestJsManager = nil; 321 _paymentRequestJsManager = nil;
322 _webStateObserver.reset(); 322 _webStateObserver.reset();
323 [self disableCurrentWebState]; 323 [self disableCurrentWebState];
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 #pragma mark - CRWWebStateObserver methods 782 #pragma mark - CRWWebStateObserver methods
783 783
784 - (void)webState:(web::WebState*)webState 784 - (void)webState:(web::WebState*)webState
785 didCommitNavigationWithDetails: 785 didCommitNavigationWithDetails:
786 (const web::LoadCommittedDetails&)load_details { 786 (const web::LoadCommittedDetails&)load_details {
787 [self dismissUI]; 787 [self dismissUI];
788 [self enableCurrentWebState]; 788 [self enableCurrentWebState];
789 } 789 }
790 790
791 @end 791 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698