| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |