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
3// found in the LICENSE file.
4
5#include "ppapi/proxy/browser_font_singleton_resource.h"
6
7#include "ppapi/proxy/ppapi_messages.h"
8#include "ppapi/shared_impl/var.h"
9
10namespace ppapi {
11namespace proxy {
12
13BrowserFontSingletonResource::BrowserFontSingletonResource(
14    Connection connection,
15    PP_Instance instance)
16    : PluginResource(connection, instance) {
17  SendCreate(BROWSER, PpapiHostMsg_BrowserFontSingleton_Create());
18}
19
20BrowserFontSingletonResource::~BrowserFontSingletonResource() {
21}
22
23thunk::PPB_BrowserFont_Singleton_API*
24BrowserFontSingletonResource::AsPPB_BrowserFont_Singleton_API() {
25  return this;
26}
27
28PP_Var BrowserFontSingletonResource::GetFontFamilies(PP_Instance instance) {
29  if (families_.empty()) {
30    SyncCall<PpapiPluginMsg_BrowserFontSingleton_GetFontFamiliesReply>(
31        BROWSER, PpapiHostMsg_BrowserFontSingleton_GetFontFamilies(),
32        &families_);
33  }
34  return StringVar::StringToPPVar(families_);
35}
36
37}  // namespace proxy
38}  // namespace ppapi
39