| 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_model.h" | 5 #import "ios/chrome/browser/find_in_page/find_in_page_model.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_nsobject.h" | 7 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 8 #error "This file requires ARC support." |
| 9 #endif |
| 8 | 10 |
| 9 @implementation FindInPageModel { | 11 @interface FindInPageModel () |
| 10 base::scoped_nsobject<NSString> _text; | 12 // Redefined as readwrite. |
| 11 } | 13 @property(copy, nonatomic, readwrite) NSString* text; |
| 14 @end |
| 12 | 15 |
| 16 @implementation FindInPageModel |
| 13 @synthesize enabled = _enabled; | 17 @synthesize enabled = _enabled; |
| 14 @synthesize matches = _matches; | 18 @synthesize matches = _matches; |
| 15 @synthesize currentIndex = _currentIndex; | 19 @synthesize currentIndex = _currentIndex; |
| 16 @synthesize currentPoint = _currentPoint; | 20 @synthesize currentPoint = _currentPoint; |
| 17 | 21 @synthesize text = _text; |
| 18 - (NSString*)text { | |
| 19 return _text; | |
| 20 } | |
| 21 | 22 |
| 22 - (void)setEnabled:(BOOL)enabled { | 23 - (void)setEnabled:(BOOL)enabled { |
| 23 _enabled = enabled; | 24 _enabled = enabled; |
| 24 _matches = 0; | 25 _matches = 0; |
| 25 _currentIndex = 0; | 26 _currentIndex = 0; |
| 26 _currentPoint = CGPointZero; | 27 _currentPoint = CGPointZero; |
| 27 } | 28 } |
| 28 | 29 |
| 29 - (void)updateQuery:(NSString*)query matches:(NSUInteger)matches { | 30 - (void)updateQuery:(NSString*)query matches:(NSUInteger)matches { |
| 30 if (query) | 31 if (query) |
| 31 _text.reset([query copy]); | 32 self.text = query; |
| 32 _matches = matches; | 33 _matches = matches; |
| 33 _currentIndex = 0; | 34 _currentIndex = 0; |
| 34 } | 35 } |
| 35 | 36 |
| 36 - (void)updateIndex:(NSInteger)index atPoint:(CGPoint)point { | 37 - (void)updateIndex:(NSInteger)index atPoint:(CGPoint)point { |
| 37 _currentIndex = index; | 38 _currentIndex = index; |
| 38 _currentPoint = point; | 39 _currentPoint = point; |
| 39 } | 40 } |
| 40 | 41 |
| 41 @end | 42 @end |
| OLD | NEW |