mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Create a ChromeBrowserHostImpl for every Chrome tab (see issue #2969)
The Browser object represents the top-level Chrome browser window. One or more tabs (WebContents) are then owned by the Browser object via TabStripModel. A new Browser object can be created programmatically using "new Browser" or Browser::Create, or as a result of user action such as dragging a tab out of an existing window. New or existing tabs can also be added to an already existing Browser object. The Browser object acts as the WebContentsDelegate for all attached tabs. CEF integration requires WebContentsDelegate callbacks and notification of tab attach/detach. To support this integration we add a cef::BrowserDelegate (ChromeBrowserDelegate) member that is created in the Browser constructor and receives delegation for the Browser callbacks. ChromeBrowserDelegate creates a new ChromeBrowserHostImpl when a tab is added to a Browser for the first time, and that ChromeBrowserHostImpl continues to exist until the tab's WebContents is destroyed. The associated WebContents object does not change, but the Browser object will change when the tab is dragged between windows. CEF callback logic is shared between the chrome and alloy runtimes where possible. This shared logic has been extracted from CefBrowserHostImpl to create new CefBrowserHostBase and CefBrowserContentsDelegate classes. The CefBrowserHostImpl class is now only used with the alloy runtime and will be renamed to AlloyBrowserHostImpl in a future commit.
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
// Copyright 2020 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.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_
|
||||
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
|
||||
class Browser;
|
||||
|
||||
// Implementation of Chrome-based browser functionality.
|
||||
class CefBrowserPlatformDelegateChrome : public CefBrowserPlatformDelegate {
|
||||
public:
|
||||
explicit CefBrowserPlatformDelegateChrome(SkColor background_color);
|
||||
|
||||
// CefBrowserPlatformDelegate overrides.
|
||||
content::WebContents* CreateWebContents(
|
||||
CefBrowserHostImpl::CreateParams& create_params,
|
||||
bool& own_web_contents) override;
|
||||
void WebContentsDestroyed(content::WebContents* web_contents) override;
|
||||
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
|
||||
bool CreateHostWindow() override;
|
||||
void CloseHostWindow() override;
|
||||
CefWindowHandle GetHostWindowHandle() const override;
|
||||
SkColor GetBackgroundColor() const override;
|
||||
void WasResized() override;
|
||||
void SendKeyEvent(const CefKeyEvent& event) override;
|
||||
void SendMouseClickEvent(const CefMouseEvent& event,
|
||||
CefBrowserHost::MouseButtonType type,
|
||||
bool mouseUp,
|
||||
int clickCount) override;
|
||||
void SendMouseMoveEvent(const CefMouseEvent& event, bool mouseLeave) override;
|
||||
void SendMouseWheelEvent(const CefMouseEvent& event,
|
||||
int deltaX,
|
||||
int deltaY) override;
|
||||
void SendTouchEvent(const CefTouchEvent& event) override;
|
||||
void SendFocusEvent(bool setFocus) override;
|
||||
gfx::Point GetScreenPoint(const gfx::Point& view) const override;
|
||||
void ViewText(const std::string& text) override;
|
||||
bool HandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
CefEventHandle GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const override;
|
||||
std::unique_ptr<CefMenuRunner> CreateMenuRunner() override;
|
||||
bool IsWindowless() const override;
|
||||
bool IsViewsHosted() const override;
|
||||
|
||||
private:
|
||||
const SkColor background_color_;
|
||||
|
||||
Browser* chrome_browser_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_BROWSER_PLATFORM_DELEGATE_CHROME_H_
|
Reference in New Issue
Block a user