summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc
blob: edeb06b51dd9bfe923aaf01194418f0d1a8fa415 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/renderer/pepper/pepper_flash_fullscreen_host.h"

#include "content/public/renderer/ppapi_plugin_instance.h"
#include "content/public/renderer/renderer_ppapi_host.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/host/dispatch_host_message.h"
#include "ppapi/host/host_message_context.h"
#include "ppapi/host/ppapi_host.h"
#include "ppapi/proxy/ppapi_messages.h"

namespace chrome {

PepperFlashFullscreenHost::PepperFlashFullscreenHost(
    content::RendererPpapiHost* host,
    PP_Instance instance,
    PP_Resource resource)
    : ResourceHost(host->GetPpapiHost(), instance, resource),
      renderer_ppapi_host_(host) {
}

PepperFlashFullscreenHost::~PepperFlashFullscreenHost() {
}

int32_t PepperFlashFullscreenHost::OnResourceMessageReceived(
    const IPC::Message& msg,
    ppapi::host::HostMessageContext* context) {
  IPC_BEGIN_MESSAGE_MAP(PepperFlashFullscreenHost, msg)
    PPAPI_DISPATCH_HOST_RESOURCE_CALL(
        PpapiHostMsg_FlashFullscreen_SetFullscreen,
        OnSetFullscreen)
  IPC_END_MESSAGE_MAP()
  return PP_ERROR_FAILED;
}

int32_t PepperFlashFullscreenHost::OnSetFullscreen(
    ppapi::host::HostMessageContext* context,
    bool fullscreen) {
  webkit::ppapi::PluginInstance* plugin_instance =
      renderer_ppapi_host_->GetPluginInstance(pp_instance());
  if (plugin_instance) {
    plugin_instance->FlashSetFullscreen(fullscreen, true);
    return PP_OK;
  }
  return PP_ERROR_FAILED;
}

}  // namespace chrome