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

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

Issue 2853443002: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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_tab_helper.h" 5 #import "ios/chrome/browser/find_in_page/find_tab_helper.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h" 8 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h"
8 #import "ios/chrome/browser/find_in_page/find_in_page_model.h" 9 #import "ios/chrome/browser/find_in_page/find_in_page_model.h"
9 10
10 #if !defined(__has_feature) || !__has_feature(objc_arc) 11 #if !defined(__has_feature) || !__has_feature(objc_arc)
11 #error "This file requires ARC support." 12 #error "This file requires ARC support."
12 #endif 13 #endif
13 14
14 DEFINE_WEB_STATE_USER_DATA_KEY(FindTabHelper); 15 DEFINE_WEB_STATE_USER_DATA_KEY(FindTabHelper);
15 16
16 // static 17 // static
17 void FindTabHelper::CreateForWebState( 18 void FindTabHelper::CreateForWebState(
18 web::WebState* web_state, 19 web::WebState* web_state,
19 id<FindInPageControllerDelegate> controller_delegate) { 20 id<FindInPageControllerDelegate> controller_delegate) {
20 DCHECK(web_state); 21 DCHECK(web_state);
21 if (!FromWebState(web_state)) { 22 if (!FromWebState(web_state)) {
22 web_state->SetUserData(UserDataKey(), 23 web_state->SetUserData(UserDataKey(), base::WrapUnique(new FindTabHelper(
23 new FindTabHelper(web_state, controller_delegate)); 24 web_state, controller_delegate)));
24 } 25 }
25 } 26 }
26 27
27 FindTabHelper::FindTabHelper( 28 FindTabHelper::FindTabHelper(
28 web::WebState* web_state, 29 web::WebState* web_state,
29 id<FindInPageControllerDelegate> controller_delegate) 30 id<FindInPageControllerDelegate> controller_delegate)
30 : web::WebStateObserver(web_state) { 31 : web::WebStateObserver(web_state) {
31 controller_.reset([[FindInPageController alloc] 32 controller_.reset([[FindInPageController alloc]
32 initWithWebState:web_state 33 initWithWebState:web_state
33 delegate:controller_delegate]); 34 delegate:controller_delegate]);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 94 }
94 95
95 void FindTabHelper::NavigationItemCommitted( 96 void FindTabHelper::NavigationItemCommitted(
96 const web::LoadCommittedDetails& load_details) { 97 const web::LoadCommittedDetails& load_details) {
97 StopFinding(nil); 98 StopFinding(nil);
98 } 99 }
99 100
100 void FindTabHelper::WebStateDestroyed() { 101 void FindTabHelper::WebStateDestroyed() {
101 [controller_ detachFromWebState]; 102 [controller_ detachFromWebState];
102 } 103 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698