| 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 #ifndef IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_ | 5 #ifndef IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_ |
| 6 #define IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_ | 6 #define IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #include "ios/web/public/web_view_type.h" | 10 #include "ios/web/public/web_view_type.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // Takes a snapshot for the supplied view (which should correspond to the given | 22 // Takes a snapshot for the supplied view (which should correspond to the given |
| 23 // type of web view). Returns an autoreleased image cropped and scaled | 23 // type of web view). Returns an autoreleased image cropped and scaled |
| 24 // appropriately. | 24 // appropriately. |
| 25 // The image is not yet cached. | 25 // The image is not yet cached. |
| 26 // The image can also contain overlays (if |overlays| is not nil and not empty). | 26 // The image can also contain overlays (if |overlays| is not nil and not empty). |
| 27 - (UIImage*)generateSnapshotForView:(UIView*)view | 27 - (UIImage*)generateSnapshotForView:(UIView*)view |
| 28 withRect:(CGRect)rect | 28 withRect:(CGRect)rect |
| 29 overlays:(NSArray*)overlays; | 29 overlays:(NSArray*)overlays; |
| 30 | 30 |
| 31 // TODO(shreyasv): Consider passing the sessionID into SnapshotManager from Tab | |
| 32 // in the init method and simplifying the following methods. | |
| 33 // Retrieve a cached snapshot for the |sessionID| and return it via the callback | 31 // Retrieve a cached snapshot for the |sessionID| and return it via the callback |
| 34 // if it exists. The callback is garanteed to be called synchronously if the | 32 // if it exists. The callback is garanteed to be called synchronously if the |
| 35 // image is in memory. It will be called asynchronously if the image is on disk | 33 // image is in memory. It will be called asynchronously if the image is on disk |
| 36 // or with nil if the image is not present at all. | 34 // or with nil if the image is not present at all. |
| 37 - (void)retrieveImageForSessionID:(NSString*)sessionID | 35 - (void)retrieveImageForSessionID:(NSString*)sessionID |
| 38 callback:(void (^)(UIImage*))callback; | 36 callback:(void (^)(UIImage*))callback; |
| 39 | 37 |
| 40 // Request the session's grey snapshot. If the image is already loaded in | 38 // Request the session's grey snapshot. If the image is already loaded in |
| 41 // memory, this will immediately call back on |callback|. Otherwise, the grey | 39 // memory, this will immediately call back on |callback|. Otherwise, the grey |
| 42 // image will be loaded off disk or created by converting an existing color | 40 // image will be loaded off disk or created by converting an existing color |
| 43 // snapshot to grey. | 41 // snapshot to grey. |
| 44 - (void)retrieveGreyImageForSessionID:(NSString*)sessionID | 42 - (void)retrieveGreyImageForSessionID:(NSString*)sessionID |
| 45 callback:(void (^)(UIImage*))callback; | 43 callback:(void (^)(UIImage*))callback; |
| 46 | 44 |
| 47 // Stores the supplied thumbnail for the specified |sessionID|. | 45 // Stores the supplied thumbnail for the specified |sessionID|. |
| 48 - (void)setImage:(UIImage*)img withSessionID:(NSString*)sessionID; | 46 - (void)setImage:(UIImage*)img withSessionID:(NSString*)sessionID; |
| 49 | 47 |
| 50 // Removes the cached thumbnail for the specified |sessionID|. | 48 // Removes the cached thumbnail for the specified |sessionID|. |
| 51 - (void)removeImageWithSessionID:(NSString*)sessionID; | 49 - (void)removeImageWithSessionID:(NSString*)sessionID; |
| 52 | 50 |
| 53 // Request the grey image from the in-memory cache only. | 51 // Request the grey image from the in-memory cache only. |
| 54 - (void)greyImageForSessionID:(NSString*)sessionID | 52 - (void)greyImageForSessionID:(NSString*)sessionID |
| 55 callback:(void (^)(UIImage*))callback; | 53 callback:(void (^)(UIImage*))callback; |
| 56 @end | 54 @end |
| 57 | 55 |
| 58 #endif // IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_ | 56 #endif // IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_ |
| OLD | NEW |