Index: ios/chrome/browser/open_url_util.mm |
diff --git a/ios/chrome/browser/open_url_util.mm b/ios/chrome/browser/open_url_util.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..751a6b2cd69103a61b01f961ed5f4daf28676a0e |
--- /dev/null |
+++ b/ios/chrome/browser/open_url_util.mm |
@@ -0,0 +1,26 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#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.
|
+ |
+#import <UIKit/UIKit.h> |
+ |
+#include "base/ios/ios_util.h" |
+ |
+void OpenURLWithCompletionHandler(NSURL* url, |
+ void (^completion_handler)(BOOL success)) { |
+ if (base::ios::IsRunningOnIOS10OrLater()) { |
+ [[UIApplication sharedApplication] openURL:url |
+ options:@{} |
+ completionHandler:completion_handler]; |
+ return; |
+ } 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.
|
+ BOOL result = [[UIApplication sharedApplication] openURL:url]; |
+ if (!completion_handler) |
+ return; |
+ dispatch_async(dispatch_get_main_queue(), ^{ |
+ completion_handler(result); |
+ }); |
+ } |
+} |