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

Unified Diff: ios/chrome/browser/find_in_page/find_tab_helper.mm

Issue 2654433007: [ios] Moves find-in-page code out of Tab and into FindTabHelper. (Closed)
Patch Set: Review. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/find_in_page/find_tab_helper.mm
diff --git a/ios/chrome/browser/find_in_page/find_tab_helper.mm b/ios/chrome/browser/find_in_page/find_tab_helper.mm
new file mode 100644
index 0000000000000000000000000000000000000000..9892712a9bfd8e3ad43c91c8bd96df6d5ca0d5b8
--- /dev/null
+++ b/ios/chrome/browser/find_in_page/find_tab_helper.mm
@@ -0,0 +1,47 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/find_in_page/find_tab_helper.h"
+
+#import "ios/chrome/browser/find_in_page/find_in_page_controller.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+DEFINE_WEB_STATE_USER_DATA_KEY(FindTabHelper);
+
+// static
+void FindTabHelper::CreateForWebState(
+ web::WebState* web_state,
+ id<FindInPageControllerDelegate> controller_delegate) {
+ DCHECK(web_state);
+ if (!FromWebState(web_state)) {
+ web_state->SetUserData(UserDataKey(),
+ new FindTabHelper(web_state, controller_delegate));
+ }
+}
+
+FindTabHelper::FindTabHelper(
+ web::WebState* web_state,
+ id<FindInPageControllerDelegate> controller_delegate) {
+ controller_ =
+ [[FindInPageController alloc] initWithWebState:web_state
+ delegate:controller_delegate];
+}
+
+FindTabHelper::~FindTabHelper() {}
+
+FindInPageController* FindTabHelper::GetController() {
+ return controller_;
+}
+
+void FindTabHelper::NavigationItemCommitted(
+ const web::LoadCommittedDetails& load_details) {
+ [controller_ disableFindInPageWithCompletionHandler:nil];
+}
+
+void FindTabHelper::WebStateDestroyed() {
+ [controller_ detachFromWebState];
+}
« no previous file with comments | « ios/chrome/browser/find_in_page/find_tab_helper.h ('k') | ios/chrome/browser/find_in_page/find_tab_helper_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698