OLD | NEW |
1 // Copyright (c) 2012 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" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (!g_thread_get_initialized()) { | 140 if (!g_thread_get_initialized()) { |
141 g_thread_init(NULL); | 141 g_thread_init(NULL); |
142 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); | 142 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); |
143 } | 143 } |
144 #endif | 144 #endif |
145 | 145 |
146 ScopedVector<webkit::npapi::PluginGroup> plugin_groups; | |
147 // TODO(bauerb): If we restart loading plug-ins, we might mess up the logic in | |
148 // PluginList::ShouldLoadPlugin due to missing the previously loaded plug-ins | |
149 // in |plugin_groups|. | |
150 for (size_t i = 0; i < plugin_paths.size(); ++i) { | 146 for (size_t i = 0; i < plugin_paths.size(); ++i) { |
151 webkit::WebPluginInfo plugin; | 147 ScopedVector<webkit::npapi::PluginGroup> plugin_groups; |
152 if (!plugin_list->LoadPlugin(plugin_paths[i], &plugin_groups, &plugin)) | 148 plugin_list->LoadPlugin(plugin_paths[i], &plugin_groups); |
| 149 |
| 150 if (plugin_groups.empty()) { |
153 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); | 151 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); |
154 else | 152 continue; |
155 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); | 153 } |
| 154 |
| 155 const webkit::npapi::PluginGroup* group = plugin_groups[0]; |
| 156 DCHECK_EQ(group->web_plugin_infos().size(), 1u); |
| 157 |
| 158 Send(new UtilityHostMsg_LoadedPlugin(i, group->web_plugin_infos().front())); |
156 } | 159 } |
157 | 160 |
158 ReleaseProcessIfNeeded(); | 161 ReleaseProcessIfNeeded(); |
159 } | 162 } |
160 #endif | 163 #endif |
OLD | NEW |