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

Side by Side Diff: ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.mm

Issue 2776083003: Use correct snapshot for the tab transition animation on iPad (Closed)
Patch Set: Formatting changes Created 3 years, 8 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
« no previous file with comments | « ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h" 5 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h"
6 6
7 #include "base/mac/objc_property_releaser.h" 7 #include "base/mac/objc_property_releaser.h"
8 #import "ios/chrome/browser/tabs/tab.h" 8 #import "ios/chrome/browser/tabs/tab.h"
9 #import "ios/chrome/browser/ui/browser_view_controller.h" 9 #import "ios/chrome/browser/ui/browser_view_controller.h"
10 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h" 10 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h"
(...skipping 14 matching lines...) Expand all
25 @implementation TabSwitcherTransitionContextContent { 25 @implementation TabSwitcherTransitionContextContent {
26 base::mac::ObjCPropertyReleaser 26 base::mac::ObjCPropertyReleaser
27 _propertyReleaser_tabSwitcherTransitionContextContent; 27 _propertyReleaser_tabSwitcherTransitionContextContent;
28 } 28 }
29 29
30 + (instancetype)tabSwitcherTransitionContextContentFromBVC: 30 + (instancetype)tabSwitcherTransitionContextContentFromBVC:
31 (BrowserViewController*)bvc { 31 (BrowserViewController*)bvc {
32 TabSwitcherTransitionContextContent* transitionContextContent = 32 TabSwitcherTransitionContextContent* transitionContextContent =
33 [[[TabSwitcherTransitionContextContent alloc] init] autorelease]; 33 [[[TabSwitcherTransitionContextContent alloc] init] autorelease];
34 34
35 Tab* currentTab = [[bvc tabModel] currentTab]; 35 transitionContextContent.initialTabID = bvc.tabModel.currentTab.tabId;
36 transitionContextContent.initialSelectedTabIndex =
37 [[bvc tabModel] indexOfTab:currentTab];
38 36
39 if (![bvc isViewLoaded]) { 37 if (![bvc isViewLoaded]) {
40 [bvc ensureViewCreated]; 38 [bvc ensureViewCreated];
41 [bvc.view setFrame:[[UIScreen mainScreen] bounds]]; 39 [bvc.view setFrame:[[UIScreen mainScreen] bounds]];
42 } 40 }
43 41
44 UIView* toolbarView = [[bvc toolbarController] view]; 42 UIView* toolbarView = [[bvc toolbarController] view];
45 base::scoped_nsobject<UIView> toolbarSnapshotView; 43 base::scoped_nsobject<UIView> toolbarSnapshotView;
46 if ([toolbarView window]) { 44 if ([toolbarView window]) {
47 toolbarSnapshotView.reset( 45 toolbarSnapshotView.reset(
48 [[toolbarView snapshotViewAfterScreenUpdates:NO] retain]); 46 [[toolbarView snapshotViewAfterScreenUpdates:NO] retain]);
49 } else { 47 } else {
50 toolbarSnapshotView.reset([[UIView alloc] initWithFrame:toolbarView.frame]); 48 toolbarSnapshotView.reset([[UIView alloc] initWithFrame:toolbarView.frame]);
51 [toolbarSnapshotView layer].contents = static_cast<id>( 49 [toolbarSnapshotView layer].contents = static_cast<id>(
52 CaptureViewWithOption(toolbarView, 1, kClientSideRendering).CGImage); 50 CaptureViewWithOption(toolbarView, 1, kClientSideRendering).CGImage);
53 } 51 }
54 transitionContextContent.toolbarSnapshotView = toolbarSnapshotView; 52 transitionContextContent.toolbarSnapshotView = toolbarSnapshotView;
55 transitionContextContent->_bvc.reset(bvc); 53 transitionContextContent->_bvc.reset(bvc);
56 return transitionContextContent; 54 return transitionContextContent;
57 } 55 }
58 56
59 - (TabSwitcherTabStripPlaceholderView*)generateTabStripPlaceholderView { 57 - (TabSwitcherTabStripPlaceholderView*)generateTabStripPlaceholderView {
60 TabStripController* tsc = [_bvc tabStripController]; 58 TabStripController* tsc = [_bvc tabStripController];
61 return [tsc placeholderView]; 59 return [tsc placeholderView];
62 } 60 }
63 61
64 @synthesize toolbarSnapshotView = _toolbarSnapshotView; 62 @synthesize toolbarSnapshotView = _toolbarSnapshotView;
65 @synthesize initialSelectedTabIndex = _initialSelectedTabIndex; 63 @synthesize initialTabID = _initialTabID;
66 64
67 - (instancetype)init { 65 - (instancetype)init {
68 self = [super init]; 66 self = [super init];
69 if (self) { 67 if (self) {
70 _propertyReleaser_tabSwitcherTransitionContextContent.Init( 68 _propertyReleaser_tabSwitcherTransitionContextContent.Init(
71 self, [TabSwitcherTransitionContextContent class]); 69 self, [TabSwitcherTransitionContextContent class]);
72 } 70 }
73 return self; 71 return self;
74 } 72 }
75 73
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 - (instancetype)init { 108 - (instancetype)init {
111 self = [super init]; 109 self = [super init];
112 if (self) { 110 if (self) {
113 _propertyReleaser_tabSwitcherTransitionContext.Init( 111 _propertyReleaser_tabSwitcherTransitionContext.Init(
114 self, [TabSwitcherTransitionContext class]); 112 self, [TabSwitcherTransitionContext class]);
115 } 113 }
116 return self; 114 return self;
117 } 115 }
118 116
119 @end 117 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/tab_switcher/tab_switcher_transition_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698