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

Unified Diff: ios/chrome/browser/ui/clipboard_util.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/clipboard_util.mm
diff --git a/ios/chrome/browser/ui/clipboard_util.mm b/ios/chrome/browser/ui/clipboard_util.mm
new file mode 100644
index 0000000000000000000000000000000000000000..7f6c816f5fb46c7f9fe8cc6c2668bce0729518aa
--- /dev/null
+++ b/ios/chrome/browser/ui/clipboard_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/clipboard_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) {
Olivier 2017/02/01 12:22:05 nit: choose pasteboard or clipboard for name of me
gambard 2017/02/01 17:13:37 Done.
+ 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 ]];
+}

Powered by Google App Engine
This is Rietveld 408576698