browser_platform_delegate_native.cc 2.31 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
// Copyright 2015 The Chromium Embedded Framework 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 "libcef/browser/native/browser_platform_delegate_native.h"

#include "libcef/browser/browser_host_impl.h"

#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"

CefBrowserPlatformDelegateNative::CefBrowserPlatformDelegateNative(
13
    const CefWindowInfo& window_info,
14 15 16
    SkColor background_color,
    bool use_shared_texture,
    bool use_external_begin_frame)
17
    : window_info_(window_info),
18
      background_color_(background_color),
19 20
      use_shared_texture_(use_shared_texture),
      use_external_begin_frame_(use_external_begin_frame),
21
      windowless_handler_(nullptr) {}
22

23 24 25 26
SkColor CefBrowserPlatformDelegateNative::GetBackgroundColor() const {
  return background_color_;
}

27 28 29 30 31 32 33 34
bool CefBrowserPlatformDelegateNative::CanUseSharedTexture() const {
  return use_shared_texture_;
}

bool CefBrowserPlatformDelegateNative::CanUseExternalBeginFrame() const {
  return use_external_begin_frame_;
}

35
void CefBrowserPlatformDelegateNative::SynchronizeVisualProperties() {
36 37
  content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
  if (host)
38
    host->GetWidget()->SynchronizeVisualProperties();
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
}

void CefBrowserPlatformDelegateNative::SendKeyEvent(
    const content::NativeWebKeyboardEvent& event) {
  content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
  if (host)
    host->GetWidget()->ForwardKeyboardEvent(event);
}

void CefBrowserPlatformDelegateNative::SendMouseEvent(
    const blink::WebMouseEvent& event) {
  content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
  if (host)
    host->GetWidget()->ForwardMouseEvent(event);
}

void CefBrowserPlatformDelegateNative::SendMouseWheelEvent(
    const blink::WebMouseWheelEvent& event) {
  content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
  if (host)
    host->GetWidget()->ForwardWheelEvent(event);
}

62 63 64
void CefBrowserPlatformDelegateNative::SendTouchEvent(
    const CefTouchEvent& event) {}

65 66 67
bool CefBrowserPlatformDelegateNative::IsWindowless() const {
  return false;
}
68 69 70 71

bool CefBrowserPlatformDelegateNative::IsViewsHosted() const {
  return false;
}