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

Side by Side Diff: ios/chrome/browser/share_extension/share_extension_item_receiver.mm

Issue 2608913002: Handle invalid URLs in share extension. (Closed)
Patch Set: adding gambard as OWNER 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/share_extension/share_extension_item_receiver.h" 5 #import "ios/chrome/browser/share_extension/share_extension_item_receiver.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include "base/ios/block_types.h" 9 #include "base/ios/block_types.h"
10 #include "base/mac/bind_objc_block.h" 10 #include "base/mac/bind_objc_block.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 GURL entryURL = 183 GURL entryURL =
184 net::GURLWithNSURL([entry objectForKey:app_group::kShareItemURL]); 184 net::GURLWithNSURL([entry objectForKey:app_group::kShareItemURL]);
185 std::string entryTitle = 185 std::string entryTitle =
186 base::SysNSStringToUTF8([entry objectForKey:app_group::kShareItemTitle]); 186 base::SysNSStringToUTF8([entry objectForKey:app_group::kShareItemTitle]);
187 NSDate* entryDate = base::mac::ObjCCast<NSDate>( 187 NSDate* entryDate = base::mac::ObjCCast<NSDate>(
188 [entry objectForKey:app_group::kShareItemDate]); 188 [entry objectForKey:app_group::kShareItemDate]);
189 NSNumber* entryType = base::mac::ObjCCast<NSNumber>( 189 NSNumber* entryType = base::mac::ObjCCast<NSNumber>(
190 [entry objectForKey:app_group::kShareItemType]); 190 [entry objectForKey:app_group::kShareItemType]);
191 191
192 if (!entryURL.is_valid() || !entryDate || !entryType) { 192 if (!entryURL.is_valid() || !entryDate || !entryType ||
193 !entryURL.SchemeIsHTTPOrHTTPS()) {
193 if (completion) { 194 if (completion) {
194 completion(); 195 completion();
195 } 196 }
196 return NO; 197 return NO;
197 } 198 }
198 199
199 UMA_HISTOGRAM_TIMES("IOS.ShareExtension.ReceivedEntryDelay", 200 UMA_HISTOGRAM_TIMES("IOS.ShareExtension.ReceivedEntryDelay",
200 base::TimeDelta::FromSecondsD( 201 base::TimeDelta::FromSecondsD(
201 [[NSDate date] timeIntervalSinceDate:entryDate])); 202 [[NSDate date] timeIntervalSinceDate:entryDate]));
202 203
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 343
343 - (NSOperationQueue*)presentedItemOperationQueue { 344 - (NSOperationQueue*)presentedItemOperationQueue {
344 return [NSOperationQueue mainQueue]; 345 return [NSOperationQueue mainQueue];
345 } 346 }
346 347
347 - (NSURL*)presentedItemURL { 348 - (NSURL*)presentedItemURL {
348 return app_group::ShareExtensionItemsFolder(); 349 return app_group::ShareExtensionItemsFolder();
349 } 350 }
350 351
351 @end 352 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/share_extension/OWNERS ('k') | ios/chrome/share_extension/share_extension_localize_strings_config.plist » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698