| 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 "webkit/plugins/ppapi/host_globals.h" | 5 #include "webkit/plugins/ppapi/host_globals.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
| 11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 12 #include "ppapi/shared_impl/api_id.h" | 13 #include "ppapi/shared_impl/api_id.h" |
| 13 #include "ppapi/shared_impl/function_group_base.h" | 14 #include "ppapi/shared_impl/function_group_base.h" |
| 14 #include "ppapi/shared_impl/id_assignment.h" | 15 #include "ppapi/shared_impl/id_assignment.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 22 #include "webkit/plugins/plugin_switches.h" |
| 21 #include "webkit/plugins/ppapi/plugin_module.h" | 23 #include "webkit/plugins/ppapi/plugin_module.h" |
| 22 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 24 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 23 #include "webkit/plugins/ppapi/ppb_flash_clipboard_impl.h" | 25 #include "webkit/plugins/ppapi/ppb_flash_clipboard_impl.h" |
| 24 #include "webkit/plugins/ppapi/ppb_text_input_impl.h" | 26 #include "webkit/plugins/ppapi/ppb_text_input_impl.h" |
| 25 #include "webkit/plugins/ppapi/resource_creation_impl.h" | 27 #include "webkit/plugins/ppapi/resource_creation_impl.h" |
| 26 | 28 |
| 27 using ppapi::CheckIdType; | 29 using ppapi::CheckIdType; |
| 28 using ppapi::MakeTypedId; | 30 using ppapi::MakeTypedId; |
| 29 using ppapi::PPIdType; | 31 using ppapi::PPIdType; |
| 30 using WebKit::WebConsoleMessage; | 32 using WebKit::WebConsoleMessage; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return proxy.get(); | 158 return proxy.get(); |
| 157 } | 159 } |
| 158 | 160 |
| 159 PP_Module HostGlobals::GetModuleForInstance(PP_Instance instance) { | 161 PP_Module HostGlobals::GetModuleForInstance(PP_Instance instance) { |
| 160 PluginInstance* inst = GetInstance(instance); | 162 PluginInstance* inst = GetInstance(instance); |
| 161 if (!inst) | 163 if (!inst) |
| 162 return 0; | 164 return 0; |
| 163 return inst->module()->pp_module(); | 165 return inst->module()->pp_module(); |
| 164 } | 166 } |
| 165 | 167 |
| 168 std::string HostGlobals::GetCmdLine() { |
| 169 return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 170 switches::kPpapiFlashArgs); |
| 171 } |
| 172 |
| 173 void HostGlobals::PreCacheFontForFlash(const void* logfontw) { |
| 174 // Not implemented in-process. |
| 175 } |
| 176 |
| 166 base::Lock* HostGlobals::GetProxyLock() { | 177 base::Lock* HostGlobals::GetProxyLock() { |
| 167 // We do not lock on the host side. | 178 // We do not lock on the host side. |
| 168 return NULL; | 179 return NULL; |
| 169 } | 180 } |
| 170 | 181 |
| 171 void HostGlobals::LogWithSource(PP_Instance instance, | 182 void HostGlobals::LogWithSource(PP_Instance instance, |
| 172 PP_LogLevel_Dev level, | 183 PP_LogLevel_Dev level, |
| 173 const std::string& source, | 184 const std::string& source, |
| 174 const std::string& value) { | 185 const std::string& value) { |
| 175 PluginInstance* instance_object = HostGlobals::Get()->GetInstance(instance); | 186 PluginInstance* instance_object = HostGlobals::Get()->GetInstance(instance); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 return NULL; | 297 return NULL; |
| 287 return found->second->instance; | 298 return found->second->instance; |
| 288 } | 299 } |
| 289 | 300 |
| 290 bool HostGlobals::IsHostGlobals() const { | 301 bool HostGlobals::IsHostGlobals() const { |
| 291 return true; | 302 return true; |
| 292 } | 303 } |
| 293 | 304 |
| 294 } // namespace ppapi | 305 } // namespace ppapi |
| 295 } // namespace webkit | 306 } // namespace webkit |
| OLD | NEW |