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/renderer/pepper/host_globals.h" | 5 #include "content/renderer/pepper/host_globals.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/task_runner.h" | 13 #include "base/task_runner.h" |
14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
15 #include "content/renderer/pepper/plugin_module.h" | 15 #include "content/renderer/pepper/plugin_module.h" |
| 16 #include "content/renderer/render_thread_impl.h" |
16 #include "ppapi/shared_impl/api_id.h" | 17 #include "ppapi/shared_impl/api_id.h" |
17 #include "ppapi/shared_impl/id_assignment.h" | 18 #include "ppapi/shared_impl/id_assignment.h" |
18 #include "third_party/WebKit/public/platform/WebString.h" | 19 #include "third_party/WebKit/public/platform/WebString.h" |
19 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 20 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
20 #include "third_party/WebKit/public/web/WebDocument.h" | 21 #include "third_party/WebKit/public/web/WebDocument.h" |
21 #include "third_party/WebKit/public/web/WebElement.h" | 22 #include "third_party/WebKit/public/web/WebElement.h" |
22 #include "third_party/WebKit/public/web/WebFrame.h" | 23 #include "third_party/WebKit/public/web/WebFrame.h" |
23 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 24 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
24 #include "webkit/plugins/plugin_switches.h" | 25 #include "webkit/plugins/plugin_switches.h" |
25 | 26 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 179 } |
179 } | 180 } |
180 | 181 |
181 WebConsoleMessage message = MakeLogMessage(level, source, value); | 182 WebConsoleMessage message = MakeLogMessage(level, source, value); |
182 for (ContainerSet::iterator i = containers.begin(); | 183 for (ContainerSet::iterator i = containers.begin(); |
183 i != containers.end(); ++i) | 184 i != containers.end(); ++i) |
184 (*i)->element().document().frame()->addMessageToConsole(message); | 185 (*i)->element().document().frame()->addMessageToConsole(message); |
185 } | 186 } |
186 | 187 |
187 base::TaskRunner* HostGlobals::GetFileTaskRunner(PP_Instance instance) { | 188 base::TaskRunner* HostGlobals::GetFileTaskRunner(PP_Instance instance) { |
188 scoped_refptr<PepperPluginInstanceImpl> plugin_instance = | 189 return RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(); |
189 GetInstance(instance); | |
190 DCHECK(plugin_instance.get()); | |
191 scoped_refptr<base::MessageLoopProxy> message_loop = | |
192 plugin_instance->delegate()->GetFileThreadMessageLoopProxy(); | |
193 return message_loop.get(); | |
194 } | 190 } |
195 | 191 |
196 ::ppapi::MessageLoopShared* HostGlobals::GetCurrentMessageLoop() { | 192 ::ppapi::MessageLoopShared* HostGlobals::GetCurrentMessageLoop() { |
197 return NULL; | 193 return NULL; |
198 } | 194 } |
199 | 195 |
200 PP_Module HostGlobals::AddModule(PluginModule* module) { | 196 PP_Module HostGlobals::AddModule(PluginModule* module) { |
201 #ifndef NDEBUG | 197 #ifndef NDEBUG |
202 // Make sure we're not adding one more than once. | 198 // Make sure we're not adding one more than once. |
203 for (ModuleMap::const_iterator i = module_map_.begin(); | 199 for (ModuleMap::const_iterator i = module_map_.begin(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 if (found == instance_map_.end()) | 271 if (found == instance_map_.end()) |
276 return NULL; | 272 return NULL; |
277 return found->second; | 273 return found->second; |
278 } | 274 } |
279 | 275 |
280 bool HostGlobals::IsHostGlobals() const { | 276 bool HostGlobals::IsHostGlobals() const { |
281 return true; | 277 return true; |
282 } | 278 } |
283 | 279 |
284 } // namespace content | 280 } // namespace content |
OLD | NEW |