diff options
author | sherouk <sherouk@google.com> | 2015-07-08 06:06:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-08 13:07:18 +0000 |
commit | 452009a40b27e551a780954ab5c1e34cbe0f7b66 (patch) | |
tree | 1ff56592036656935ab525e8c0da8ef9996dc65d /ios/chrome/browser/find_in_page | |
parent | e94287bc2c5d967c29054c8f01ccab61f4e537ad (diff) | |
download | chromium_src-452009a40b27e551a780954ab5c1e34cbe0f7b66.zip chromium_src-452009a40b27e551a780954ab5c1e34cbe0f7b66.tar.gz chromium_src-452009a40b27e551a780954ab5c1e34cbe0f7b66.tar.bz2 |
Cleanup FindInPageModel
BUG=None
Review URL: https://codereview.chromium.org/1224643006
Cr-Commit-Position: refs/heads/master@{#337804}
Diffstat (limited to 'ios/chrome/browser/find_in_page')
-rw-r--r-- | ios/chrome/browser/find_in_page/find_in_page_model.h | 31 | ||||
-rw-r--r-- | ios/chrome/browser/find_in_page/find_in_page_model.mm | 34 |
2 files changed, 33 insertions, 32 deletions
diff --git a/ios/chrome/browser/find_in_page/find_in_page_model.h b/ios/chrome/browser/find_in_page/find_in_page_model.h index 3199b64..dedb5f4 100644 --- a/ios/chrome/browser/find_in_page/find_in_page_model.h +++ b/ios/chrome/browser/find_in_page/find_in_page_model.h @@ -5,28 +5,25 @@ #ifndef IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_MODEL_H_ #define IOS_CHROME_BROWSER_FIND_IN_PAGE_FIND_IN_PAGE_MODEL_H_ -#import <UIKit/UIKit.h> -#include "base/mac/scoped_nsobject.h" +#include <CoreGraphics/CoreGraphics.h> +#import <Foundation/Foundation.h> // This is a simplified version of find_tab_helper.cc. -@interface FindInPageModel : NSObject { - @private - // Should find in page be displayed. - BOOL enabled_; - // The current search string. - base::scoped_nsobject<NSString> text_; - // The number of matches for |text_| - NSUInteger matches_; - // The currently higlighted index. - NSUInteger currentIndex_; - // The content offset needed to display the |currentIndex_| match. - CGPoint currentPoint_; -} - -@property(nonatomic, readwrite, assign) BOOL enabled; +@interface FindInPageModel : NSObject + +// Should find in page be displayed. +@property(nonatomic, assign) BOOL enabled; + +// The current search string. @property(nonatomic, readonly) NSString* text; + +// The number of matches for |text|. @property(nonatomic, readonly) NSUInteger matches; + +// The currently higlighted index. @property(nonatomic, readonly) NSUInteger currentIndex; + +// The content offset needed to display the |currentIndex| match. @property(nonatomic, readonly) CGPoint currentPoint; // Update the query string and the number of matches. diff --git a/ios/chrome/browser/find_in_page/find_in_page_model.mm b/ios/chrome/browser/find_in_page/find_in_page_model.mm index ea107eb..8cc3ec4 100644 --- a/ios/chrome/browser/find_in_page/find_in_page_model.mm +++ b/ios/chrome/browser/find_in_page/find_in_page_model.mm @@ -4,34 +4,38 @@ #import "ios/chrome/browser/find_in_page/find_in_page_model.h" -@implementation FindInPageModel +#include "base/mac/scoped_nsobject.h" -@synthesize enabled = enabled_; -@synthesize matches = matches_; -@synthesize currentIndex = currentIndex_; -@synthesize currentPoint = currentPoint_; +@implementation FindInPageModel { + base::scoped_nsobject<NSString> _text; +} + +@synthesize enabled = _enabled; +@synthesize matches = _matches; +@synthesize currentIndex = _currentIndex; +@synthesize currentPoint = _currentPoint; - (NSString*)text { - return text_; + return _text; } - (void)setEnabled:(BOOL)enabled { - enabled_ = enabled; - matches_ = 0; - currentIndex_ = 0; - currentPoint_ = CGPointZero; + _enabled = enabled; + _matches = 0; + _currentIndex = 0; + _currentPoint = CGPointZero; } - (void)updateQuery:(NSString*)query matches:(NSUInteger)matches { if (query) - text_.reset([query copy]); - matches_ = matches; - currentIndex_ = 0; + _text.reset([query copy]); + _matches = matches; + _currentIndex = 0; } - (void)updateIndex:(NSInteger)index atPoint:(CGPoint)point { - currentIndex_ = index; - currentPoint_ = point; + _currentIndex = index; + _currentPoint = point; } @end |