OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/web/shell/view_controller.h" | 5 #import "ios/web/shell/view_controller.h" |
6 | 6 |
7 #import <MobileCoreServices/MobileCoreServices.h> | 7 #import <MobileCoreServices/MobileCoreServices.h> |
8 | 8 |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 CGRectMake(params.location.x, params.location.y, 1.0, 1.0); | 306 CGRectMake(params.location.x, params.location.y, 1.0, 1.0); |
307 | 307 |
308 void (^handler)(UIAlertAction*) = ^(UIAlertAction*) { | 308 void (^handler)(UIAlertAction*) = ^(UIAlertAction*) { |
309 NSDictionary* item = @{ | 309 NSDictionary* item = @{ |
310 static_cast<NSString*>(kUTTypeURL) : net::NSURLWithGURL(link), | 310 static_cast<NSString*>(kUTTypeURL) : net::NSURLWithGURL(link), |
311 static_cast<NSString*>(kUTTypeUTF8PlainText) : [base::SysUTF8ToNSString( | 311 static_cast<NSString*>(kUTTypeUTF8PlainText) : [base::SysUTF8ToNSString( |
312 link.spec()) dataUsingEncoding:NSUTF8StringEncoding], | 312 link.spec()) dataUsingEncoding:NSUTF8StringEncoding], |
313 }; | 313 }; |
314 [[UIPasteboard generalPasteboard] setItems:@[ item ]]; | 314 [[UIPasteboard generalPasteboard] setItems:@[ item ]]; |
315 }; | 315 }; |
316 [alert addAction:[UIAlertAction actionWithTitle:@"Copy" | 316 [alert addAction:[UIAlertAction actionWithTitle:@"Copy Link" |
317 style:UIAlertActionStyleDefault | 317 style:UIAlertActionStyleDefault |
318 handler:handler]]; | 318 handler:handler]]; |
319 | 319 |
320 [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" | 320 [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" |
321 style:UIAlertActionStyleCancel | 321 style:UIAlertActionStyleCancel |
322 handler:nil]]; | 322 handler:nil]]; |
323 | 323 |
324 [self presentViewController:alert animated:YES completion:nil]; | 324 [self presentViewController:alert animated:YES completion:nil]; |
325 | 325 |
326 return YES; | 326 return YES; |
327 } | 327 } |
328 | 328 |
329 @end | 329 @end |
OLD | NEW |