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_ROOT_WINDOW_MAC_H_ 6 #define CEF_TESTS_CEFCLIENT_BROWSER_ROOT_WINDOW_MAC_H_ 7 #pragma once 8 9 #include <memory> 10 #include <string> 11 12 #include "tests/cefclient/browser/browser_window.h" 13 #include "tests/cefclient/browser/root_window.h" 14 15 namespace client { 16 17 class RootWindowMacImpl; 18 19 // OS X implementation of a top-level native window in the browser process. 20 // The methods of this class must be called on the main thread unless otherwise 21 // indicated. 22 class RootWindowMac : public RootWindow, public BrowserWindow::Delegate { 23 public: 24 // Constructor may be called on any thread. 25 RootWindowMac(); 26 ~RootWindowMac(); 27 28 BrowserWindow* browser_window() const; 29 RootWindow::Delegate* delegate() const; 30 31 // RootWindow methods. 32 void Init(RootWindow::Delegate* delegate, 33 std::unique_ptr<RootWindowConfig> config, 34 const CefBrowserSettings& settings) override; 35 void InitAsPopup(RootWindow::Delegate* delegate, 36 bool with_controls, 37 bool with_osr, 38 const CefPopupFeatures& popupFeatures, 39 CefWindowInfo& windowInfo, 40 CefRefPtr<CefClient>& client, 41 CefBrowserSettings& settings) override; 42 void Show(ShowMode mode) override; 43 void Hide() override; 44 void SetBounds(int x, int y, size_t width, size_t height) override; 45 void Close(bool force) override; 46 void SetDeviceScaleFactor(float device_scale_factor) override; 47 float GetDeviceScaleFactor() const override; 48 CefRefPtr<CefBrowser> GetBrowser() const override; 49 ClientWindowHandle GetWindowHandle() const override; 50 bool WithWindowlessRendering() const override; 51 bool WithExtension() const override; 52 53 // BrowserWindow::Delegate methods. 54 void OnBrowserCreated(CefRefPtr<CefBrowser> browser) override; 55 void OnBrowserWindowDestroyed() override; 56 void OnSetAddress(const std::string& url) override; 57 void OnSetTitle(const std::string& title) override; 58 void OnSetFullscreen(bool fullscreen) override; 59 void OnAutoResize(const CefSize& new_size) override; 60 void OnSetLoadingState(bool isLoading, 61 bool canGoBack, 62 bool canGoForward) override; 63 void OnSetDraggableRegions( 64 const std::vector<CefDraggableRegion>& regions) override; 65 66 void OnNativeWindowClosed(); 67 68 private: 69 CefRefPtr<RootWindowMacImpl> impl_; 70 71 DISALLOW_COPY_AND_ASSIGN(RootWindowMac); 72 73 friend class RootWindowMacImpl; 74 }; 75 76 } // namespace client 77 78 #endif // CEF_TESTS_CEFCLIENT_BROWSER_ROOT_WINDOW_MAC_H_ 79