| 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/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 if (!MaybeAddInternalPlugin(plugin.path)) | 125 if (!MaybeAddInternalPlugin(plugin.path)) |
| 126 loaded_plugins_.push_back(plugin); | 126 loaded_plugins_.push_back(plugin); |
| 127 | 127 |
| 128 ++next_load_index_; | 128 ++next_load_index_; |
| 129 | 129 |
| 130 MaybeRunPendingCallbacks(); | 130 MaybeRunPendingCallbacks(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void PluginLoaderPosix::OnPluginLoadFailed(uint32 index, | 133 void PluginLoaderPosix::OnPluginLoadFailed(uint32 index, |
| 134 const FilePath& plugin_path) { | 134 const base::FilePath& plugin_path) { |
| 135 if (index != next_load_index_) { | 135 if (index != next_load_index_) { |
| 136 LOG(ERROR) << "Received unexpected plugin load failure message for " | 136 LOG(ERROR) << "Received unexpected plugin load failure message for " |
| 137 << plugin_path.value() << "; index=" << index; | 137 << plugin_path.value() << "; index=" << index; |
| 138 return; | 138 return; |
| 139 } | 139 } |
| 140 | 140 |
| 141 ++next_load_index_; | 141 ++next_load_index_; |
| 142 | 142 |
| 143 MaybeAddInternalPlugin(plugin_path); | 143 MaybeAddInternalPlugin(plugin_path); |
| 144 MaybeRunPendingCallbacks(); | 144 MaybeRunPendingCallbacks(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool PluginLoaderPosix::MaybeAddInternalPlugin(const FilePath& plugin_path) { | 147 bool PluginLoaderPosix::MaybeAddInternalPlugin( |
| 148 const base::FilePath& plugin_path) { |
| 148 for (std::vector<webkit::WebPluginInfo>::iterator it = | 149 for (std::vector<webkit::WebPluginInfo>::iterator it = |
| 149 internal_plugins_.begin(); | 150 internal_plugins_.begin(); |
| 150 it != internal_plugins_.end(); | 151 it != internal_plugins_.end(); |
| 151 ++it) { | 152 ++it) { |
| 152 if (it->path == plugin_path) { | 153 if (it->path == plugin_path) { |
| 153 loaded_plugins_.push_back(*it); | 154 loaded_plugins_.push_back(*it); |
| 154 internal_plugins_.erase(it); | 155 internal_plugins_.erase(it); |
| 155 return true; | 156 return true; |
| 156 } | 157 } |
| 157 } | 158 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 scoped_refptr<base::MessageLoopProxy> loop, | 193 scoped_refptr<base::MessageLoopProxy> loop, |
| 193 const PluginService::GetPluginsCallback& cb) | 194 const PluginService::GetPluginsCallback& cb) |
| 194 : target_loop(loop), | 195 : target_loop(loop), |
| 195 callback(cb) { | 196 callback(cb) { |
| 196 } | 197 } |
| 197 | 198 |
| 198 PluginLoaderPosix::PendingCallback::~PendingCallback() { | 199 PluginLoaderPosix::PendingCallback::~PendingCallback() { |
| 199 } | 200 } |
| 200 | 201 |
| 201 } // namespace content | 202 } // namespace content |
| OLD | NEW |