| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/libgtk2ui/unity_service.h" | 5 #include "chrome/browser/ui/libgtk2ui/unity_service.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <gtk/gtk.h> |
| 9 |
| 10 #include <memory> |
| 8 #include <string> | 11 #include <string> |
| 9 | 12 |
| 10 #include <gtk/gtk.h> | |
| 11 | |
| 12 #include "base/environment.h" | 13 #include "base/environment.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/nix/xdg_util.h" | 14 #include "base/nix/xdg_util.h" |
| 15 #include "chrome/browser/shell_integration_linux.h" | 15 #include "chrome/browser/shell_integration_linux.h" |
| 16 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" | 16 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" |
| 17 | 17 |
| 18 // Unity data typedefs. | 18 // Unity data typedefs. |
| 19 typedef struct _UnityInspector UnityInspector; | 19 typedef struct _UnityInspector UnityInspector; |
| 20 typedef UnityInspector* (*unity_inspector_get_default_func)(void); | 20 typedef UnityInspector* (*unity_inspector_get_default_func)(void); |
| 21 typedef gboolean (*unity_inspector_get_unity_running_func) | 21 typedef gboolean (*unity_inspector_get_unity_running_func) |
| 22 (UnityInspector* self); | 22 (UnityInspector* self); |
| 23 | 23 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 52 unity_launcher_entry_set_progress_visible_func entry_set_progress_visible = | 52 unity_launcher_entry_set_progress_visible_func entry_set_progress_visible = |
| 53 NULL; | 53 NULL; |
| 54 | 54 |
| 55 void EnsureMethodsLoaded() { | 55 void EnsureMethodsLoaded() { |
| 56 using base::nix::GetDesktopEnvironment; | 56 using base::nix::GetDesktopEnvironment; |
| 57 | 57 |
| 58 if (attempted_load) | 58 if (attempted_load) |
| 59 return; | 59 return; |
| 60 attempted_load = true; | 60 attempted_load = true; |
| 61 | 61 |
| 62 scoped_ptr<base::Environment> env(base::Environment::Create()); | 62 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
| 63 base::nix::DesktopEnvironment desktop_env = | 63 base::nix::DesktopEnvironment desktop_env = |
| 64 GetDesktopEnvironment(env.get()); | 64 GetDesktopEnvironment(env.get()); |
| 65 | 65 |
| 66 // The "icon-tasks" KDE task manager also honors Unity Launcher API. | 66 // The "icon-tasks" KDE task manager also honors Unity Launcher API. |
| 67 if (desktop_env != base::nix::DESKTOP_ENVIRONMENT_UNITY && | 67 if (desktop_env != base::nix::DESKTOP_ENVIRONMENT_UNITY && |
| 68 desktop_env != base::nix::DESKTOP_ENVIRONMENT_KDE4 && | 68 desktop_env != base::nix::DESKTOP_ENVIRONMENT_KDE4 && |
| 69 desktop_env != base::nix::DESKTOP_ENVIRONMENT_KDE5) | 69 desktop_env != base::nix::DESKTOP_ENVIRONMENT_KDE5) |
| 70 return; | 70 return; |
| 71 | 71 |
| 72 // Ubuntu still hasn't given us a nice libunity.so symlink. | 72 // Ubuntu still hasn't given us a nice libunity.so symlink. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 void SetProgressFraction(float percentage) { | 138 void SetProgressFraction(float percentage) { |
| 139 EnsureMethodsLoaded(); | 139 EnsureMethodsLoaded(); |
| 140 if (chrome_entry && entry_set_progress && entry_set_progress_visible) { | 140 if (chrome_entry && entry_set_progress && entry_set_progress_visible) { |
| 141 entry_set_progress(chrome_entry, percentage); | 141 entry_set_progress(chrome_entry, percentage); |
| 142 entry_set_progress_visible(chrome_entry, | 142 entry_set_progress_visible(chrome_entry, |
| 143 percentage > 0.0 && percentage < 1.0); | 143 percentage > 0.0 && percentage < 1.0); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace unity | 147 } // namespace unity |
| OLD | NEW |