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

Unified Diff: ios/chrome/browser/ui/history/history_collection_view_controller.mm

Issue 2659693004: Add context menu when long press on a reading list entry (Closed)
Patch Set: Address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/browser_view_controller.mm ('k') | ios/chrome/browser/ui/reading_list/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ios/chrome/browser/ui/browser_view_controller.mm ('k') | ios/chrome/browser/ui/reading_list/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698