| 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/chrome/browser/ui/activity_services/activity_service_controller.h" | 5 #import "ios/chrome/browser/ui/activity_services/activity_service_controller.h" |
| 6 | 6 |
| 7 #import <MobileCoreServices/MobileCoreServices.h> | 7 #import <MobileCoreServices/MobileCoreServices.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 - (NSArray*)activityItemsForData:(ShareToData*)data { | 190 - (NSArray*)activityItemsForData:(ShareToData*)data { |
| 191 NSMutableArray* activityItems = [NSMutableArray array]; | 191 NSMutableArray* activityItems = [NSMutableArray array]; |
| 192 // ShareToData object guarantees that there is a NSURL. | 192 // ShareToData object guarantees that there is a NSURL. |
| 193 DCHECK(data.nsurl); | 193 DCHECK(data.nsurl); |
| 194 | 194 |
| 195 // In order to support find-login-action protocol, the provider object | 195 // In order to support find-login-action protocol, the provider object |
| 196 // UIActivityFindLoginActionSource supports both Password Management | 196 // UIActivityFindLoginActionSource supports both Password Management |
| 197 // App Extensions (e.g. 1Password) and also provide a public.url UTType | 197 // App Extensions (e.g. 1Password) and also provide a public.url UTType |
| 198 // for Share Extensions (e.g. Facebook, Twitter). | 198 // for Share Extensions (e.g. Facebook, Twitter). |
| 199 UIActivityFindLoginActionSource* loginActionProvider = | 199 UIActivityFindLoginActionSource* loginActionProvider = |
| 200 [[UIActivityFindLoginActionSource alloc] initWithURL:data.nsurl | 200 [[UIActivityFindLoginActionSource alloc] |
| 201 subject:data.title]; | 201 initWithURL:data.nsurl |
| 202 subject:data.title |
| 203 thumbnailGenerator:data.thumbnailGenerator]; |
| 202 [activityItems addObject:loginActionProvider]; | 204 [activityItems addObject:loginActionProvider]; |
| 203 | 205 |
| 204 UIActivityTextSource* textProvider = | 206 UIActivityTextSource* textProvider = |
| 205 [[UIActivityTextSource alloc] initWithText:data.title]; | 207 [[UIActivityTextSource alloc] initWithText:data.title]; |
| 206 [activityItems addObject:textProvider]; | 208 [activityItems addObject:textProvider]; |
| 207 | 209 |
| 208 if (data.image) { | 210 if (data.image) { |
| 209 UIActivityImageSource* imageProvider = | 211 UIActivityImageSource* imageProvider = |
| 210 [[UIActivityImageSource alloc] initWithImage:data.image]; | 212 [[UIActivityImageSource alloc] initWithImage:data.image]; |
| 211 [activityItems addObject:imageProvider]; | 213 [activityItems addObject:imageProvider]; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 return NO; | 296 return NO; |
| 295 } | 297 } |
| 296 | 298 |
| 297 #pragma mark - For Testing | 299 #pragma mark - For Testing |
| 298 | 300 |
| 299 - (void)setShareToDelegateForTesting:(id<ShareToDelegate>)delegate { | 301 - (void)setShareToDelegateForTesting:(id<ShareToDelegate>)delegate { |
| 300 shareToDelegate_ = delegate; | 302 shareToDelegate_ = delegate; |
| 301 } | 303 } |
| 302 | 304 |
| 303 @end | 305 @end |
| OLD | NEW |