| 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/ui/gtk/unity_service.h" | 5 #include "chrome/browser/ui/gtk/unity_service.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/browser/shell_integration.h" | 12 #include "chrome/browser/shell_integration_linux.h" |
| 13 | 13 |
| 14 // Unity data typedefs. | 14 // Unity data typedefs. |
| 15 typedef struct _UnityInspector UnityInspector; | 15 typedef struct _UnityInspector UnityInspector; |
| 16 typedef UnityInspector* (*unity_inspector_get_default_func)(void); | 16 typedef UnityInspector* (*unity_inspector_get_default_func)(void); |
| 17 typedef gboolean (*unity_inspector_get_unity_running_func) | 17 typedef gboolean (*unity_inspector_get_unity_running_func) |
| 18 (UnityInspector* self); | 18 (UnityInspector* self); |
| 19 | 19 |
| 20 typedef struct _UnityLauncherEntry UnityLauncherEntry; | 20 typedef struct _UnityLauncherEntry UnityLauncherEntry; |
| 21 typedef UnityLauncherEntry* (*unity_launcher_entry_get_for_desktop_id_func) | 21 typedef UnityLauncherEntry* (*unity_launcher_entry_get_for_desktop_id_func) |
| 22 (const gchar* desktop_id); | 22 (const gchar* desktop_id); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 get_unity_running = | 70 get_unity_running = |
| 71 reinterpret_cast<unity_inspector_get_unity_running_func>( | 71 reinterpret_cast<unity_inspector_get_unity_running_func>( |
| 72 dlsym(unity_lib, "unity_inspector_get_unity_running")); | 72 dlsym(unity_lib, "unity_inspector_get_unity_running")); |
| 73 } | 73 } |
| 74 | 74 |
| 75 unity_launcher_entry_get_for_desktop_id_func entry_get_for_desktop_id = | 75 unity_launcher_entry_get_for_desktop_id_func entry_get_for_desktop_id = |
| 76 reinterpret_cast<unity_launcher_entry_get_for_desktop_id_func>( | 76 reinterpret_cast<unity_launcher_entry_get_for_desktop_id_func>( |
| 77 dlsym(unity_lib, "unity_launcher_entry_get_for_desktop_id")); | 77 dlsym(unity_lib, "unity_launcher_entry_get_for_desktop_id")); |
| 78 if (entry_get_for_desktop_id) { | 78 if (entry_get_for_desktop_id) { |
| 79 scoped_ptr<base::Environment> env(base::Environment::Create()); | 79 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 80 std::string desktop_id = ShellIntegration::GetDesktopName(env.get()); | 80 std::string desktop_id = ShellIntegrationLinux::GetDesktopName(env.get()); |
| 81 chrome_entry = entry_get_for_desktop_id(desktop_id.c_str()); | 81 chrome_entry = entry_get_for_desktop_id(desktop_id.c_str()); |
| 82 | 82 |
| 83 entry_set_count = | 83 entry_set_count = |
| 84 reinterpret_cast<unity_launcher_entry_set_count_func>( | 84 reinterpret_cast<unity_launcher_entry_set_count_func>( |
| 85 dlsym(unity_lib, "unity_launcher_entry_set_count")); | 85 dlsym(unity_lib, "unity_launcher_entry_set_count")); |
| 86 | 86 |
| 87 entry_set_count_visible = | 87 entry_set_count_visible = |
| 88 reinterpret_cast<unity_launcher_entry_set_count_visible_func>( | 88 reinterpret_cast<unity_launcher_entry_set_count_visible_func>( |
| 89 dlsym(unity_lib, "unity_launcher_entry_set_count_visible")); | 89 dlsym(unity_lib, "unity_launcher_entry_set_count_visible")); |
| 90 | 90 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 void SetProgressFraction(float percentage) { | 122 void SetProgressFraction(float percentage) { |
| 123 EnsureMethodsLoaded(); | 123 EnsureMethodsLoaded(); |
| 124 if (chrome_entry && entry_set_progress && entry_set_progress_visible) { | 124 if (chrome_entry && entry_set_progress && entry_set_progress_visible) { |
| 125 entry_set_progress(chrome_entry, percentage); | 125 entry_set_progress(chrome_entry, percentage); |
| 126 entry_set_progress_visible(chrome_entry, | 126 entry_set_progress_visible(chrome_entry, |
| 127 percentage > 0.0 && percentage < 1.0); | 127 percentage > 0.0 && percentage < 1.0); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace unity | 131 } // namespace unity |
| OLD | NEW |