Merge pull request #3913 from atom/fix-nsurl
Fix converting string to NSURL
This commit is contained in:
commit
e41dad5153
1 changed files with 2 additions and 3 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include "base/mac/mac_logging.h"
|
#include "base/mac/mac_logging.h"
|
||||||
#include "base/mac/scoped_aedesc.h"
|
#include "base/mac/scoped_aedesc.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
|
#include "net/base/mac/url_conversions.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
namespace platform_util {
|
namespace platform_util {
|
||||||
|
@ -120,9 +121,7 @@ void OpenItem(const base::FilePath& full_path) {
|
||||||
|
|
||||||
bool OpenExternal(const GURL& url) {
|
bool OpenExternal(const GURL& url) {
|
||||||
DCHECK([NSThread isMainThread]);
|
DCHECK([NSThread isMainThread]);
|
||||||
NSString* url_string = base::SysUTF8ToNSString(url.spec());
|
NSURL* ns_url = net::NSURLWithGURL(url);
|
||||||
NSString* url_escaped_string = [url_string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
||||||
NSURL* ns_url = [NSURL URLWithString:url_escaped_string];
|
|
||||||
if (!ns_url) {
|
if (!ns_url) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue