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

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

Issue 2599313002: Create headerHeightForTab in TabHeadersDelegate. (Closed)
Patch Set: only fullscreencontroller and sideswipecontroller Created 3 years, 11 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h" 5 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h"
6 6
7 #import "base/ios/weak_nsobject.h" 7 #import "base/ios/weak_nsobject.h"
8 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 #import "ios/chrome/browser/snapshots/snapshot_manager.h" 9 #import "ios/chrome/browser/snapshots/snapshot_manager.h"
10 #import "ios/chrome/browser/tabs/tab.h" 10 #import "ios/chrome/browser/tabs/tab.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (snapshot == [[self class] defaultSnapshotImage]) 188 if (snapshot == [[self class] defaultSnapshotImage])
189 return snapshot; 189 return snapshot;
190 190
191 UIImage* snapshotToCache = nil; 191 UIImage* snapshotToCache = nil;
192 // TODO(crbug.com/370994): Remove all code that references a Tab's delegates 192 // TODO(crbug.com/370994): Remove all code that references a Tab's delegates
193 // from this file. 193 // from this file.
194 if (visibleFrameOnly || ![_tab fullScreenControllerDelegate]) { 194 if (visibleFrameOnly || ![_tab fullScreenControllerDelegate]) {
195 snapshotToCache = snapshot; 195 snapshotToCache = snapshot;
196 } else { 196 } else {
197 // Crops the bottom of the fullscreen snapshot. 197 // Crops the bottom of the fullscreen snapshot.
198 CGRect cropRect = 198 CGRect cropRect = CGRectMake(
199 CGRectMake(0, [[_tab fullScreenControllerDelegate] headerHeight], 199 0, [[_tab fullScreenControllerDelegate] headerHeightForTab:_tab],
200 [snapshot size].width, [snapshot size].height); 200 [snapshot size].width, [snapshot size].height);
201 snapshotToCache = CropImage(snapshot, cropRect); 201 snapshotToCache = CropImage(snapshot, cropRect);
202 } 202 }
203 [_snapshotManager setImage:snapshotToCache withSessionID:sessionID]; 203 [_snapshotManager setImage:snapshotToCache withSessionID:sessionID];
204 return snapshot; 204 return snapshot;
205 } 205 }
206 206
207 - (UIImage*)generateSnapshotForWebController:(CRWWebController*)webController 207 - (UIImage*)generateSnapshotForWebController:(CRWWebController*)webController
208 withOverlays:(NSArray*)overlays 208 withOverlays:(NSArray*)overlays
209 visibleFrameOnly:(BOOL)visibleFrameOnly { 209 visibleFrameOnly:(BOOL)visibleFrameOnly {
210 if (![webController canUseViewForGeneratingOverlayPlaceholderView]) 210 if (![webController canUseViewForGeneratingOverlayPlaceholderView])
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 257 }
258 258
259 - (UIImage*)cachedSnapshotWithOverlays:(NSArray*)overlays 259 - (UIImage*)cachedSnapshotWithOverlays:(NSArray*)overlays
260 visibleFrameOnly:(BOOL)visibleFrameOnly { 260 visibleFrameOnly:(BOOL)visibleFrameOnly {
261 return 261 return
262 [_coalescingSnapshotContext cachedSnapshotWithOverlays:overlays 262 [_coalescingSnapshotContext cachedSnapshotWithOverlays:overlays
263 visibleFrameOnly:visibleFrameOnly]; 263 visibleFrameOnly:visibleFrameOnly];
264 } 264 }
265 265
266 @end 266 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/tabs/tab.mm » ('j') | ios/chrome/browser/ui/fullscreen_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698