OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/plugin_loader_posix.h" | 5 #include "content/browser/plugin_loader_posix.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 void PluginLoaderPosix::GetPluginsWrapper( | 154 void PluginLoaderPosix::GetPluginsWrapper( |
155 const PluginService::GetPluginsCallback& callback, | 155 const PluginService::GetPluginsCallback& callback, |
156 const std::vector<WebPluginInfo>& plugins_unused) { | 156 const std::vector<WebPluginInfo>& plugins_unused) { |
157 // We are being called after plugin loading has finished, but we don't know | 157 // We are being called after plugin loading has finished, but we don't know |
158 // whether the plugin list has been invalidated in the mean time | 158 // whether the plugin list has been invalidated in the mean time |
159 // (and therefore |plugins| might already be stale). So we simply ignore it | 159 // (and therefore |plugins| might already be stale). So we simply ignore it |
160 // and call regular GetPlugins() instead. | 160 // and call regular GetPlugins() instead. |
161 GetPlugins(callback); | 161 GetPlugins(callback); |
162 } | 162 } |
163 | 163 |
164 void PluginLoaderPosix::OnPluginLoaded(uint32 index, | 164 void PluginLoaderPosix::OnPluginLoaded(uint32_t index, |
165 const WebPluginInfo& plugin) { | 165 const WebPluginInfo& plugin) { |
166 if (index != next_load_index_) { | 166 if (index != next_load_index_) { |
167 LOG(ERROR) << "Received unexpected plugin load message for " | 167 LOG(ERROR) << "Received unexpected plugin load message for " |
168 << plugin.path.value() << "; index=" << index; | 168 << plugin.path.value() << "; index=" << index; |
169 return; | 169 return; |
170 } | 170 } |
171 | 171 |
172 auto it = FindInternalPlugin(plugin.path); | 172 auto it = FindInternalPlugin(plugin.path); |
173 if (it != internal_plugins_.end()) { | 173 if (it != internal_plugins_.end()) { |
174 loaded_plugins_.push_back(*it); | 174 loaded_plugins_.push_back(*it); |
175 internal_plugins_.erase(it); | 175 internal_plugins_.erase(it); |
176 } else { | 176 } else { |
177 loaded_plugins_.push_back(plugin); | 177 loaded_plugins_.push_back(plugin); |
178 } | 178 } |
179 | 179 |
180 ++next_load_index_; | 180 ++next_load_index_; |
181 | 181 |
182 if (IsFinishedLoadingPlugins()) | 182 if (IsFinishedLoadingPlugins()) |
183 FinishedLoadingPlugins(); | 183 FinishedLoadingPlugins(); |
184 } | 184 } |
185 | 185 |
186 void PluginLoaderPosix::OnPluginLoadFailed(uint32 index, | 186 void PluginLoaderPosix::OnPluginLoadFailed(uint32_t index, |
187 const base::FilePath& plugin_path) { | 187 const base::FilePath& plugin_path) { |
188 if (index != next_load_index_) { | 188 if (index != next_load_index_) { |
189 LOG(ERROR) << "Received unexpected plugin load failure message for " | 189 LOG(ERROR) << "Received unexpected plugin load failure message for " |
190 << plugin_path.value() << "; index=" << index; | 190 << plugin_path.value() << "; index=" << index; |
191 return; | 191 return; |
192 } | 192 } |
193 | 193 |
194 ++next_load_index_; | 194 ++next_load_index_; |
195 | 195 |
196 auto it = FindInternalPlugin(plugin_path); | 196 auto it = FindInternalPlugin(plugin_path); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 FROM_HERE, base::Bind(callback, loaded_plugins_)); | 228 FROM_HERE, base::Bind(callback, loaded_plugins_)); |
229 } | 229 } |
230 callbacks_.clear(); | 230 callbacks_.clear(); |
231 } | 231 } |
232 | 232 |
233 bool PluginLoaderPosix::LaunchUtilityProcess() { | 233 bool PluginLoaderPosix::LaunchUtilityProcess() { |
234 return process_host_->Send(new UtilityMsg_LoadPlugins(canonical_list_)); | 234 return process_host_->Send(new UtilityMsg_LoadPlugins(canonical_list_)); |
235 } | 235 } |
236 | 236 |
237 } // namespace content | 237 } // namespace content |
OLD | NEW |