Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "ios/chrome/browser/find_in_page/find_tab_helper.h" | |
| 6 | |
| 7 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h" | |
| 8 | |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 10 #error "This file requires ARC support." | |
| 11 #endif | |
| 12 | |
| 13 DEFINE_WEB_STATE_USER_DATA_KEY(FindTabHelper); | |
| 14 | |
| 15 // static | |
| 16 void FindTabHelper::CreateForWebState( | |
| 17 web::WebState* web_state, | |
| 18 id<FindInPageControllerDelegate> controller_delegate) { | |
| 19 DCHECK(web_state); | |
| 20 if (!FromWebState(web_state)) | |
| 21 web_state->SetUserData(UserDataKey(), | |
|
Eugene But (OOO till 7-30)
2017/02/10 00:03:36
nit: do you want to add braces, because block is m
sdefresne
2017/02/10 09:39:51
Even though the style guide does not enforce this,
rohitrao (ping after 24h)
2017/02/10 13:52:18
I prefer braces for all conditionals, thanks =)
| |
| 22 new FindTabHelper(web_state, controller_delegate)); | |
| 23 } | |
| 24 | |
| 25 FindTabHelper::FindTabHelper( | |
| 26 web::WebState* web_state, | |
| 27 id<FindInPageControllerDelegate> controller_delegate) { | |
| 28 controller_ = | |
| 29 [[FindInPageController alloc] initWithWebState:web_state | |
| 30 delegate:controller_delegate]; | |
| 31 } | |
| 32 | |
| 33 FindTabHelper::~FindTabHelper() {} | |
| 34 | |
| 35 FindInPageController* FindTabHelper::GetController() { | |
| 36 return controller_; | |
| 37 } | |
| 38 | |
| 39 void FindTabHelper::NavigationItemCommitted( | |
| 40 const web::LoadCommittedDetails& load_details) { | |
| 41 [controller_ disableFindInPageWithCompletionHandler:nil]; | |
| 42 } | |
| 43 | |
| 44 void FindTabHelper::WebStateDestroyed() { | |
| 45 [controller_ detachFromWebState]; | |
| 46 } | |
| OLD | NEW |