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

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 comment 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 side-by-side diff with in-line comments
Download patch
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..a1aec8e1851f284c4959b8835cfd22e785bdc63d 100644
--- a/ios/chrome/browser/ui/history/history_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/history/history_collection_view_controller.mm
@@ -22,6 +22,7 @@
#include "ios/chrome/browser/signin/authentication_service_factory.h"
#include "ios/chrome/browser/sync/sync_setup_service.h"
#include "ios/chrome/browser/sync/sync_setup_service_factory.h"
+#import "ios/chrome/browser/ui/clipboard_util.h"
#import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h"
#import "ios/chrome/browser/ui/collection_view/cells/activity_indicator_cell.h"
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.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

Powered by Google App Engine
This is Rietveld 408576698