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 #import <cmath> | 8 #import <cmath> |
9 | 9 |
10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 } else { | 283 } else { |
284 handler(); | 284 handler(); |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
288 - (void)saveSearchTerm { | 288 - (void)saveSearchTerm { |
289 [self findPasteboard].string = [[self findInPageModel] text]; | 289 [self findPasteboard].string = [[self findInPageModel] text]; |
290 } | 290 } |
291 | 291 |
292 - (void)restoreSearchTerm { | 292 - (void)restoreSearchTerm { |
| 293 // Pasteboards always return nil in background: |
| 294 if ([[UIApplication sharedApplication] applicationState] != |
| 295 UIApplicationStateActive) { |
| 296 return; |
| 297 } |
| 298 |
293 NSString* term = [self findPasteboard].string; | 299 NSString* term = [self findPasteboard].string; |
294 [[self findInPageModel] updateQuery:(term ? term : @"") matches:0]; | 300 [[self findInPageModel] updateQuery:(term ? term : @"") matches:0]; |
295 } | 301 } |
296 | 302 |
297 - (UIPasteboard*)findPasteboard { | 303 - (UIPasteboard*)findPasteboard { |
298 return [UIPasteboard pasteboardWithName:UIPasteboardNameFind create:NO]; | 304 return [UIPasteboard pasteboardWithName:UIPasteboardNameFind create:NO]; |
299 } | 305 } |
300 | 306 |
301 - (web::WebState*)webState { | 307 - (web::WebState*)webState { |
302 return _webStateObserverBridge ? _webStateObserverBridge->web_state() | 308 return _webStateObserverBridge ? _webStateObserverBridge->web_state() |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 375 |
370 - (BOOL)canReleaseDOMLock { | 376 - (BOOL)canReleaseDOMLock { |
371 return NO; | 377 return NO; |
372 } | 378 } |
373 | 379 |
374 - (void)releaseDOMLockWithCompletionHandler:(ProceduralBlock)completionHandler { | 380 - (void)releaseDOMLockWithCompletionHandler:(ProceduralBlock)completionHandler { |
375 NOTREACHED(); | 381 NOTREACHED(); |
376 } | 382 } |
377 | 383 |
378 @end | 384 @end |
OLD | NEW |