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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "ipc/ipc_platform_file.h" | 21 #include "ipc/ipc_platform_file.h" |
22 #include "ipc/ipc_sync_channel.h" | 22 #include "ipc/ipc_sync_channel.h" |
23 #include "ipc/ipc_sync_message_filter.h" | 23 #include "ipc/ipc_sync_message_filter.h" |
24 #include "ppapi/c/dev/ppp_network_state_dev.h" | 24 #include "ppapi/c/dev/ppp_network_state_dev.h" |
25 #include "ppapi/c/pp_errors.h" | 25 #include "ppapi/c/pp_errors.h" |
26 #include "ppapi/c/ppp.h" | 26 #include "ppapi/c/ppp.h" |
27 #include "ppapi/proxy/plugin_globals.h" | 27 #include "ppapi/proxy/plugin_globals.h" |
28 #include "ppapi/proxy/ppapi_messages.h" | 28 #include "ppapi/proxy/ppapi_messages.h" |
29 #include "ppapi/proxy/interface_list.h" | 29 #include "ppapi/proxy/interface_list.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| 31 #include "ui/base/ui_base_switches.h" |
31 #include "webkit/plugins/plugin_switches.h" | 32 #include "webkit/plugins/plugin_switches.h" |
32 | 33 |
33 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
34 #include "sandbox/src/sandbox.h" | 35 #include "sandbox/src/sandbox.h" |
35 #elif defined(OS_MACOSX) | 36 #elif defined(OS_MACOSX) |
36 #include "content/common/sandbox_init_mac.h" | 37 #include "content/common/sandbox_init_mac.h" |
37 #endif | 38 #endif |
38 | 39 |
39 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
40 extern sandbox::TargetServices* g_target_services; | 41 extern sandbox::TargetServices* g_target_services; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return &globally_seen_instance_ids_; | 155 return &globally_seen_instance_ids_; |
155 } | 156 } |
156 | 157 |
157 bool PpapiThread::SendToBrowser(IPC::Message* msg) { | 158 bool PpapiThread::SendToBrowser(IPC::Message* msg) { |
158 if (MessageLoop::current() == message_loop()) | 159 if (MessageLoop::current() == message_loop()) |
159 return ChildThread::Send(msg); | 160 return ChildThread::Send(msg); |
160 | 161 |
161 return sync_message_filter()->Send(msg); | 162 return sync_message_filter()->Send(msg); |
162 } | 163 } |
163 | 164 |
| 165 std::string PpapiThread::GetUILanguage() { |
| 166 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 167 return command_line->GetSwitchValueASCII(switches::kLang); |
| 168 } |
| 169 |
164 void PpapiThread::PreCacheFont(const void* logfontw) { | 170 void PpapiThread::PreCacheFont(const void* logfontw) { |
165 #if defined(OS_WIN) | 171 #if defined(OS_WIN) |
166 Send(new ChildProcessHostMsg_PreCacheFont( | 172 Send(new ChildProcessHostMsg_PreCacheFont( |
167 *static_cast<const LOGFONTW*>(logfontw))); | 173 *static_cast<const LOGFONTW*>(logfontw))); |
168 #endif | 174 #endif |
169 } | 175 } |
170 | 176 |
171 uint32 PpapiThread::Register(ppapi::proxy::PluginDispatcher* plugin_dispatcher)
{ | 177 uint32 PpapiThread::Register(ppapi::proxy::PluginDispatcher* plugin_dispatcher)
{ |
172 if (!plugin_dispatcher || | 178 if (!plugin_dispatcher || |
173 plugin_dispatchers_.size() >= std::numeric_limits<uint32>::max()) { | 179 plugin_dispatchers_.size() >= std::numeric_limits<uint32>::max()) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 359 |
354 // From here, the dispatcher will manage its own lifetime according to the | 360 // From here, the dispatcher will manage its own lifetime according to the |
355 // lifetime of the attached channel. | 361 // lifetime of the attached channel. |
356 return true; | 362 return true; |
357 } | 363 } |
358 | 364 |
359 void PpapiThread::SavePluginName(const FilePath& path) { | 365 void PpapiThread::SavePluginName(const FilePath& path) { |
360 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( | 366 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( |
361 path.BaseName().AsUTF8Unsafe()); | 367 path.BaseName().AsUTF8Unsafe()); |
362 } | 368 } |
OLD | NEW |