• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_WIN_H_
6 #define CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_OSR_WIN_H_
7 #pragma once
8 
9 #include "tests/cefclient/browser/browser_window.h"
10 #include "tests/cefclient/browser/osr_window_win.h"
11 
12 namespace client {
13 
14 // Represents a native child window hosting a single off-screen browser
15 // instance. The methods of this class must be called on the main thread unless
16 // otherwise indicated.
17 class BrowserWindowOsrWin : public BrowserWindow,
18                             public OsrWindowWin::Delegate {
19  public:
20   // Constructor may be called on any thread.
21   // |delegate| must outlive this object.
22   BrowserWindowOsrWin(BrowserWindow::Delegate* delegate,
23                       const std::string& startup_url,
24                       const OsrRendererSettings& settings);
25 
26   // BrowserWindow methods.
27   void CreateBrowser(ClientWindowHandle parent_handle,
28                      const CefRect& rect,
29                      const CefBrowserSettings& settings,
30                      CefRefPtr<CefDictionaryValue> extra_info,
31                      CefRefPtr<CefRequestContext> request_context) override;
32   void GetPopupConfig(CefWindowHandle temp_handle,
33                       CefWindowInfo& windowInfo,
34                       CefRefPtr<CefClient>& client,
35                       CefBrowserSettings& settings) override;
36   void ShowPopup(ClientWindowHandle parent_handle,
37                  int x,
38                  int y,
39                  size_t width,
40                  size_t height) override;
41   void Show() override;
42   void Hide() override;
43   void SetBounds(int x, int y, size_t width, size_t height) override;
44   void SetFocus(bool focus) override;
45   void SetDeviceScaleFactor(float device_scale_factor) override;
46   float GetDeviceScaleFactor() const override;
47   ClientWindowHandle GetWindowHandle() const override;
48 
49  private:
50   // ClienHandler::Delegate methods.
51   void OnBrowserClosed(CefRefPtr<CefBrowser> browser) override;
52 
53   // OsrWindowWin::Delegate methods.
54   void OnOsrNativeWindowCreated(HWND hwnd) override;
55 
56   // The below members are only accessed on the main thread.
57   scoped_refptr<OsrWindowWin> osr_window_;
58   HWND osr_hwnd_;
59 
60   float device_scale_factor_;
61 
62   DISALLOW_COPY_AND_ASSIGN(BrowserWindowOsrWin);
63 };
64 
65 }  // namespace client
66 
67 #endif  // CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_OSR_WIN_H_
68