| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/common/platform_util.h" | 5 #include "chrome/common/platform_util.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "chrome/common/process_watcher.h" | 12 #include "chrome/common/process_watcher.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 void XDGOpen(const FilePath& path) { | 16 void XDGOpen(const FilePath& path) { |
| 17 std::vector<std::string> argv; | 17 std::vector<std::string> argv; |
| 18 argv.push_back("xdg-open"); | 18 argv.push_back("xdg-open"); |
| 19 argv.push_back(path.value()); | 19 argv.push_back(path.value()); |
| 20 base::file_handle_mapping_vector no_files; | 20 base::file_handle_mapping_vector no_files; |
| 21 base::environment_vector env; |
| 22 env.push_back(std::make_pair("GTK_PATH", getenv("CHROMIUM_SAVED_GTK_PATH"))); |
| 21 base::ProcessHandle handle; | 23 base::ProcessHandle handle; |
| 22 if (base::LaunchApp(argv, no_files, false, &handle)) | 24 if (base::LaunchApp(argv, env, no_files, false, &handle)) |
| 23 ProcessWatcher::EnsureProcessGetsReaped(handle); | 25 ProcessWatcher::EnsureProcessGetsReaped(handle); |
| 24 } | 26 } |
| 25 | 27 |
| 26 } // namespace | 28 } // namespace |
| 27 | 29 |
| 28 namespace platform_util { | 30 namespace platform_util { |
| 29 | 31 |
| 30 // TODO(estade): It would be nice to be able to select the file in the file | 32 // TODO(estade): It would be nice to be able to select the file in the file |
| 31 // manager, but that probably requires extending xdg-open. For now just | 33 // manager, but that probably requires extending xdg-open. For now just |
| 32 // show the folder. | 34 // show the folder. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 56 | 58 |
| 57 bool IsWindowActive(gfx::NativeWindow window) { | 59 bool IsWindowActive(gfx::NativeWindow window) { |
| 58 return gtk_window_is_active(window); | 60 return gtk_window_is_active(window); |
| 59 } | 61 } |
| 60 | 62 |
| 61 bool IsVisible(gfx::NativeView view) { | 63 bool IsVisible(gfx::NativeView view) { |
| 62 return GTK_WIDGET_VISIBLE(view); | 64 return GTK_WIDGET_VISIBLE(view); |
| 63 } | 65 } |
| 64 | 66 |
| 65 } // namespace platform_util | 67 } // namespace platform_util |
| OLD | NEW |