| 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/libgtkui/unity_service.h" | 5 #include "chrome/browser/ui/libgtkui/unity_service.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 gdouble value); | 31 gdouble value); |
| 32 typedef void (*unity_launcher_entry_set_progress_visible_func) | 32 typedef void (*unity_launcher_entry_set_progress_visible_func) |
| 33 (UnityLauncherEntry* self, gboolean value); | 33 (UnityLauncherEntry* self, gboolean value); |
| 34 | 34 |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 bool attempted_load = false; | 38 bool attempted_load = false; |
| 39 | 39 |
| 40 // Unity has a singleton object that we can ask whether the unity is running. | 40 // Unity has a singleton object that we can ask whether the unity is running. |
| 41 UnityInspector* inspector = NULL; | 41 UnityInspector* inspector = nullptr; |
| 42 | 42 |
| 43 // A link to the desktop entry in the panel. | 43 // A link to the desktop entry in the panel. |
| 44 UnityLauncherEntry* chrome_entry = NULL; | 44 UnityLauncherEntry* chrome_entry = nullptr; |
| 45 | 45 |
| 46 // Retrieved functions from libunity. | 46 // Retrieved functions from libunity. |
| 47 unity_inspector_get_unity_running_func get_unity_running = NULL; | 47 unity_inspector_get_unity_running_func get_unity_running = nullptr; |
| 48 unity_launcher_entry_set_count_func entry_set_count = NULL; | 48 unity_launcher_entry_set_count_func entry_set_count = nullptr; |
| 49 unity_launcher_entry_set_count_visible_func entry_set_count_visible = NULL; | 49 unity_launcher_entry_set_count_visible_func entry_set_count_visible = nullptr; |
| 50 unity_launcher_entry_set_progress_func entry_set_progress = NULL; | 50 unity_launcher_entry_set_progress_func entry_set_progress = nullptr; |
| 51 unity_launcher_entry_set_progress_visible_func entry_set_progress_visible = | 51 unity_launcher_entry_set_progress_visible_func entry_set_progress_visible = |
| 52 NULL; | 52 nullptr; |
| 53 | 53 |
| 54 void EnsureMethodsLoaded() { | 54 void EnsureMethodsLoaded() { |
| 55 using base::nix::GetDesktopEnvironment; | 55 using base::nix::GetDesktopEnvironment; |
| 56 | 56 |
| 57 if (attempted_load) | 57 if (attempted_load) |
| 58 return; | 58 return; |
| 59 attempted_load = true; | 59 attempted_load = true; |
| 60 | 60 |
| 61 std::unique_ptr<base::Environment> env(base::Environment::Create()); | 61 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
| 62 base::nix::DesktopEnvironment desktop_env = | 62 base::nix::DesktopEnvironment desktop_env = |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 void SetProgressFraction(float percentage) { | 137 void SetProgressFraction(float percentage) { |
| 138 EnsureMethodsLoaded(); | 138 EnsureMethodsLoaded(); |
| 139 if (chrome_entry && entry_set_progress && entry_set_progress_visible) { | 139 if (chrome_entry && entry_set_progress && entry_set_progress_visible) { |
| 140 entry_set_progress(chrome_entry, percentage); | 140 entry_set_progress(chrome_entry, percentage); |
| 141 entry_set_progress_visible(chrome_entry, | 141 entry_set_progress_visible(chrome_entry, |
| 142 percentage > 0.0 && percentage < 1.0); | 142 percentage > 0.0 && percentage < 1.0); |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace unity | 146 } // namespace unity |
| OLD | NEW |