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

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

Issue 2585233003: Upstream Chrome on iOS source code [2/11]. (Closed)
Patch Set: Created 3 years, 12 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 2014 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_WEB_CONTROLLER_SNAPSHOT_HELPER_H_
6 #define IOS_CHROME_BROWSER_SNAPSHOTS_WEB_CONTROLLER_SNAPSHOT_HELPER_H_
7
8 #import <UIKit/UIKit.h>
9
10 @class CRWWebController;
11 @class SnapshotManager;
12 @class Tab;
13
14 // A class that takes care of creating, storing and returning snapshots of a
15 // WebController's web page.
16 // TODO(crbug.com/661642): There is a lot of overlap/common functionality
17 // between this class and SnapshotManager, coalesce these 2 classes.
18 @interface WebControllerSnapshotHelper : NSObject
19
20 // Designated initializer. |snapshotManager|, |sessionID|, |webController|
21 // should not be nil.
22 // TODO(crbug.com/661641): Since we already retain a CRWWebController* and that
23 // is the same which is passed to these methods, remove the CRWWebController
24 // param from the following methods.
25 // TODO(crbug.com/380819): Replace the need to use Tab directly here by using a
26 // delegate pattern.
27 - (instancetype)initWithSnapshotManager:(SnapshotManager*)snapshotManager
28 tab:(Tab*)tab;
29
30 // If |snapshotCoalescingEnabled| is YES snapshots of the web page are
31 // coalesced until this method is called with |snapshotCoalescingEnabled| set to
32 // NO. When snapshot coalescing is enabled, mutiple calls to generate a snapshot
33 // with the same parameters may be coalesced.
34 - (void)setSnapshotCoalescingEnabled:(BOOL)snapshotCoalescingEnabled;
35
36 // Gets a color snapshot for the WebController's page, calling |callback| if it
37 // is found. |overlays| is the array of SnapshotOverlay objects (views currently
38 // overlayed), can be nil.
39 - (void)retrieveSnapshotForWebController:(CRWWebController*)webController
40 sessionID:(NSString*)sessionID
41 withOverlays:(NSArray*)overlays
42 callback:(void (^)(UIImage* image))callback;
43
44 // Gets a grey snapshot for the webController's current page, calling |callback|
45 // if it is found. |overlays| is the array of SnapshotOverlay objects
46 // (views currently overlayed), can be nil.
47 - (void)retrieveGreySnapshotForWebController:(CRWWebController*)webController
48 sessionID:(NSString*)sessionID
49 withOverlays:(NSArray*)overlays
50 callback:(void (^)(UIImage* image))callback;
51
52 // Invalidates the cached snapshot for the controller's current session and
53 // forces a more recent snapshot to be generated and stored. Returns the
54 // snapshot with or without the overlayed views (e.g. infobar, voice search
55 // button, etc.), and either of the visible frame or of the full screen.
56 // |overlays| is the array of SnapshotOverlay objects (views currently
57 // overlayed), can be nil.
58 - (UIImage*)updateSnapshotForWebController:(CRWWebController*)webController
59 sessionID:(NSString*)sessionID
60 withOverlays:(NSArray*)overlays
61 visibleFrameOnly:(BOOL)visibleFrameOnly;
62
63 // Takes a snapshot image for the current page including optional infobars.
64 // Returns an autoreleased image cropped and scaled appropriately, with or
65 // without the overlayed views (e.g. infobar, voice search button, etc.), and
66 // either of the visible frame or of the full screen.
67 // Returns nil if a snapshot cannot be generated.
68 // |overlays| is the array of SnapshotOverlay objects (views currently
69 // overlayed), can be nil.
70 - (UIImage*)generateSnapshotForWebController:(CRWWebController*)webController
71 withOverlays:(NSArray*)overlays
72 visibleFrameOnly:(BOOL)visibleFrameOnly;
73
74 @end
75
76 #endif // IOS_CHROME_BROWSER_SNAPSHOTS_WEB_CONTROLLER_SNAPSHOT_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698