| Index: ios/chrome/browser/ui/history/history_collection_view_controller.mm
|
| diff --git a/ios/chrome/browser/ui/history/history_collection_view_controller.mm b/ios/chrome/browser/ui/history/history_collection_view_controller.mm
|
| index 253fc7a6effb259d7f240e727e7626d43cb7ec90..c6c59a4a0b448800596dcb7a3207cd20d6a5dba8 100644
|
| --- a/ios/chrome/browser/ui/history/history_collection_view_controller.mm
|
| +++ b/ios/chrome/browser/ui/history/history_collection_view_controller.mm
|
| @@ -36,6 +36,7 @@
|
| #include "ios/chrome/browser/ui/history/history_service_facade_delegate.h"
|
| #include "ios/chrome/browser/ui/history/history_util.h"
|
| #import "ios/chrome/browser/ui/url_loader.h"
|
| +#import "ios/chrome/browser/ui/util/pasteboard_util.h"
|
| #include "ios/chrome/grit/ios_strings.h"
|
| #import "ios/third_party/material_components_ios/src/components/ActivityIndicator/src/MDCActivityIndicator.h"
|
| #import "ios/third_party/material_components_ios/src/components/Collections/src/MaterialCollections.h"
|
| @@ -127,8 +128,6 @@ const CGFloat kSeparatorInset = 10;
|
| - (void)openURLInNewTab:(const GURL&)URL;
|
| // Opens URL in a new incognito tab and dismisses the history view.
|
| - (void)openURLInNewIncognitoTab:(const GURL&)URL;
|
| -// Copies URL to the clipboard.
|
| -- (void)copyURL:(const GURL&)URL;
|
| @end
|
|
|
| @implementation HistoryCollectionViewController
|
| @@ -292,7 +291,7 @@ const CGFloat kSeparatorInset = 10;
|
| }
|
|
|
| - (void)historyEntryItemDidRequestCopy:(HistoryEntryItem*)item {
|
| - [self copyURL:item.URL];
|
| + StoreURLInPasteboard(item.URL);
|
| }
|
|
|
| - (void)historyEntryItemDidRequestOpenInNewTab:(HistoryEntryItem*)item {
|
| @@ -759,7 +758,7 @@ const CGFloat kSeparatorInset = 10;
|
| NSString* copyURLTitle =
|
| l10n_util::GetNSStringWithFixup(IDS_IOS_CONTENT_CONTEXT_COPY);
|
| ProceduralBlock copyURLAction = ^{
|
| - [weakSelf copyURL:entry.URL];
|
| + StoreURLInPasteboard(entry.URL);
|
| };
|
| [self.contextMenuCoordinator addItemWithTitle:copyURLTitle
|
| action:copyURLAction];
|
| @@ -805,15 +804,4 @@ const CGFloat kSeparatorInset = 10;
|
| }];
|
| }
|
|
|
| -- (void)copyURL:(const GURL&)URL {
|
| - DCHECK(URL.is_valid());
|
| - NSData* plainText = [base::SysUTF8ToNSString(URL.spec())
|
| - dataUsingEncoding:NSUTF8StringEncoding];
|
| - NSDictionary* copiedItem = @{
|
| - (NSString*)kUTTypeURL : net::NSURLWithGURL(URL),
|
| - (NSString*)kUTTypeUTF8PlainText : plainText,
|
| - };
|
| - [[UIPasteboard generalPasteboard] setItems:@[ copiedItem ]];
|
| -}
|
| -
|
| @end
|
|
|