| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ppapi/proxy/ppb_font_proxy.h" | |
| 6 | |
| 7 #include "ppapi/c/dev/ppb_font_dev.h" | |
| 8 #include "ppapi/proxy/plugin_dispatcher.h" | |
| 9 #include "ppapi/proxy/plugin_globals.h" | |
| 10 #include "ppapi/proxy/plugin_proxy_delegate.h" | |
| 11 #include "ppapi/proxy/ppapi_messages.h" | |
| 12 #include "ppapi/shared_impl/var.h" | |
| 13 | |
| 14 using ppapi::thunk::PPB_Font_FunctionAPI; | |
| 15 | |
| 16 namespace ppapi { | |
| 17 namespace proxy { | |
| 18 | |
| 19 PPB_Font_Proxy::PPB_Font_Proxy(Dispatcher* dispatcher) | |
| 20 : InterfaceProxy(dispatcher) { | |
| 21 } | |
| 22 | |
| 23 PPB_Font_Proxy::~PPB_Font_Proxy() { | |
| 24 } | |
| 25 | |
| 26 PPB_Font_FunctionAPI* PPB_Font_Proxy::AsPPB_Font_FunctionAPI() { | |
| 27 return this; | |
| 28 } | |
| 29 | |
| 30 // TODO(ananta) | |
| 31 // This needs to be wired up to the PPAPI plugin code. | |
| 32 PP_Var PPB_Font_Proxy::GetFontFamilies(PP_Instance instance) { | |
| 33 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | |
| 34 if (!dispatcher) | |
| 35 return PP_MakeUndefined(); | |
| 36 | |
| 37 // Assume the font families don't change, so we can cache the result globally. | |
| 38 CR_DEFINE_STATIC_LOCAL(std::string, families, ()); | |
| 39 if (families.empty()) { | |
| 40 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | |
| 41 new PpapiHostMsg_PPBFont_GetFontFamilies(&families)); | |
| 42 } | |
| 43 | |
| 44 return StringVar::StringToPPVar(families); | |
| 45 } | |
| 46 | |
| 47 bool PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) { | |
| 48 // There aren't any font messages. | |
| 49 NOTREACHED(); | |
| 50 return false; | |
| 51 } | |
| 52 | |
| 53 } // namespace proxy | |
| 54 } // namespace ppapi | |
| OLD | NEW |