1 // Copyright (c) 2014 Intel Corporation. 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.
5 #include "xwalk/runtime/browser/runtime_platform_util.h"
7 #include "base/file_util.h"
8 #include "base/logging.h"
9 #include "base/process/kill.h"
10 #include "base/process/launch.h"
13 namespace platform_util {
15 // The system default web browser path.
16 // In some Tizen releases, there exists a system browser called 'MiniBrowser',
17 // which we can use to open an external link from a web app.
18 const char kWebBrowserPath[] = "/usr/bin/MiniBrowser";
21 void OpenExternal(const GURL& url) {
22 if (url.SchemeIsHTTPOrHTTPS()) {
23 LOG(INFO) << "Open in WebBrowser.";
24 std::vector<std::string> argv;
25 if (base::PathExists(base::FilePath(kWebBrowserPath)))
26 argv.push_back(kWebBrowserPath);
28 argv.push_back("xwalk-launcher");
29 argv.push_back(url.spec());
30 base::ProcessHandle handle;
32 if (base::LaunchProcess(argv, base::LaunchOptions(), &handle))
33 base::EnsureProcessGetsReaped(handle);
37 } // namespace platform_util