| 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/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 15 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 15 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 16 #include "content/renderer/pepper/plugin_module.h" | 16 #include "content/renderer/pepper/plugin_module.h" |
| 17 #include "content/renderer/render_thread_impl.h" | 17 #include "content/renderer/render_thread_impl.h" |
| 18 #include "ppapi/shared_impl/api_id.h" | 18 #include "ppapi/shared_impl/api_id.h" |
| 19 #include "ppapi/shared_impl/id_assignment.h" | 19 #include "ppapi/shared_impl/id_assignment.h" |
| 20 #include "ppapi/shared_impl/proxy_lock.h" | 20 #include "ppapi/shared_impl/proxy_lock.h" |
| 21 #include "third_party/WebKit/public/platform/WebString.h" | 21 #include "third_party/WebKit/public/platform/WebString.h" |
| 22 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 22 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
| 23 #include "third_party/WebKit/public/web/WebDocument.h" | 23 #include "third_party/WebKit/public/web/WebDocument.h" |
| 24 #include "third_party/WebKit/public/web/WebElement.h" | 24 #include "third_party/WebKit/public/web/WebElement.h" |
| 25 #include "third_party/WebKit/public/web/WebFrame.h" | 25 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 26 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 26 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 27 | 27 |
| 28 using ppapi::CheckIdType; | 28 using ppapi::CheckIdType; |
| 29 using ppapi::MakeTypedId; | 29 using ppapi::MakeTypedId; |
| 30 using ppapi::PPIdType; | 30 using ppapi::PPIdType; |
| 31 using ppapi::ResourceTracker; | 31 using ppapi::ResourceTracker; |
| 32 using blink::WebConsoleMessage; | 32 using blink::WebConsoleMessage; |
| 33 using blink::WebFrame; | 33 using blink::WebLocalFrame; |
| 34 using blink::WebPluginContainer; | 34 using blink::WebPluginContainer; |
| 35 using blink::WebString; | 35 using blink::WebString; |
| 36 | 36 |
| 37 namespace content { | 37 namespace content { |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 typedef std::set<WebPluginContainer*> ContainerSet; | 41 typedef std::set<WebPluginContainer*> ContainerSet; |
| 42 | 42 |
| 43 // Adds all WebPluginContainers associated with the given module to the set. | 43 // Adds all WebPluginContainers associated with the given module to the set. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Unknown module, get containers for all modules. | 175 // Unknown module, get containers for all modules. |
| 176 for (ModuleMap::const_iterator i = module_map_.begin(); | 176 for (ModuleMap::const_iterator i = module_map_.begin(); |
| 177 i != module_map_.end(); ++i) { | 177 i != module_map_.end(); ++i) { |
| 178 GetAllContainersForModule(i->second, &containers); | 178 GetAllContainersForModule(i->second, &containers); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 WebConsoleMessage message = MakeLogMessage(level, source, value); | 182 WebConsoleMessage message = MakeLogMessage(level, source, value); |
| 183 for (ContainerSet::iterator i = containers.begin(); | 183 for (ContainerSet::iterator i = containers.begin(); |
| 184 i != containers.end(); ++i) { | 184 i != containers.end(); ++i) { |
| 185 WebFrame* frame = (*i)->element().document().frame(); | 185 WebLocalFrame* frame = (*i)->element().document().frame(); |
| 186 if (frame) | 186 if (frame) |
| 187 frame->addMessageToConsole(message); | 187 frame->addMessageToConsole(message); |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 base::TaskRunner* HostGlobals::GetFileTaskRunner() { | 191 base::TaskRunner* HostGlobals::GetFileTaskRunner() { |
| 192 return RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(); | 192 return RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 ppapi::MessageLoopShared* HostGlobals::GetCurrentMessageLoop() { | 195 ppapi::MessageLoopShared* HostGlobals::GetCurrentMessageLoop() { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 if (found == instance_map_.end()) | 274 if (found == instance_map_.end()) |
| 275 return NULL; | 275 return NULL; |
| 276 return found->second; | 276 return found->second; |
| 277 } | 277 } |
| 278 | 278 |
| 279 bool HostGlobals::IsHostGlobals() const { | 279 bool HostGlobals::IsHostGlobals() const { |
| 280 return true; | 280 return true; |
| 281 } | 281 } |
| 282 | 282 |
| 283 } // namespace content | 283 } // namespace content |
| OLD | NEW |