OLD | NEW |
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 #import <cmath> | 9 #import <cmath> |
| 10 #include <memory> |
9 | 11 |
10 #include "base/ios/ios_util.h" | 12 #include "base/ios/ios_util.h" |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "base/mac/foundation_util.h" | 14 #include "base/mac/foundation_util.h" |
13 #include "base/mac/scoped_nsobject.h" | 15 #include "base/mac/scoped_nsobject.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #import "ios/chrome/browser/find_in_page/find_in_page_model.h" | 16 #import "ios/chrome/browser/find_in_page/find_in_page_model.h" |
16 #import "ios/chrome/browser/find_in_page/js_findinpage_manager.h" | 17 #import "ios/chrome/browser/find_in_page/js_findinpage_manager.h" |
17 #import "ios/chrome/browser/web/dom_altering_lock.h" | 18 #import "ios/chrome/browser/web/dom_altering_lock.h" |
18 #import "ios/web/public/web_state/crw_web_view_proxy.h" | 19 #import "ios/web/public/web_state/crw_web_view_proxy.h" |
19 #import "ios/web/public/web_state/crw_web_view_scroll_view_proxy.h" | 20 #import "ios/web/public/web_state/crw_web_view_scroll_view_proxy.h" |
20 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" | 21 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" |
21 #import "ios/web/public/web_state/web_state.h" | 22 #import "ios/web/public/web_state/web_state.h" |
22 #import "ios/web/public/web_state/web_state_observer_bridge.h" | 23 #import "ios/web/public/web_state/web_state_observer_bridge.h" |
23 | 24 |
24 NSString* const kFindBarTextFieldWillBecomeFirstResponderNotification = | 25 NSString* const kFindBarTextFieldWillBecomeFirstResponderNotification = |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 id<FindInPageControllerDelegate> _delegate; | 75 id<FindInPageControllerDelegate> _delegate; |
75 | 76 |
76 // Access to the web view from the web state. | 77 // Access to the web view from the web state. |
77 base::scoped_nsprotocol<id<CRWWebViewProxy>> _webViewProxy; | 78 base::scoped_nsprotocol<id<CRWWebViewProxy>> _webViewProxy; |
78 | 79 |
79 // True when a find is in progress. Used to avoid running JavaScript during | 80 // True when a find is in progress. Used to avoid running JavaScript during |
80 // disable when there is nothing to clear. | 81 // disable when there is nothing to clear. |
81 BOOL _findStringStarted; | 82 BOOL _findStringStarted; |
82 | 83 |
83 // Bridge to observe the web state from Objective-C. | 84 // Bridge to observe the web state from Objective-C. |
84 scoped_ptr<web::WebStateObserverBridge> _webStateObserverBridge; | 85 std::unique_ptr<web::WebStateObserverBridge> _webStateObserverBridge; |
85 } | 86 } |
86 | 87 |
87 @synthesize delegate = _delegate; | 88 @synthesize delegate = _delegate; |
88 | 89 |
89 - (id)initWithWebState:(web::WebState*)webState | 90 - (id)initWithWebState:(web::WebState*)webState |
90 delegate:(id<FindInPageControllerDelegate>)delegate { | 91 delegate:(id<FindInPageControllerDelegate>)delegate { |
91 self = [super init]; | 92 self = [super init]; |
92 if (self) { | 93 if (self) { |
93 DCHECK(delegate); | 94 DCHECK(delegate); |
94 _findInPageJsManager = base::mac::ObjCCastStrict<JsFindinpageManager>( | 95 _findInPageJsManager = base::mac::ObjCCastStrict<JsFindinpageManager>( |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 377 |
377 - (BOOL)canReleaseDOMLock { | 378 - (BOOL)canReleaseDOMLock { |
378 return NO; | 379 return NO; |
379 } | 380 } |
380 | 381 |
381 - (void)releaseDOMLockWithCompletionHandler:(ProceduralBlock)completionHandler { | 382 - (void)releaseDOMLockWithCompletionHandler:(ProceduralBlock)completionHandler { |
382 NOTREACHED(); | 383 NOTREACHED(); |
383 } | 384 } |
384 | 385 |
385 @end | 386 @end |
OLD | NEW |