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 size_t index = std::distance(plugin_paths.begin(), it); |
126 } | 122 |
127 for (std::vector<webkit::WebPluginInfo>::const_reverse_iterator it = | 123 if (!plugin_groups.size()) { |
jam
2011/10/20 00:16:16
nit: chrome style is if (plugin_groups.empty())
Robert Sesek
2011/10/20 16:00:21
Done.
| |
128 internal_plugins.rbegin(); | 124 Send(new UtilityHostMsg_LoadPluginFailed(index, *it)); |
129 it != internal_plugins.rend(); | 125 continue; |
130 ++it) { | 126 } |
131 plugin_list->RegisterInternalPlugin(*it); | 127 |
128 const webkit::npapi::PluginGroup* group = plugin_groups[0]; | |
129 DCHECK_EQ(group->web_plugin_infos().size(), 1u); | |
130 | |
131 Send(new UtilityHostMsg_LoadedPlugin(index, | |
132 group->web_plugin_infos().front())); | |
132 } | 133 } |
133 | 134 |
134 std::vector<webkit::WebPluginInfo> plugins; | |
135 plugin_list->GetPlugins(&plugins); | |
136 | |
137 Send(new UtilityHostMsg_LoadedPlugins(plugins)); | |
138 ReleaseProcessIfNeeded(); | 135 ReleaseProcessIfNeeded(); |
139 } | 136 } |
140 #endif | 137 #endif |
141 | 138 |
OLD | NEW |