Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: ios/chrome/browser/snapshots/snapshot_manager.h

Issue 862693003: Upstream //ios/chrome/browser/snapshots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_
6 #define IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_
7
8 #import <UIKit/UIKit.h>
9
10 // Snapshot manager for contents of a tab. A snapshot is a full-screen image
11 // of the contents of the page at the current scroll offset and zoom level,
12 // used to stand in for the UIWebView if it has been purged from memory or when
13 // quickly switching tabs. Uses |SnapshotCache| to cache (and persist)
14 // snapshots.
15 //
16 // The snapshots are identified by a "session id" which is unique per tab. This
17 // allows quick identification and replacement as a tab changes pages.
18 @interface SnapshotManager : NSObject
19
20 // Takes a snapshot for the supplied view. Returns an autoreleased image
21 // cropped and scaled appropriately. The image is not yet cached.
22 // The image can also contain overlays (if |overlays| is not nil and not empty).
23 - (UIImage*)generateSnapshotForView:(UIView*)view
24 withRect:(CGRect)rect
25 overlays:(NSArray*)overlays;
26
27 // TODO(shreyasv): Consider passing the sessionID into SnapshotManager from Tab
28 // in the init method and simplifying the following methods.
29 // Retrieve a cached snapshot for the |sessionID| and return it via the callback
30 // if it exists. The callback is garanteed to be called synchronously if the
31 // image is in memory. It will be called asynchronously if the image is on disk
32 // or with nil if the image is not present at all.
33 - (void)retrieveImageForSessionID:(NSString*)sessionID
34 callback:(void (^)(UIImage*))callback;
35
36 // Request the session's grey snapshot. If the image is already loaded in
37 // memory, this will immediately call back on |callback|. Otherwise, the grey
38 // image will be loaded off disk or created by converting an existing color
39 // snapshot to grey.
40 - (void)retrieveGreyImageForSessionID:(NSString*)sessionID
41 callback:(void (^)(UIImage*))callback;
42
43 // Stores the supplied thumbnail for the specified |sessionID|.
44 - (void)setImage:(UIImage*)img withSessionID:(NSString*)sessionID;
45
46 // Removes the cached thumbnail for the specified |sessionID|.
47 - (void)removeImageWithSessionID:(NSString*)sessionID;
48
49 // Request the grey image from the in-memory cache only.
50 - (void)greyImageForSessionID:(NSString*)sessionID
51 callback:(void (^)(UIImage*))callback;
52 @end
53
54 #endif // IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/snapshots/snapshot_cache_unittest.mm ('k') | ios/chrome/browser/snapshots/snapshot_manager.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698