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

Unified Diff: ios/chrome/browser/ui/util/pasteboard_util.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/util/pasteboard_util.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/util/pasteboard_util.mm
diff --git a/ios/chrome/browser/ui/util/pasteboard_util.mm b/ios/chrome/browser/ui/util/pasteboard_util.mm
new file mode 100644
index 0000000000000000000000000000000000000000..2efaedf9ae087698b661d787dbcbfa6331b79413
--- /dev/null
+++ b/ios/chrome/browser/ui/util/pasteboard_util.mm
@@ -0,0 +1,23 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/ui/util/pasteboard_util.h"
+
+#import <MobileCoreServices/MobileCoreServices.h>
+#import <UIKit/UIKit.h>
+
+#include "base/strings/sys_string_conversions.h"
+#import "net/base/mac/url_conversions.h"
+#include "url/gurl.h"
+
+void StoreURLInPasteboard(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 ]];
+}
« no previous file with comments | « ios/chrome/browser/ui/util/pasteboard_util.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698