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 | |
|
Eugene But (OOO till 7-30)
2017/01/31 19:03:48
Please add ARC ifdefs
rohitrao (ping after 24h)
2017/02/08 16:14:59
Done.
| |
| 9 DEFINE_WEB_STATE_USER_DATA_KEY(FindTabHelper); | |
| 10 | |
| 11 // static | |
| 12 void FindTabHelper::CreateForWebState( | |
| 13 web::WebState* web_state, | |
| 14 id<FindInPageControllerDelegate> controller_delegate) { | |
| 15 DCHECK(web_state); | |
| 16 if (!FromWebState(web_state)) | |
| 17 web_state->SetUserData(UserDataKey(), | |
| 18 new FindTabHelper(web_state, controller_delegate)); | |
| 19 } | |
| 20 | |
| 21 FindTabHelper::FindTabHelper( | |
| 22 web::WebState* web_state, | |
| 23 id<FindInPageControllerDelegate> controller_delegate) | |
| 24 : web_state_(web_state) { | |
| 25 controller_ = | |
| 26 [[FindInPageController alloc] initWithWebState:web_state | |
| 27 delegate:controller_delegate]; | |
| 28 } | |
| 29 | |
| 30 FindTabHelper::~FindTabHelper() { | |
| 31 [controller_ detachFromWebState]; | |
|
Eugene But (OOO till 7-30)
2017/01/31 19:03:48
We should probably do this in |WebStateDestroyed|
rohitrao (ping after 24h)
2017/02/08 16:14:59
Done.
| |
| 32 web_state_ = nullptr; | |
| 33 } | |
| 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 } | |
| OLD | NEW |