Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2441 if (link.SchemeIs(url::kJavaScriptScheme)) { | 2441 if (link.SchemeIs(url::kJavaScriptScheme)) { |
| 2442 // Open | 2442 // Open |
| 2443 title = l10n_util::GetNSStringWithFixup(IDS_IOS_CONTENT_CONTEXT_OPEN); | 2443 title = l10n_util::GetNSStringWithFixup(IDS_IOS_CONTENT_CONTEXT_OPEN); |
| 2444 action = ^{ | 2444 action = ^{ |
| 2445 Record(ACTION_OPEN_JAVASCRIPT, isImage, isLink); | 2445 Record(ACTION_OPEN_JAVASCRIPT, isImage, isLink); |
| 2446 [weakSelf openJavascript:base::SysUTF8ToNSString(link.GetContent())]; | 2446 [weakSelf openJavascript:base::SysUTF8ToNSString(link.GetContent())]; |
| 2447 }; | 2447 }; |
| 2448 [_contextMenuCoordinator addItemWithTitle:title action:action]; | 2448 [_contextMenuCoordinator addItemWithTitle:title action:action]; |
| 2449 } | 2449 } |
| 2450 | 2450 |
| 2451 if (web::UrlHasWebScheme(link)) { | 2451 if (web::UrlHasWebScheme(link)) { |
|
Olivier
2017/01/17 09:34:55
I know this is not in the scope of this CL, but th
| |
| 2452 web::Referrer referrer([_model currentTab].url, params.referrer_policy); | 2452 web::Referrer referrer([_model currentTab].url, params.referrer_policy); |
| 2453 | 2453 |
| 2454 if (reading_list::switches::IsReadingListEnabled()) { | |
| 2455 NSString* innerText = params.link_text; | |
| 2456 if ([innerText length] > 0) { | |
| 2457 // Add to reading list. | |
| 2458 title = l10n_util::GetNSStringWithFixup( | |
| 2459 IDS_IOS_CONTENT_CONTEXT_ADDTOREADINGLIST); | |
| 2460 action = ^{ | |
| 2461 Record(ACTION_READ_LATER, isImage, isLink); | |
| 2462 [weakSelf addToReadingListURL:link title:innerText]; | |
| 2463 }; | |
| 2464 [_contextMenuCoordinator addItemWithTitle:title action:action]; | |
| 2465 } | |
| 2466 } | |
| 2467 | |
| 2468 // Open in New Tab. | 2454 // Open in New Tab. |
| 2469 title = l10n_util::GetNSStringWithFixup( | 2455 title = l10n_util::GetNSStringWithFixup( |
| 2470 IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWTAB); | 2456 IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWTAB); |
| 2471 action = ^{ | 2457 action = ^{ |
| 2472 Record(ACTION_OPEN_IN_NEW_TAB, isImage, isLink); | 2458 Record(ACTION_OPEN_IN_NEW_TAB, isImage, isLink); |
| 2473 [weakSelf webPageOrderedOpen:link | 2459 [weakSelf webPageOrderedOpen:link |
| 2474 referrer:referrer | 2460 referrer:referrer |
| 2475 windowName:nil | 2461 windowName:nil |
| 2476 inBackground:YES | 2462 inBackground:YES |
| 2477 appendTo:kCurrentTab]; | 2463 appendTo:kCurrentTab]; |
| 2478 }; | 2464 }; |
| 2479 [_contextMenuCoordinator addItemWithTitle:title action:action]; | 2465 [_contextMenuCoordinator addItemWithTitle:title action:action]; |
| 2480 if (!_isOffTheRecord) { | 2466 if (!_isOffTheRecord) { |
| 2481 // Open in Incognito Tab. | 2467 // Open in Incognito Tab. |
| 2482 title = l10n_util::GetNSStringWithFixup( | 2468 title = l10n_util::GetNSStringWithFixup( |
| 2483 IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWINCOGNITOTAB); | 2469 IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWINCOGNITOTAB); |
| 2484 action = ^{ | 2470 action = ^{ |
| 2485 Record(ACTION_OPEN_IN_INCOGNITO_TAB, isImage, isLink); | 2471 Record(ACTION_OPEN_IN_INCOGNITO_TAB, isImage, isLink); |
| 2486 [weakSelf webPageOrderedOpen:link | 2472 [weakSelf webPageOrderedOpen:link |
| 2487 referrer:referrer | 2473 referrer:referrer |
| 2488 windowName:nil | 2474 windowName:nil |
| 2489 inIncognito:YES | 2475 inIncognito:YES |
| 2490 inBackground:NO | 2476 inBackground:NO |
| 2491 appendTo:kCurrentTab]; | 2477 appendTo:kCurrentTab]; |
| 2492 }; | 2478 }; |
| 2493 [_contextMenuCoordinator addItemWithTitle:title action:action]; | 2479 [_contextMenuCoordinator addItemWithTitle:title action:action]; |
| 2494 } | 2480 } |
| 2481 | |
| 2482 if (reading_list::switches::IsReadingListEnabled()) { | |
| 2483 NSString* innerText = params.link_text; | |
| 2484 if ([innerText length] > 0) { | |
| 2485 // Add to reading list. | |
| 2486 title = l10n_util::GetNSStringWithFixup( | |
| 2487 IDS_IOS_CONTENT_CONTEXT_ADDTOREADINGLIST); | |
| 2488 action = ^{ | |
| 2489 Record(ACTION_READ_LATER, isImage, isLink); | |
| 2490 [weakSelf addToReadingListURL:link title:innerText]; | |
| 2491 }; | |
| 2492 [_contextMenuCoordinator addItemWithTitle:title action:action]; | |
| 2493 } | |
| 2494 } | |
| 2495 } | 2495 } |
| 2496 // Copy Link. | 2496 // Copy Link. |
| 2497 title = l10n_util::GetNSStringWithFixup(IDS_IOS_CONTENT_CONTEXT_COPY); | 2497 title = l10n_util::GetNSStringWithFixup(IDS_IOS_CONTENT_CONTEXT_COPY); |
| 2498 action = ^{ | 2498 action = ^{ |
| 2499 Record(ACTION_COPY_LINK_ADDRESS, isImage, isLink); | 2499 Record(ACTION_COPY_LINK_ADDRESS, isImage, isLink); |
| 2500 NSURL* url = net::NSURLWithGURL(link); | 2500 NSURL* url = net::NSURLWithGURL(link); |
| 2501 NSDictionary* item = @{ | 2501 NSDictionary* item = @{ |
| 2502 (NSString*)kUTTypeURL : url, | 2502 (NSString*)kUTTypeURL : url, |
| 2503 (NSString*)kUTTypeUTF8PlainText : | 2503 (NSString*)kUTTypeUTF8PlainText : |
| 2504 [[url absoluteString] dataUsingEncoding:NSUTF8StringEncoding], | 2504 [[url absoluteString] dataUsingEncoding:NSUTF8StringEncoding], |
| (...skipping 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5142 | 5142 |
| 5143 - (UIView*)voiceSearchButton { | 5143 - (UIView*)voiceSearchButton { |
| 5144 return _voiceSearchButton; | 5144 return _voiceSearchButton; |
| 5145 } | 5145 } |
| 5146 | 5146 |
| 5147 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5147 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5148 return [self currentLogoAnimationControllerOwner]; | 5148 return [self currentLogoAnimationControllerOwner]; |
| 5149 } | 5149 } |
| 5150 | 5150 |
| 5151 @end | 5151 @end |
| OLD | NEW |