Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "ios/chrome/browser/ui/clipboard_util.h" | |
| 6 | |
| 7 #import <MobileCoreServices/MobileCoreServices.h> | |
| 8 #import <UIKit/UIKit.h> | |
| 9 | |
| 10 #include "base/strings/sys_string_conversions.h" | |
| 11 #import "net/base/mac/url_conversions.h" | |
| 12 #include "url/gurl.h" | |
| 13 | |
| 14 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.
| |
| 15 DCHECK(URL.is_valid()); | |
| 16 NSData* plainText = [base::SysUTF8ToNSString(URL.spec()) | |
| 17 dataUsingEncoding:NSUTF8StringEncoding]; | |
| 18 NSDictionary* copiedItem = @{ | |
| 19 (NSString*)kUTTypeURL : net::NSURLWithGURL(URL), | |
| 20 (NSString*)kUTTypeUTF8PlainText : plainText, | |
| 21 }; | |
| 22 [[UIPasteboard generalPasteboard] setItems:@[ copiedItem ]]; | |
| 23 } | |
| OLD | NEW |