OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/platform_util.h" | 5 #include "chrome/browser/platform_util.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "content/common/process_watcher.h" | |
14 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
15 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
16 | 15 |
17 using content::BrowserThread; | 16 using content::BrowserThread; |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 void XDGUtil(const std::string& util, const std::string& arg) { | 20 void XDGUtil(const std::string& util, const std::string& arg) { |
22 std::vector<std::string> argv; | 21 std::vector<std::string> argv; |
23 argv.push_back(util); | 22 argv.push_back(util); |
(...skipping 12 matching lines...) Expand all Loading... |
36 char* disable_gnome_bug_buddy = getenv("GNOME_DISABLE_CRASH_DIALOG"); | 35 char* disable_gnome_bug_buddy = getenv("GNOME_DISABLE_CRASH_DIALOG"); |
37 if (disable_gnome_bug_buddy && | 36 if (disable_gnome_bug_buddy && |
38 disable_gnome_bug_buddy == std::string("SET_BY_GOOGLE_CHROME")) { | 37 disable_gnome_bug_buddy == std::string("SET_BY_GOOGLE_CHROME")) { |
39 env.push_back(std::make_pair("GNOME_DISABLE_CRASH_DIALOG", "")); | 38 env.push_back(std::make_pair("GNOME_DISABLE_CRASH_DIALOG", "")); |
40 } | 39 } |
41 | 40 |
42 base::ProcessHandle handle; | 41 base::ProcessHandle handle; |
43 base::LaunchOptions options; | 42 base::LaunchOptions options; |
44 options.environ = &env; | 43 options.environ = &env; |
45 if (base::LaunchProcess(argv, options, &handle)) | 44 if (base::LaunchProcess(argv, options, &handle)) |
46 ProcessWatcher::EnsureProcessGetsReaped(handle); | 45 base::EnsureProcessGetsReaped(handle); |
47 } | 46 } |
48 | 47 |
49 void XDGOpen(const std::string& path) { | 48 void XDGOpen(const std::string& path) { |
50 XDGUtil("xdg-open", path); | 49 XDGUtil("xdg-open", path); |
51 } | 50 } |
52 | 51 |
53 void XDGEmail(const std::string& email) { | 52 void XDGEmail(const std::string& email) { |
54 XDGUtil("xdg-email", email); | 53 XDGUtil("xdg-email", email); |
55 } | 54 } |
56 | 55 |
(...skipping 25 matching lines...) Expand all Loading... |
82 } | 81 } |
83 | 82 |
84 void OpenExternal(const GURL& url) { | 83 void OpenExternal(const GURL& url) { |
85 if (url.SchemeIs("mailto")) | 84 if (url.SchemeIs("mailto")) |
86 XDGEmail(url.spec()); | 85 XDGEmail(url.spec()); |
87 else | 86 else |
88 XDGOpen(url.spec()); | 87 XDGOpen(url.spec()); |
89 } | 88 } |
90 | 89 |
91 } // namespace platform_util | 90 } // namespace platform_util |
OLD | NEW |