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/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 process_host_ = host->AsWeakPtr(); | 109 process_host_ = host->AsWeakPtr(); |
110 process_host_->DisableSandbox(); | 110 process_host_->DisableSandbox(); |
111 #if defined(OS_MACOSX) | 111 #if defined(OS_MACOSX) |
112 host->set_child_flags(ChildProcessHost::CHILD_ALLOW_HEAP_EXECUTION); | 112 host->set_child_flags(ChildProcessHost::CHILD_ALLOW_HEAP_EXECUTION); |
113 #endif | 113 #endif |
114 | 114 |
115 process_host_->Send(new UtilityMsg_LoadPlugins(canonical_list_)); | 115 process_host_->Send(new UtilityMsg_LoadPlugins(canonical_list_)); |
116 } | 116 } |
117 | 117 |
118 void PluginLoaderPosix::OnPluginLoaded(uint32 index, | 118 void PluginLoaderPosix::OnPluginLoaded(uint32 index, |
119 const webkit::WebPluginInfo& plugin) { | 119 const WebPluginInfo& plugin) { |
120 if (index != next_load_index_) { | 120 if (index != next_load_index_) { |
121 LOG(ERROR) << "Received unexpected plugin load message for " | 121 LOG(ERROR) << "Received unexpected plugin load message for " |
122 << plugin.path.value() << "; index=" << index; | 122 << plugin.path.value() << "; index=" << index; |
123 return; | 123 return; |
124 } | 124 } |
125 | 125 |
126 if (!MaybeAddInternalPlugin(plugin.path)) | 126 if (!MaybeAddInternalPlugin(plugin.path)) |
127 loaded_plugins_.push_back(plugin); | 127 loaded_plugins_.push_back(plugin); |
128 | 128 |
129 ++next_load_index_; | 129 ++next_load_index_; |
(...skipping 10 matching lines...) Expand all Loading... |
140 } | 140 } |
141 | 141 |
142 ++next_load_index_; | 142 ++next_load_index_; |
143 | 143 |
144 MaybeAddInternalPlugin(plugin_path); | 144 MaybeAddInternalPlugin(plugin_path); |
145 MaybeRunPendingCallbacks(); | 145 MaybeRunPendingCallbacks(); |
146 } | 146 } |
147 | 147 |
148 bool PluginLoaderPosix::MaybeAddInternalPlugin( | 148 bool PluginLoaderPosix::MaybeAddInternalPlugin( |
149 const base::FilePath& plugin_path) { | 149 const base::FilePath& plugin_path) { |
150 for (std::vector<webkit::WebPluginInfo>::iterator it = | 150 for (std::vector<WebPluginInfo>::iterator it = internal_plugins_.begin(); |
151 internal_plugins_.begin(); | |
152 it != internal_plugins_.end(); | 151 it != internal_plugins_.end(); |
153 ++it) { | 152 ++it) { |
154 if (it->path == plugin_path) { | 153 if (it->path == plugin_path) { |
155 loaded_plugins_.push_back(*it); | 154 loaded_plugins_.push_back(*it); |
156 internal_plugins_.erase(it); | 155 internal_plugins_.erase(it); |
157 return true; | 156 return true; |
158 } | 157 } |
159 } | 158 } |
160 return false; | 159 return false; |
161 } | 160 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 scoped_refptr<base::MessageLoopProxy> loop, | 192 scoped_refptr<base::MessageLoopProxy> loop, |
194 const PluginService::GetPluginsCallback& cb) | 193 const PluginService::GetPluginsCallback& cb) |
195 : target_loop(loop), | 194 : target_loop(loop), |
196 callback(cb) { | 195 callback(cb) { |
197 } | 196 } |
198 | 197 |
199 PluginLoaderPosix::PendingCallback::~PendingCallback() { | 198 PluginLoaderPosix::PendingCallback::~PendingCallback() { |
200 } | 199 } |
201 | 200 |
202 } // namespace content | 201 } // namespace content |
OLD | NEW |