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 "content/utility/utility_thread_impl.h" | 5 #include "content/utility/utility_thread_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 #if defined(OS_POSIX) | 131 #if defined(OS_POSIX) |
132 void UtilityThreadImpl::OnLoadPlugins( | 132 void UtilityThreadImpl::OnLoadPlugins( |
133 const std::vector<FilePath>& plugin_paths) { | 133 const std::vector<FilePath>& plugin_paths) { |
134 webkit::npapi::PluginList* plugin_list = | 134 webkit::npapi::PluginList* plugin_list = |
135 webkit::npapi::PluginList::Singleton(); | 135 webkit::npapi::PluginList::Singleton(); |
136 | 136 |
137 // On Linux, some plugins expect the browser to have loaded glib/gtk. Do that | 137 // On Linux, some plugins expect the browser to have loaded glib/gtk. Do that |
138 // before attempting to call into the plugin. | 138 // before attempting to call into the plugin. |
139 #if defined(TOOLKIT_USES_GTK) | 139 #if defined(TOOLKIT_USES_GTK) |
| 140 // g_thread_init is deprecated since gtk version 2.32 |
| 141 #if (GTK_VERSION_MAJOR == 2 && GTK_VERSION_MINOR < 32) |
140 if (!g_thread_get_initialized()) { | 142 if (!g_thread_get_initialized()) { |
141 g_thread_init(NULL); | 143 g_thread_init(NULL); |
142 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); | 144 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); |
143 } | 145 } |
| 146 #else |
| 147 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); |
| 148 #endif |
144 #endif | 149 #endif |
145 | 150 |
146 for (size_t i = 0; i < plugin_paths.size(); ++i) { | 151 for (size_t i = 0; i < plugin_paths.size(); ++i) { |
147 ScopedVector<webkit::npapi::PluginGroup> plugin_groups; | 152 ScopedVector<webkit::npapi::PluginGroup> plugin_groups; |
148 plugin_list->LoadPlugin(plugin_paths[i], &plugin_groups); | 153 plugin_list->LoadPlugin(plugin_paths[i], &plugin_groups); |
149 | 154 |
150 if (plugin_groups.empty()) { | 155 if (plugin_groups.empty()) { |
151 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); | 156 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); |
152 continue; | 157 continue; |
153 } | 158 } |
154 | 159 |
155 const webkit::npapi::PluginGroup* group = plugin_groups[0]; | 160 const webkit::npapi::PluginGroup* group = plugin_groups[0]; |
156 DCHECK_EQ(group->web_plugin_infos().size(), 1u); | 161 DCHECK_EQ(group->web_plugin_infos().size(), 1u); |
157 | 162 |
158 Send(new UtilityHostMsg_LoadedPlugin(i, group->web_plugin_infos().front())); | 163 Send(new UtilityHostMsg_LoadedPlugin(i, group->web_plugin_infos().front())); |
159 } | 164 } |
160 | 165 |
161 ReleaseProcessIfNeeded(); | 166 ReleaseProcessIfNeeded(); |
162 } | 167 } |
163 #endif | 168 #endif |
OLD | NEW |