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

Side by Side Diff: ios/chrome/browser/ui/browser_view_controller.mm

Issue 2645653003: Expose thumbnails of pages to iOS share extensions. (Closed)
Patch Set: 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 2012 The Chromium Authors. All rights reserved. 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 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/ui/browser_view_controller.h" 5 #import "ios/chrome/browser/ui/browser_view_controller.h"
6 6
7 #import <AssetsLibrary/AssetsLibrary.h> 7 #import <AssetsLibrary/AssetsLibrary.h>
8 #import <MobileCoreServices/MobileCoreServices.h> 8 #import <MobileCoreServices/MobileCoreServices.h>
9 #import <PassKit/PassKit.h> 9 #import <PassKit/PassKit.h>
10 #import <Photos/Photos.h> 10 #import <Photos/Photos.h>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" 76 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h"
77 #import "ios/chrome/browser/storekit_launcher.h" 77 #import "ios/chrome/browser/storekit_launcher.h"
78 #import "ios/chrome/browser/tabs/tab.h" 78 #import "ios/chrome/browser/tabs/tab.h"
79 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h" 79 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h"
80 #import "ios/chrome/browser/tabs/tab_headers_delegate.h" 80 #import "ios/chrome/browser/tabs/tab_headers_delegate.h"
81 #import "ios/chrome/browser/tabs/tab_model.h" 81 #import "ios/chrome/browser/tabs/tab_model.h"
82 #import "ios/chrome/browser/tabs/tab_model_observer.h" 82 #import "ios/chrome/browser/tabs/tab_model_observer.h"
83 #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h" 83 #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h"
84 #import "ios/chrome/browser/ui/activity_services/share_protocol.h" 84 #import "ios/chrome/browser/ui/activity_services/share_protocol.h"
85 #import "ios/chrome/browser/ui/activity_services/share_to_data.h" 85 #import "ios/chrome/browser/ui/activity_services/share_to_data.h"
86 #import "ios/chrome/browser/ui/activity_services/share_to_data_builder.h"
87 #import "ios/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_ generator.h"
Olivier 2017/01/20 10:14:00 alphabetical order
jif 2017/01/24 10:29:50 Done.
86 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" 88 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h"
87 #import "ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h" 89 #import "ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h"
88 #import "ios/chrome/browser/ui/background_generator.h" 90 #import "ios/chrome/browser/ui/background_generator.h"
89 #import "ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h" 91 #import "ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h"
90 #import "ios/chrome/browser/ui/browser_container_view.h" 92 #import "ios/chrome/browser/ui/browser_container_view.h"
91 #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h" 93 #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h"
92 #import "ios/chrome/browser/ui/chrome_web_view_factory.h" 94 #import "ios/chrome/browser/ui/chrome_web_view_factory.h"
93 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" 95 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
94 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" 96 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
95 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" 97 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 - (void)showNoTabsUI; 590 - (void)showNoTabsUI;
589 // Dismisses the No-Tabs UI with animation. 591 // Dismisses the No-Tabs UI with animation.
590 - (void)dismissNoTabsUI; 592 - (void)dismissNoTabsUI;
591 593
592 // Shows the tools menu popup. 594 // Shows the tools menu popup.
593 - (void)showToolsMenuPopup; 595 - (void)showToolsMenuPopup;
594 // Add all delegates to the provided |tab|. 596 // Add all delegates to the provided |tab|.
595 - (void)installDelegatesForTab:(Tab*)tab; 597 - (void)installDelegatesForTab:(Tab*)tab;
596 // Closes the current tab, with animation if applicable. 598 // Closes the current tab, with animation if applicable.
597 - (void)closeCurrentTab; 599 - (void)closeCurrentTab;
598 // Returns an autoreleased share to data for |tab|.
599 - (ShareToData*)shareToDataForTab:(Tab*)tab;
600 // Shows the menu to initiate sharing |data|. 600 // Shows the menu to initiate sharing |data|.
601 - (void)sharePageWithData:(ShareToData*)data; 601 - (void)sharePageWithData:(ShareToData*)data;
602 // Convenience method to share the current page. 602 // Convenience method to share the current page.
603 - (void)sharePage; 603 - (void)sharePage;
604 // Prints the web page in the current tab. 604 // Prints the web page in the current tab.
605 - (void)print; 605 - (void)print;
606 // Shows the Online Help Page in a tab. 606 // Shows the Online Help Page in a tab.
607 - (void)showHelpPage; 607 - (void)showHelpPage;
608 // Show the bookmarks page. 608 // Show the bookmarks page.
609 - (void)showAllBookmarks; 609 - (void)showAllBookmarks;
(...skipping 3518 matching lines...) Expand 10 before | Expand all | Expand 10 after
4128 // Do not animate close in iPad. 4128 // Do not animate close in iPad.
4129 if (!IsIPadIdiom()) { 4129 if (!IsIPadIdiom()) {
4130 [_contentArea addSubview:exitingPage]; 4130 [_contentArea addSubview:exitingPage];
4131 ios_internal::page_animation_util::AnimateOutWithCompletion( 4131 ios_internal::page_animation_util::AnimateOutWithCompletion(
4132 exitingPage, 0, YES, IsPortrait(), ^{ 4132 exitingPage, 0, YES, IsPortrait(), ^{
4133 [exitingPage removeFromSuperview]; 4133 [exitingPage removeFromSuperview];
4134 }); 4134 });
4135 } 4135 }
4136 } 4136 }
4137 4137
4138 - (ShareToData*)shareToDataForTab:(Tab*)tab {
4139 // For crash documented in crbug.com/503955, tab.url which is being passed
4140 // as a reference parameter caused a crash due to invalid address which
4141 // which suggests that |tab| may be deallocated along the way. Check that
4142 // tab is still valid by checking webState which would be deallocated if
4143 // tab is being closed.
4144 if (!tab.webState)
4145 return nil;
4146 DCHECK(tab);
4147 // If the original page title exists, it is expected to match the tab title.
4148 // If this ever changes, then a decision has to be made on which one should
4149 // be used for sharing.
4150 DCHECK(!tab.originalTitle || [tab.originalTitle isEqualToString:tab.title]);
4151 BOOL isPagePrintable = [tab viewForPrinting] != nil;
4152 return [[[ShareToData alloc] initWithURL:tab.url
4153 title:tab.title
4154 isOriginalTitle:(tab.originalTitle != nil)
4155 isPagePrintable:isPagePrintable] autorelease];
4156 }
4157
4158 - (void)sharePage { 4138 - (void)sharePage {
4159 ShareToData* data = [self shareToDataForTab:[_model currentTab]]; 4139 ShareToData* data =
4140 activity_services::ShareToDataFromTab([_model currentTab]);
4160 if (data) 4141 if (data)
4161 [self sharePageWithData:data]; 4142 [self sharePageWithData:data];
4162 } 4143 }
4163 4144
4164 - (void)sharePageWithData:(ShareToData*)data { 4145 - (void)sharePageWithData:(ShareToData*)data {
4165 id<ShareProtocol> controller = [_dependencyFactory shareControllerInstance]; 4146 id<ShareProtocol> controller = [_dependencyFactory shareControllerInstance];
4166 if ([controller isActive]) 4147 if ([controller isActive])
4167 return; 4148 return;
4168 CGRect fromRect = [_toolbarController shareButtonAnchorRect]; 4149 CGRect fromRect = [_toolbarController shareButtonAnchorRect];
4169 UIView* inView = [_toolbarController shareButtonView]; 4150 UIView* inView = [_toolbarController shareButtonView];
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
5137 5118
5138 - (UIView*)voiceSearchButton { 5119 - (UIView*)voiceSearchButton {
5139 return _voiceSearchButton; 5120 return _voiceSearchButton;
5140 } 5121 }
5141 5122
5142 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5123 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5143 return [self currentLogoAnimationControllerOwner]; 5124 return [self currentLogoAnimationControllerOwner];
5144 } 5125 }
5145 5126
5146 @end 5127 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698