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

Side by Side Diff: ios/chrome/browser/find_in_page/find_in_page_controller.mm

Issue 2724683002: [ios] Moves the Find in Page APIs into FindTabHelper. (Closed)
Patch Set: Review Created 3 years, 9 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/find_in_page/find_in_page_controller.h" 5 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #import <cmath> 9 #import <cmath>
10 #include <memory> 10 #include <memory>
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 atPoint:point]; 261 atPoint:point];
262 [[strongSelf webViewScrollView] setContentOffset:point animated:YES]; 262 [[strongSelf webViewScrollView] setContentOffset:point animated:YES];
263 if (completionHandler) 263 if (completionHandler)
264 completionHandler(); 264 completionHandler();
265 }]; 265 }];
266 } 266 }
267 267
268 // Remove highlights from the page and disable the model. 268 // Remove highlights from the page and disable the model.
269 - (void)disableFindInPageWithCompletionHandler: 269 - (void)disableFindInPageWithCompletionHandler:
270 (ProceduralBlock)completionHandler { 270 (ProceduralBlock)completionHandler {
271 if (![self canFindInPage]) 271 if (![self canFindInPage]) {
272 if (completionHandler)
273 completionHandler();
272 return; 274 return;
275 }
273 // Cancel any queued calls to |recurringPumpWithCompletionHandler|. 276 // Cancel any queued calls to |recurringPumpWithCompletionHandler|.
274 [NSObject cancelPreviousPerformRequestsWithTarget:self]; 277 [NSObject cancelPreviousPerformRequestsWithTarget:self];
275 __weak FindInPageController* weakSelf = self; 278 __weak FindInPageController* weakSelf = self;
276 ProceduralBlock handler = ^{ 279 ProceduralBlock handler = ^{
277 FindInPageController* strongSelf = weakSelf; 280 FindInPageController* strongSelf = weakSelf;
278 if (strongSelf) { 281 if (strongSelf) {
279 [strongSelf.findInPageModel setEnabled:NO];
280 web::WebState* webState = [strongSelf webState]; 282 web::WebState* webState = [strongSelf webState];
281 if (webState) 283 if (webState)
282 DOMAlteringLock::FromWebState(webState)->Release(strongSelf); 284 DOMAlteringLock::FromWebState(webState)->Release(strongSelf);
283 } 285 }
284 if (completionHandler) 286 if (completionHandler)
285 completionHandler(); 287 completionHandler();
286 }; 288 };
287 // Only run JSFindInPageManager disable if there is a string in progress to 289 // Only run JSFindInPageManager disable if there is a string in progress to
288 // avoid WKWebView crash on deallocation due to outstanding completion 290 // avoid WKWebView crash on deallocation due to outstanding completion
289 // handler. 291 // handler.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 374
373 - (BOOL)canReleaseDOMLock { 375 - (BOOL)canReleaseDOMLock {
374 return NO; 376 return NO;
375 } 377 }
376 378
377 - (void)releaseDOMLockWithCompletionHandler:(ProceduralBlock)completionHandler { 379 - (void)releaseDOMLockWithCompletionHandler:(ProceduralBlock)completionHandler {
378 NOTREACHED(); 380 NOTREACHED();
379 } 381 }
380 382
381 @end 383 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/find_in_page/BUILD.gn ('k') | ios/chrome/browser/find_in_page/find_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698