| Index: ios/chrome/browser/snapshots/snapshot_manager.h
|
| diff --git a/ios/chrome/browser/snapshots/snapshot_manager.h b/ios/chrome/browser/snapshots/snapshot_manager.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b22ce3e32aa13858446416ad10d8c5429842717d
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/snapshots/snapshot_manager.h
|
| @@ -0,0 +1,54 @@
|
| +// Copyright 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_
|
| +#define IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_
|
| +
|
| +#import <UIKit/UIKit.h>
|
| +
|
| +// Snapshot manager for contents of a tab. A snapshot is a full-screen image
|
| +// of the contents of the page at the current scroll offset and zoom level,
|
| +// used to stand in for the UIWebView if it has been purged from memory or when
|
| +// quickly switching tabs. Uses |SnapshotCache| to cache (and persist)
|
| +// snapshots.
|
| +//
|
| +// The snapshots are identified by a "session id" which is unique per tab. This
|
| +// allows quick identification and replacement as a tab changes pages.
|
| +@interface SnapshotManager : NSObject
|
| +
|
| +// Takes a snapshot for the supplied view. Returns an autoreleased image
|
| +// cropped and scaled appropriately. The image is not yet cached.
|
| +// The image can also contain overlays (if |overlays| is not nil and not empty).
|
| +- (UIImage*)generateSnapshotForView:(UIView*)view
|
| + withRect:(CGRect)rect
|
| + overlays:(NSArray*)overlays;
|
| +
|
| +// TODO(shreyasv): Consider passing the sessionID into SnapshotManager from Tab
|
| +// in the init method and simplifying the following methods.
|
| +// Retrieve a cached snapshot for the |sessionID| and return it via the callback
|
| +// if it exists. The callback is garanteed to be called synchronously if the
|
| +// image is in memory. It will be called asynchronously if the image is on disk
|
| +// or with nil if the image is not present at all.
|
| +- (void)retrieveImageForSessionID:(NSString*)sessionID
|
| + callback:(void (^)(UIImage*))callback;
|
| +
|
| +// Request the session's grey snapshot. If the image is already loaded in
|
| +// memory, this will immediately call back on |callback|. Otherwise, the grey
|
| +// image will be loaded off disk or created by converting an existing color
|
| +// snapshot to grey.
|
| +- (void)retrieveGreyImageForSessionID:(NSString*)sessionID
|
| + callback:(void (^)(UIImage*))callback;
|
| +
|
| +// Stores the supplied thumbnail for the specified |sessionID|.
|
| +- (void)setImage:(UIImage*)img withSessionID:(NSString*)sessionID;
|
| +
|
| +// Removes the cached thumbnail for the specified |sessionID|.
|
| +- (void)removeImageWithSessionID:(NSString*)sessionID;
|
| +
|
| +// Request the grey image from the in-memory cache only.
|
| +- (void)greyImageForSessionID:(NSString*)sessionID
|
| + callback:(void (^)(UIImage*))callback;
|
| +@end
|
| +
|
| +#endif // IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_
|
|
|