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

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

Issue 2659693004: Add context menu when long press on a reading list entry (Closed)
Patch Set: Address comment Created 3 years, 10 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h" 84 #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h"
85 #import "ios/chrome/browser/ui/activity_services/share_protocol.h" 85 #import "ios/chrome/browser/ui/activity_services/share_protocol.h"
86 #import "ios/chrome/browser/ui/activity_services/share_to_data.h" 86 #import "ios/chrome/browser/ui/activity_services/share_to_data.h"
87 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" 87 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h"
88 #import "ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h" 88 #import "ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h"
89 #import "ios/chrome/browser/ui/background_generator.h" 89 #import "ios/chrome/browser/ui/background_generator.h"
90 #import "ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h" 90 #import "ios/chrome/browser/ui/bookmarks/bookmark_interaction_controller.h"
91 #import "ios/chrome/browser/ui/browser_container_view.h" 91 #import "ios/chrome/browser/ui/browser_container_view.h"
92 #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h" 92 #import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h"
93 #import "ios/chrome/browser/ui/chrome_web_view_factory.h" 93 #import "ios/chrome/browser/ui/chrome_web_view_factory.h"
94 #import "ios/chrome/browser/ui/clipboard_util.h"
94 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" 95 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
95 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" 96 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
96 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" 97 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
97 #import "ios/chrome/browser/ui/commands/open_url_command.h" 98 #import "ios/chrome/browser/ui/commands/open_url_command.h"
98 #import "ios/chrome/browser/ui/commands/reading_list_add_command.h" 99 #import "ios/chrome/browser/ui/commands/reading_list_add_command.h"
99 #import "ios/chrome/browser/ui/commands/show_mail_composer_command.h" 100 #import "ios/chrome/browser/ui/commands/show_mail_composer_command.h"
100 #import "ios/chrome/browser/ui/context_menu/context_menu_coordinator.h" 101 #import "ios/chrome/browser/ui/context_menu/context_menu_coordinator.h"
101 #import "ios/chrome/browser/ui/contextual_search/contextual_search_controller.h" 102 #import "ios/chrome/browser/ui/contextual_search/contextual_search_controller.h"
102 #import "ios/chrome/browser/ui/contextual_search/contextual_search_mask_view.h" 103 #import "ios/chrome/browser/ui/contextual_search/contextual_search_mask_view.h"
103 #import "ios/chrome/browser/ui/contextual_search/contextual_search_metrics.h" 104 #import "ios/chrome/browser/ui/contextual_search/contextual_search_metrics.h"
(...skipping 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 Record(ACTION_READ_LATER, isImage, isLink); 2494 Record(ACTION_READ_LATER, isImage, isLink);
2494 [weakSelf addToReadingListURL:link title:innerText]; 2495 [weakSelf addToReadingListURL:link title:innerText];
2495 }; 2496 };
2496 [_contextMenuCoordinator addItemWithTitle:title action:action]; 2497 [_contextMenuCoordinator addItemWithTitle:title action:action];
2497 } 2498 }
2498 } 2499 }
2499 // Copy Link. 2500 // Copy Link.
2500 title = l10n_util::GetNSStringWithFixup(IDS_IOS_CONTENT_CONTEXT_COPY); 2501 title = l10n_util::GetNSStringWithFixup(IDS_IOS_CONTENT_CONTEXT_COPY);
2501 action = ^{ 2502 action = ^{
2502 Record(ACTION_COPY_LINK_ADDRESS, isImage, isLink); 2503 Record(ACTION_COPY_LINK_ADDRESS, isImage, isLink);
2503 NSURL* url = net::NSURLWithGURL(link); 2504 StoreURLInPasteboard(link);
2504 NSDictionary* item = @{
2505 (NSString*)kUTTypeURL : url,
2506 (NSString*)kUTTypeUTF8PlainText :
2507 [[url absoluteString] dataUsingEncoding:NSUTF8StringEncoding],
2508 };
2509 [[UIPasteboard generalPasteboard] setItems:@[ item ]];
2510 }; 2505 };
2511 [_contextMenuCoordinator addItemWithTitle:title action:action]; 2506 [_contextMenuCoordinator addItemWithTitle:title action:action];
2512 } 2507 }
2513 if (isImage) { 2508 if (isImage) {
2514 web::Referrer referrer([_model currentTab].url, params.referrer_policy); 2509 web::Referrer referrer([_model currentTab].url, params.referrer_policy);
2515 // Save Image. 2510 // Save Image.
2516 if (experimental_flags::IsDownloadRenamingEnabled()) { 2511 if (experimental_flags::IsDownloadRenamingEnabled()) {
2517 title = l10n_util::GetNSStringWithFixup( 2512 title = l10n_util::GetNSStringWithFixup(
2518 IDS_IOS_CONTENT_CONTEXT_DOWNLOADIMAGE); 2513 IDS_IOS_CONTENT_CONTEXT_DOWNLOADIMAGE);
2519 } else { 2514 } else {
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
4375 Tab* tab = [_model currentTab]; 4370 Tab* tab = [_model currentTab];
4376 web::NavigationManager::WebLoadParams params(URL); 4371 web::NavigationManager::WebLoadParams params(URL);
4377 params.transition_type = ui::PAGE_TRANSITION_AUTO_BOOKMARK; 4372 params.transition_type = ui::PAGE_TRANSITION_AUTO_BOOKMARK;
4378 [[tab webController] loadWithParams:params]; 4373 [[tab webController] loadWithParams:params];
4379 } 4374 }
4380 4375
4381 - (void)showReadingList { 4376 - (void)showReadingList {
4382 DCHECK(reading_list::switches::IsReadingListEnabled()); 4377 DCHECK(reading_list::switches::IsReadingListEnabled());
4383 UIViewController* vc = [ReadingListViewControllerBuilder 4378 UIViewController* vc = [ReadingListViewControllerBuilder
4384 readingListViewControllerInBrowserState:self.browserState 4379 readingListViewControllerInBrowserState:self.browserState
4385 tabModel:_model]; 4380 loader:self];
4386 [self presentViewController:vc animated:YES completion:nil]; 4381 [self presentViewController:vc animated:YES completion:nil];
4387 } 4382 }
4388 4383
4389 - (void)showQRScanner { 4384 - (void)showQRScanner {
4390 _qrScannerViewController.reset( 4385 _qrScannerViewController.reset(
4391 [[QRScannerViewController alloc] initWithDelegate:_toolbarController]); 4386 [[QRScannerViewController alloc] initWithDelegate:_toolbarController]);
4392 [self presentViewController:[_qrScannerViewController 4387 [self presentViewController:[_qrScannerViewController
4393 getViewControllerToPresent] 4388 getViewControllerToPresent]
4394 animated:YES 4389 animated:YES
4395 completion:nil]; 4390 completion:nil];
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
5168 5163
5169 - (UIView*)voiceSearchButton { 5164 - (UIView*)voiceSearchButton {
5170 return _voiceSearchButton; 5165 return _voiceSearchButton;
5171 } 5166 }
5172 5167
5173 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5168 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5174 return [self currentLogoAnimationControllerOwner]; 5169 return [self currentLogoAnimationControllerOwner];
5175 } 5170 }
5176 5171
5177 @end 5172 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698