| 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 unity_launcher_entry_set_count_visible_func entry_set_count_visible = NULL; | 46 unity_launcher_entry_set_count_visible_func entry_set_count_visible = NULL; |
| 47 unity_launcher_entry_set_progress_func entry_set_progress = NULL; | 47 unity_launcher_entry_set_progress_func entry_set_progress = NULL; |
| 48 unity_launcher_entry_set_progress_visible_func entry_set_progress_visible = | 48 unity_launcher_entry_set_progress_visible_func entry_set_progress_visible = |
| 49 NULL; | 49 NULL; |
| 50 | 50 |
| 51 void EnsureMethodsLoaded() { | 51 void EnsureMethodsLoaded() { |
| 52 if (attempted_load) | 52 if (attempted_load) |
| 53 return; | 53 return; |
| 54 attempted_load = true; | 54 attempted_load = true; |
| 55 | 55 |
| 56 // TODO(erg): When unity stabilizes its interface, switch all this to looking |
| 57 // up just ".so" instead of specific versions. |
| 56 void* unity_lib = dlopen("libunity.so.4", RTLD_LAZY); | 58 void* unity_lib = dlopen("libunity.so.4", RTLD_LAZY); |
| 57 if (!unity_lib) | 59 if (!unity_lib) |
| 60 unity_lib = dlopen("libunity.so.6", RTLD_LAZY); |
| 61 if (!unity_lib) |
| 58 return; | 62 return; |
| 59 | 63 |
| 60 unity_inspector_get_default_func inspector_get_default = | 64 unity_inspector_get_default_func inspector_get_default = |
| 61 reinterpret_cast<unity_inspector_get_default_func>( | 65 reinterpret_cast<unity_inspector_get_default_func>( |
| 62 dlsym(unity_lib, "unity_inspector_get_default")); | 66 dlsym(unity_lib, "unity_inspector_get_default")); |
| 63 if (inspector_get_default) { | 67 if (inspector_get_default) { |
| 64 inspector = inspector_get_default(); | 68 inspector = inspector_get_default(); |
| 65 | 69 |
| 66 get_unity_running = | 70 get_unity_running = |
| 67 reinterpret_cast<unity_inspector_get_unity_running_func>( | 71 reinterpret_cast<unity_inspector_get_unity_running_func>( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 void SetProgressFraction(float percentage) { | 122 void SetProgressFraction(float percentage) { |
| 119 EnsureMethodsLoaded(); | 123 EnsureMethodsLoaded(); |
| 120 if (chrome_entry && entry_set_progress && entry_set_progress_visible) { | 124 if (chrome_entry && entry_set_progress && entry_set_progress_visible) { |
| 121 entry_set_progress(chrome_entry, percentage); | 125 entry_set_progress(chrome_entry, percentage); |
| 122 entry_set_progress_visible(chrome_entry, | 126 entry_set_progress_visible(chrome_entry, |
| 123 percentage > 0.0 && percentage < 1.0); | 127 percentage > 0.0 && percentage < 1.0); |
| 124 } | 128 } |
| 125 } | 129 } |
| 126 | 130 |
| 127 } // namespace unity | 131 } // namespace unity |
| OLD | NEW |