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/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> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/environment.h" | 13 #include "base/environment.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/ui/libgtkui/gtk2_util.h" |
16 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" | |
17 | 16 |
18 // Unity data typedefs. | 17 // Unity data typedefs. |
19 typedef struct _UnityInspector UnityInspector; | 18 typedef struct _UnityInspector UnityInspector; |
20 typedef UnityInspector* (*unity_inspector_get_default_func)(void); | 19 typedef UnityInspector* (*unity_inspector_get_default_func)(void); |
21 typedef gboolean (*unity_inspector_get_unity_running_func) | 20 typedef gboolean (*unity_inspector_get_unity_running_func) |
22 (UnityInspector* self); | 21 (UnityInspector* self); |
23 | 22 |
24 typedef struct _UnityLauncherEntry UnityLauncherEntry; | 23 typedef struct _UnityLauncherEntry UnityLauncherEntry; |
25 typedef UnityLauncherEntry* (*unity_launcher_entry_get_for_desktop_id_func) | 24 typedef UnityLauncherEntry* (*unity_launcher_entry_get_for_desktop_id_func) |
26 (const gchar* desktop_id); | 25 (const gchar* desktop_id); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 85 |
87 get_unity_running = | 86 get_unity_running = |
88 reinterpret_cast<unity_inspector_get_unity_running_func>( | 87 reinterpret_cast<unity_inspector_get_unity_running_func>( |
89 dlsym(unity_lib, "unity_inspector_get_unity_running")); | 88 dlsym(unity_lib, "unity_inspector_get_unity_running")); |
90 } | 89 } |
91 | 90 |
92 unity_launcher_entry_get_for_desktop_id_func entry_get_for_desktop_id = | 91 unity_launcher_entry_get_for_desktop_id_func entry_get_for_desktop_id = |
93 reinterpret_cast<unity_launcher_entry_get_for_desktop_id_func>( | 92 reinterpret_cast<unity_launcher_entry_get_for_desktop_id_func>( |
94 dlsym(unity_lib, "unity_launcher_entry_get_for_desktop_id")); | 93 dlsym(unity_lib, "unity_launcher_entry_get_for_desktop_id")); |
95 if (entry_get_for_desktop_id) { | 94 if (entry_get_for_desktop_id) { |
96 std::string desktop_id = libgtk2ui::GetDesktopName(env.get()); | 95 std::string desktop_id = libgtkui::GetDesktopName(env.get()); |
97 chrome_entry = entry_get_for_desktop_id(desktop_id.c_str()); | 96 chrome_entry = entry_get_for_desktop_id(desktop_id.c_str()); |
98 | 97 |
99 entry_set_count = | 98 entry_set_count = |
100 reinterpret_cast<unity_launcher_entry_set_count_func>( | 99 reinterpret_cast<unity_launcher_entry_set_count_func>( |
101 dlsym(unity_lib, "unity_launcher_entry_set_count")); | 100 dlsym(unity_lib, "unity_launcher_entry_set_count")); |
102 | 101 |
103 entry_set_count_visible = | 102 entry_set_count_visible = |
104 reinterpret_cast<unity_launcher_entry_set_count_visible_func>( | 103 reinterpret_cast<unity_launcher_entry_set_count_visible_func>( |
105 dlsym(unity_lib, "unity_launcher_entry_set_count_visible")); | 104 dlsym(unity_lib, "unity_launcher_entry_set_count_visible")); |
106 | 105 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 void SetProgressFraction(float percentage) { | 137 void SetProgressFraction(float percentage) { |
139 EnsureMethodsLoaded(); | 138 EnsureMethodsLoaded(); |
140 if (chrome_entry && entry_set_progress && entry_set_progress_visible) { | 139 if (chrome_entry && entry_set_progress && entry_set_progress_visible) { |
141 entry_set_progress(chrome_entry, percentage); | 140 entry_set_progress(chrome_entry, percentage); |
142 entry_set_progress_visible(chrome_entry, | 141 entry_set_progress_visible(chrome_entry, |
143 percentage > 0.0 && percentage < 1.0); | 142 percentage > 0.0 && percentage < 1.0); |
144 } | 143 } |
145 } | 144 } |
146 | 145 |
147 } // namespace unity | 146 } // namespace unity |
OLD | NEW |