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/ppapi_plugin/ppapi_thread.h" | 5 #include "content/ppapi_plugin/ppapi_thread.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/process_util.h" | 10 #include "base/process_util.h" |
11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "content/common/child_process.h" | 14 #include "content/common/child_process.h" |
15 #include "content/common/child_process_messages.h" | 15 #include "content/common/child_process_messages.h" |
16 #include "content/ppapi_plugin/broker_process_dispatcher.h" | 16 #include "content/ppapi_plugin/broker_process_dispatcher.h" |
17 #include "content/ppapi_plugin/plugin_process_dispatcher.h" | 17 #include "content/ppapi_plugin/plugin_process_dispatcher.h" |
18 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h" | 18 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h" |
| 19 #include "content/public/common/content_client.h" |
19 #include "content/public/common/sandbox_init.h" | 20 #include "content/public/common/sandbox_init.h" |
20 #include "content/public/plugin/content_plugin_client.h" | 21 #include "content/public/plugin/content_plugin_client.h" |
21 #include "ipc/ipc_channel_handle.h" | 22 #include "ipc/ipc_channel_handle.h" |
22 #include "ipc/ipc_platform_file.h" | 23 #include "ipc/ipc_platform_file.h" |
23 #include "ipc/ipc_sync_channel.h" | 24 #include "ipc/ipc_sync_channel.h" |
24 #include "ipc/ipc_sync_message_filter.h" | 25 #include "ipc/ipc_sync_message_filter.h" |
25 #include "ppapi/c/dev/ppp_network_state_dev.h" | 26 #include "ppapi/c/dev/ppp_network_state_dev.h" |
26 #include "ppapi/c/pp_errors.h" | 27 #include "ppapi/c/pp_errors.h" |
27 #include "ppapi/c/ppp.h" | 28 #include "ppapi/c/ppp.h" |
28 #include "ppapi/proxy/plugin_globals.h" | 29 #include "ppapi/proxy/plugin_globals.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 return command_line->GetSwitchValueASCII(switches::kLang); | 171 return command_line->GetSwitchValueASCII(switches::kLang); |
171 } | 172 } |
172 | 173 |
173 void PpapiThread::PreCacheFont(const void* logfontw) { | 174 void PpapiThread::PreCacheFont(const void* logfontw) { |
174 #if defined(OS_WIN) | 175 #if defined(OS_WIN) |
175 Send(new ChildProcessHostMsg_PreCacheFont( | 176 Send(new ChildProcessHostMsg_PreCacheFont( |
176 *static_cast<const LOGFONTW*>(logfontw))); | 177 *static_cast<const LOGFONTW*>(logfontw))); |
177 #endif | 178 #endif |
178 } | 179 } |
179 | 180 |
| 181 void PpapiThread::SetActiveURL(const std::string& url) { |
| 182 content::GetContentClient()->SetActiveURL(GURL(url)); |
| 183 } |
| 184 |
180 uint32 PpapiThread::Register(ppapi::proxy::PluginDispatcher* plugin_dispatcher)
{ | 185 uint32 PpapiThread::Register(ppapi::proxy::PluginDispatcher* plugin_dispatcher)
{ |
181 if (!plugin_dispatcher || | 186 if (!plugin_dispatcher || |
182 plugin_dispatchers_.size() >= std::numeric_limits<uint32>::max()) { | 187 plugin_dispatchers_.size() >= std::numeric_limits<uint32>::max()) { |
183 return 0; | 188 return 0; |
184 } | 189 } |
185 | 190 |
186 uint32 id = 0; | 191 uint32 id = 0; |
187 do { | 192 do { |
188 // Although it is unlikely, make sure that we won't cause any trouble when | 193 // Although it is unlikely, make sure that we won't cause any trouble when |
189 // the counter overflows. | 194 // the counter overflows. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( | 374 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( |
370 path.BaseName().AsUTF8Unsafe()); | 375 path.BaseName().AsUTF8Unsafe()); |
371 | 376 |
372 // plugin() is NULL when in-process. Which is fine, because this is | 377 // plugin() is NULL when in-process. Which is fine, because this is |
373 // just a hook for setting the process name. | 378 // just a hook for setting the process name. |
374 if (content::GetContentClient()->plugin()) { | 379 if (content::GetContentClient()->plugin()) { |
375 content::GetContentClient()->plugin()->PluginProcessStarted( | 380 content::GetContentClient()->plugin()->PluginProcessStarted( |
376 path.BaseName().RemoveExtension().LossyDisplayName()); | 381 path.BaseName().RemoveExtension().LossyDisplayName()); |
377 } | 382 } |
378 } | 383 } |
OLD | NEW |