1 // Copyright 2015 The Chromium Embedded Framework 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 #ifndef CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_MAC_H_ 6 #define CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_MAC_H_ 7 8 #include "libcef/browser/native/browser_platform_delegate_native.h" 9 10 namespace content { 11 class RenderWidgetHostViewMac; 12 } 13 14 // Windowed browser implementation for Mac OS X. 15 class CefBrowserPlatformDelegateNativeMac 16 : public CefBrowserPlatformDelegateNative { 17 public: 18 CefBrowserPlatformDelegateNativeMac(const CefWindowInfo& window_info, 19 SkColor background_color); 20 21 // CefBrowserPlatformDelegate methods: 22 void BrowserDestroyed(CefBrowserHostBase* browser) override; 23 bool CreateHostWindow() override; 24 void CloseHostWindow() override; 25 CefWindowHandle GetHostWindowHandle() const override; 26 void SendKeyEvent(const CefKeyEvent& event) override; 27 void SendMouseClickEvent(const CefMouseEvent& event, 28 CefBrowserHost::MouseButtonType type, 29 bool mouseUp, 30 int clickCount) override; 31 void SendMouseMoveEvent(const CefMouseEvent& event, bool mouseLeave) override; 32 void SendMouseWheelEvent(const CefMouseEvent& event, 33 int deltaX, 34 int deltaY) override; 35 void SendTouchEvent(const CefTouchEvent& event) override; 36 void SetFocus(bool setFocus) override; 37 gfx::Point GetScreenPoint(const gfx::Point& view) const override; 38 void ViewText(const std::string& text) override; 39 bool HandleKeyboardEvent( 40 const content::NativeWebKeyboardEvent& event) override; 41 CefEventHandle GetEventHandle( 42 const content::NativeWebKeyboardEvent& event) const override; 43 std::unique_ptr<CefFileDialogRunner> CreateFileDialogRunner() override; 44 std::unique_ptr<CefJavaScriptDialogRunner> CreateJavaScriptDialogRunner() 45 override; 46 std::unique_ptr<CefMenuRunner> CreateMenuRunner() override; 47 gfx::Point GetDialogPosition(const gfx::Size& size) override; 48 gfx::Size GetMaximumDialogSize() override; 49 50 // CefBrowserPlatformDelegateNative methods: 51 content::NativeWebKeyboardEvent TranslateWebKeyEvent( 52 const CefKeyEvent& key_event) const override; 53 blink::WebMouseEvent TranslateWebClickEvent( 54 const CefMouseEvent& mouse_event, 55 CefBrowserHost::MouseButtonType type, 56 bool mouseUp, 57 int clickCount) const override; 58 blink::WebMouseEvent TranslateWebMoveEvent(const CefMouseEvent& mouse_event, 59 bool mouseLeave) const override; 60 blink::WebMouseWheelEvent TranslateWebWheelEvent( 61 const CefMouseEvent& mouse_event, 62 int deltaX, 63 int deltaY) const override; 64 65 private: 66 void TranslateWebMouseEvent(blink::WebMouseEvent& result, 67 const CefMouseEvent& mouse_event) const; 68 69 content::RenderWidgetHostViewMac* GetHostView() const; 70 71 // True if the host window has been created. 72 bool host_window_created_; 73 }; 74 75 #endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_MAC_H_ 76