OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #import "open_url_util.h" | |
Eugene But (OOO till 7-30)
2016/09/14 20:20:07
Please use full path for the imports
sczs
2016/09/15 20:35:47
Done.
| |
6 | |
7 #import <UIKit/UIKit.h> | |
8 | |
9 #include "base/ios/ios_util.h" | |
10 | |
11 void OpenURLWithCompletionHandler(NSURL* url, | |
12 void (^completion_handler)(BOOL success)) { | |
13 if (base::ios::IsRunningOnIOS10OrLater()) { | |
14 [[UIApplication sharedApplication] openURL:url | |
15 options:@{} | |
16 completionHandler:completion_handler]; | |
17 return; | |
18 } else { | |
Eugene But (OOO till 7-30)
2016/09/14 20:20:07
NIT: You don't need else here, since you have an e
sczs
2016/09/15 20:35:47
Done.
| |
19 BOOL result = [[UIApplication sharedApplication] openURL:url]; | |
20 if (!completion_handler) | |
21 return; | |
22 dispatch_async(dispatch_get_main_queue(), ^{ | |
23 completion_handler(result); | |
24 }); | |
25 } | |
26 } | |
OLD | NEW |