cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ios / chrome / browser / snapshots / snapshot_manager.h
blob82d3511a7cbf5b6450151ac6040c9fbe421b5de8
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.
5 #ifndef IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_
6 #define IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_
8 #import <UIKit/UIKit.h>
10 #include "ios/web/public/web_view_type.h"
12 // Snapshot manager for contents of a tab. A snapshot is a full-screen image
13 // of the contents of the page at the current scroll offset and zoom level,
14 // used to stand in for the web view if it has been purged from memory or when
15 // quickly switching tabs. Uses |SnapshotCache| to cache (and persist)
16 // snapshots.
18 // The snapshots are identified by a "session id" which is unique per tab. This
19 // allows quick identification and replacement as a tab changes pages.
20 @interface SnapshotManager : NSObject
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
24 // appropriately.
25 // The image is not yet cached.
26 // The image can also contain overlays (if |overlays| is not nil and not empty).
27 - (UIImage*)generateSnapshotForView:(UIView*)view
28 withRect:(CGRect)rect
29 overlays:(NSArray*)overlays;
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
34 // 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
36 // or with nil if the image is not present at all.
37 - (void)retrieveImageForSessionID:(NSString*)sessionID
38 callback:(void (^)(UIImage*))callback;
40 // 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
42 // image will be loaded off disk or created by converting an existing color
43 // snapshot to grey.
44 - (void)retrieveGreyImageForSessionID:(NSString*)sessionID
45 callback:(void (^)(UIImage*))callback;
47 // Stores the supplied thumbnail for the specified |sessionID|.
48 - (void)setImage:(UIImage*)img withSessionID:(NSString*)sessionID;
50 // Removes the cached thumbnail for the specified |sessionID|.
51 - (void)removeImageWithSessionID:(NSString*)sessionID;
53 // Request the grey image from the in-memory cache only.
54 - (void)greyImageForSessionID:(NSString*)sessionID
55 callback:(void (^)(UIImage*))callback;
56 @end
58 #endif // IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_MANAGER_H_