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/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/memory/scoped_vector.h" |
10 #include "content/common/child_process.h" | 11 #include "content/common/child_process.h" |
11 #include "content/common/indexed_db_key.h" | 12 #include "content/common/indexed_db_key.h" |
12 #include "content/common/utility_messages.h" | 13 #include "content/common/utility_messages.h" |
13 #include "content/public/utility/content_utility_client.h" | 14 #include "content/public/utility/content_utility_client.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptVa
lue.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptVa
lue.h" |
17 #include "webkit/glue/idb_bindings.h" | 18 #include "webkit/glue/idb_bindings.h" |
18 #include "webkit/glue/webkitplatformsupport_impl.h" | 19 #include "webkit/glue/webkitplatformsupport_impl.h" |
19 #include "webkit/plugins/npapi/plugin_list.h" | 20 #include "webkit/plugins/npapi/plugin_list.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void UtilityThreadImpl::OnBatchModeStarted() { | 101 void UtilityThreadImpl::OnBatchModeStarted() { |
101 batch_mode_ = true; | 102 batch_mode_ = true; |
102 } | 103 } |
103 | 104 |
104 void UtilityThreadImpl::OnBatchModeFinished() { | 105 void UtilityThreadImpl::OnBatchModeFinished() { |
105 ChildProcess::current()->ReleaseProcess(); | 106 ChildProcess::current()->ReleaseProcess(); |
106 } | 107 } |
107 | 108 |
108 #if defined(OS_POSIX) | 109 #if defined(OS_POSIX) |
109 void UtilityThreadImpl::OnLoadPlugins( | 110 void UtilityThreadImpl::OnLoadPlugins( |
110 const std::vector<FilePath>& extra_plugin_paths, | 111 const std::vector<FilePath>& plugin_paths) { |
111 const std::vector<FilePath>& extra_plugin_dirs, | |
112 const std::vector<webkit::WebPluginInfo>& internal_plugins) { | |
113 webkit::npapi::PluginList* plugin_list = | 112 webkit::npapi::PluginList* plugin_list = |
114 webkit::npapi::PluginList::Singleton(); | 113 webkit::npapi::PluginList::Singleton(); |
115 | 114 |
116 // Create the PluginList and set the paths from which to load plugins. Iterate | 115 for (std::vector<FilePath>::const_iterator it = plugin_paths.begin(); |
117 // in reverse to preserve the order when pushing back. | 116 it != plugin_paths.end(); |
118 std::vector<FilePath>::const_reverse_iterator it; | |
119 for (it = extra_plugin_paths.rbegin(); | |
120 it != extra_plugin_paths.rend(); | |
121 ++it) { | 117 ++it) { |
122 plugin_list->AddExtraPluginPath(*it); | 118 ScopedVector<webkit::npapi::PluginGroup> plugin_groups; |
123 } | 119 plugin_list->LoadPlugin(*it, &plugin_groups); |
124 for (it = extra_plugin_dirs.rbegin(); it != extra_plugin_dirs.rend(); ++it) { | 120 |
125 plugin_list->AddExtraPluginDir(*it); | 121 if (plugin_groups.empty()) { |
126 } | 122 Send(new UtilityHostMsg_LoadPluginFailed(*it)); |
127 for (std::vector<webkit::WebPluginInfo>::const_reverse_iterator it = | 123 continue; |
128 internal_plugins.rbegin(); | 124 } |
129 it != internal_plugins.rend(); | 125 |
130 ++it) { | 126 const webkit::npapi::PluginGroup* group = plugin_groups[0]; |
131 plugin_list->RegisterInternalPlugin(*it); | 127 DCHECK_EQ(group->web_plugin_infos().size(), 1u); |
| 128 |
| 129 Send(new UtilityHostMsg_LoadedPlugin(group->web_plugin_infos().front())); |
132 } | 130 } |
133 | 131 |
134 std::vector<webkit::WebPluginInfo> plugins; | |
135 plugin_list->GetPlugins(&plugins); | |
136 | |
137 Send(new UtilityHostMsg_LoadedPlugins(plugins)); | |
138 ReleaseProcessIfNeeded(); | 132 ReleaseProcessIfNeeded(); |
139 } | 133 } |
140 #endif | 134 #endif |
141 | 135 |
OLD | NEW |