1 // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 // reserved. Use of this source code is governed by a BSD-style license that 3 // can be found in the LICENSE file. 4 5 #ifndef CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_OSR_MAC_H_ 6 #define CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_OSR_MAC_H_ 7 #pragma once 8 9 #include "tests/cefclient/browser/browser_window.h" 10 #include "tests/cefclient/browser/client_handler_osr.h" 11 #include "tests/cefclient/browser/osr_renderer.h" 12 #include "tests/cefclient/browser/text_input_client_osr_mac.h" 13 14 namespace client { 15 16 class BrowserWindowOsrMacImpl; 17 18 // Represents a native child window hosting a single off-screen browser 19 // instance. The methods of this class must be called on the main thread unless 20 // otherwise indicated. 21 class BrowserWindowOsrMac : public BrowserWindow, 22 public ClientHandlerOsr::OsrDelegate { 23 public: 24 // Constructor may be called on any thread. 25 // |delegate| must outlive this object. 26 BrowserWindowOsrMac(BrowserWindow::Delegate* delegate, 27 const std::string& startup_url, 28 const OsrRendererSettings& settings); 29 ~BrowserWindowOsrMac(); 30 31 // BrowserWindow methods. 32 void CreateBrowser(ClientWindowHandle parent_handle, 33 const CefRect& rect, 34 const CefBrowserSettings& settings, 35 CefRefPtr<CefDictionaryValue> extra_info, 36 CefRefPtr<CefRequestContext> request_context) override; 37 void GetPopupConfig(CefWindowHandle temp_handle, 38 CefWindowInfo& windowInfo, 39 CefRefPtr<CefClient>& client, 40 CefBrowserSettings& settings) override; 41 void ShowPopup(ClientWindowHandle parent_handle, 42 int x, 43 int y, 44 size_t width, 45 size_t height) override; 46 void Show() override; 47 void Hide() override; 48 void SetBounds(int x, int y, size_t width, size_t height) override; 49 void SetFocus(bool focus) override; 50 void SetDeviceScaleFactor(float device_scale_factor) override; 51 float GetDeviceScaleFactor() const override; 52 ClientWindowHandle GetWindowHandle() const override; 53 54 // ClientHandlerOsr::OsrDelegate methods. 55 void OnAfterCreated(CefRefPtr<CefBrowser> browser) override; 56 void OnBeforeClose(CefRefPtr<CefBrowser> browser) override; 57 bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override; 58 void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override; 59 bool GetScreenPoint(CefRefPtr<CefBrowser> browser, 60 int viewX, 61 int viewY, 62 int& screenX, 63 int& screenY) override; 64 bool GetScreenInfo(CefRefPtr<CefBrowser> browser, 65 CefScreenInfo& screen_info) override; 66 void OnPopupShow(CefRefPtr<CefBrowser> browser, bool show) override; 67 void OnPopupSize(CefRefPtr<CefBrowser> browser, const CefRect& rect) override; 68 void OnPaint(CefRefPtr<CefBrowser> browser, 69 CefRenderHandler::PaintElementType type, 70 const CefRenderHandler::RectList& dirtyRects, 71 const void* buffer, 72 int width, 73 int height) override; 74 void OnCursorChange(CefRefPtr<CefBrowser> browser, 75 CefCursorHandle cursor, 76 cef_cursor_type_t type, 77 const CefCursorInfo& custom_cursor_info) override; 78 bool StartDragging(CefRefPtr<CefBrowser> browser, 79 CefRefPtr<CefDragData> drag_data, 80 CefRenderHandler::DragOperationsMask allowed_ops, 81 int x, 82 int y) override; 83 void UpdateDragCursor(CefRefPtr<CefBrowser> browser, 84 CefRenderHandler::DragOperation operation) override; 85 void OnImeCompositionRangeChanged( 86 CefRefPtr<CefBrowser> browser, 87 const CefRange& selection_range, 88 const CefRenderHandler::RectList& character_bounds) override; 89 90 void UpdateAccessibilityTree(CefRefPtr<CefValue> value) override; 91 void UpdateAccessibilityLocation(CefRefPtr<CefValue> value) override; 92 93 private: 94 std::unique_ptr<BrowserWindowOsrMacImpl> impl_; 95 96 DISALLOW_COPY_AND_ASSIGN(BrowserWindowOsrMac); 97 98 friend class BrowserWindowOsrMacImpl; 99 }; 100 101 } // namespace client 102 103 #endif // CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_OSR_MAC_H_ 104