2012-04-03 03:34:16 +02:00
|
|
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_HOST_IMPL_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_HOST_IMPL_H_
|
2012-04-03 03:34:16 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "base/synchronization/lock.h"
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/include/cef_browser.h"
|
|
|
|
#include "cef/include/cef_client.h"
|
|
|
|
#include "cef/include/cef_frame.h"
|
|
|
|
#include "cef/libcef/browser/browser_host_base.h"
|
|
|
|
#include "cef/libcef/browser/browser_info.h"
|
|
|
|
#include "cef/libcef/browser/frame_host_impl.h"
|
|
|
|
#include "cef/libcef/browser/menu_manager.h"
|
|
|
|
#include "cef/libcef/browser/request_context_impl.h"
|
2012-04-04 20:18:09 +02:00
|
|
|
#include "content/public/browser/web_contents.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "content/public/browser/web_contents_delegate.h"
|
|
|
|
#include "content/public/browser/web_contents_observer.h"
|
2024-04-30 03:09:17 +02:00
|
|
|
|
2020-05-01 20:18:18 +02:00
|
|
|
class CefAudioCapturer;
|
2012-12-30 12:17:49 +01:00
|
|
|
class CefBrowserInfo;
|
2012-04-03 03:34:16 +02:00
|
|
|
class SiteInstance;
|
|
|
|
|
2024-06-26 02:12:37 +02:00
|
|
|
// CefBrowser implementation for Alloy style. Method calls are delegated to the
|
|
|
|
// CefPlatformDelegate or the WebContents as appropriate. All methods are
|
2020-09-18 00:24:08 +02:00
|
|
|
// thread-safe unless otherwise indicated.
|
2012-04-03 03:34:16 +02:00
|
|
|
//
|
2012-04-04 20:18:09 +02:00
|
|
|
// WebContentsDelegate: Interface for handling WebContents delegations. There is
|
2020-09-22 21:54:02 +02:00
|
|
|
// a one-to-one relationship between AlloyBrowserHostImpl and WebContents
|
2012-04-03 03:34:16 +02:00
|
|
|
// instances.
|
|
|
|
//
|
2012-04-04 20:18:09 +02:00
|
|
|
// WebContentsObserver: Interface for observing WebContents notifications and
|
|
|
|
// IPC messages. There is a one-to-one relationship between WebContents and
|
2012-04-03 03:34:16 +02:00
|
|
|
// RenderViewHost instances. IPC messages received by the RenderViewHost will be
|
2012-04-04 20:18:09 +02:00
|
|
|
// forwarded to this WebContentsObserver implementation via WebContents. IPC
|
2020-09-22 21:54:02 +02:00
|
|
|
// messages sent using AlloyBrowserHostImpl::Send() will be forwarded to the
|
2012-04-03 03:34:16 +02:00
|
|
|
// RenderViewHost (after posting to the UI thread if necessary). Use
|
|
|
|
// WebContentsObserver::routing_id() when sending IPC messages.
|
2020-09-22 21:54:02 +02:00
|
|
|
class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
|
|
|
public content::WebContentsDelegate,
|
2020-09-25 03:40:47 +02:00
|
|
|
public content::WebContentsObserver {
|
2012-04-03 03:34:16 +02:00
|
|
|
public:
|
|
|
|
// Used for handling the response to command messages.
|
2017-02-09 23:07:43 +01:00
|
|
|
class CommandResponseHandler : public virtual CefBaseRefCounted {
|
2012-04-03 03:34:16 +02:00
|
|
|
public:
|
2017-05-17 11:29:28 +02:00
|
|
|
virtual void OnResponse(const std::string& response) = 0;
|
2012-04-03 03:34:16 +02:00
|
|
|
};
|
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
~AlloyBrowserHostImpl() override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
// Create a new AlloyBrowserHostImpl instance with owned WebContents.
|
2020-09-25 03:40:47 +02:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> Create(
|
|
|
|
CefBrowserCreateParams& create_params);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2024-04-17 18:01:26 +02:00
|
|
|
// Safe (checked) conversion from CefBrowserHostBase to AlloyBrowserHostImpl.
|
|
|
|
// Use this method instead of static_cast.
|
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> FromBaseChecked(
|
|
|
|
CefRefPtr<CefBrowserHostBase> host_base);
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// Returns the browser associated with the specified RenderViewHost.
|
2020-09-22 21:54:02 +02:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForHost(
|
2012-04-03 03:34:16 +02:00
|
|
|
const content::RenderViewHost* host);
|
2014-01-02 23:41:11 +01:00
|
|
|
// Returns the browser associated with the specified RenderFrameHost.
|
2020-09-22 21:54:02 +02:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForHost(
|
2014-01-02 23:41:11 +01:00
|
|
|
const content::RenderFrameHost* host);
|
2012-04-03 03:34:16 +02:00
|
|
|
// Returns the browser associated with the specified WebContents.
|
2020-09-22 21:54:02 +02:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForContents(
|
2015-07-16 23:40:01 +02:00
|
|
|
const content::WebContents* contents);
|
2021-08-19 23:07:44 +02:00
|
|
|
// Returns the browser associated with the specified global ID.
|
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForGlobalId(
|
|
|
|
const content::GlobalRenderFrameHostId& global_id);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// CefBrowserHost methods.
|
2014-11-12 20:25:15 +01:00
|
|
|
void CloseBrowser(bool force_close) override;
|
2016-01-19 21:09:01 +01:00
|
|
|
bool TryCloseBrowser() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
CefWindowHandle GetWindowHandle() override;
|
|
|
|
CefWindowHandle GetOpenerWindowHandle() override;
|
2022-02-17 19:17:29 +01:00
|
|
|
void Find(const CefString& searchText,
|
2017-05-17 11:29:28 +02:00
|
|
|
bool forward,
|
|
|
|
bool matchCase,
|
|
|
|
bool findNext) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void StopFinding(bool clearSelection) override;
|
|
|
|
bool IsWindowRenderingDisabled() override;
|
|
|
|
void WasResized() override;
|
|
|
|
void WasHidden(bool hidden) override;
|
|
|
|
void NotifyScreenInfoChanged() override;
|
|
|
|
void Invalidate(PaintElementType type) override;
|
2018-07-03 02:46:03 +02:00
|
|
|
void SendExternalBeginFrame() override;
|
2019-02-25 22:17:28 +01:00
|
|
|
void SendTouchEvent(const CefTouchEvent& event) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void SendCaptureLostEvent() override;
|
2015-05-13 17:43:50 +02:00
|
|
|
int GetWindowlessFrameRate() override;
|
|
|
|
void SetWindowlessFrameRate(int frame_rate) override;
|
2016-10-28 18:11:24 +02:00
|
|
|
void ImeSetComposition(const CefString& text,
|
|
|
|
const std::vector<CefCompositionUnderline>& underlines,
|
|
|
|
const CefRange& replacement_range,
|
|
|
|
const CefRange& selection_range) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void ImeCommitText(const CefString& text,
|
|
|
|
const CefRange& replacement_range,
|
2016-10-28 18:11:24 +02:00
|
|
|
int relative_cursor_pos) override;
|
|
|
|
void ImeFinishComposingText(bool keep_selection) override;
|
|
|
|
void ImeCancelComposition() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
|
|
|
|
const CefMouseEvent& event,
|
|
|
|
DragOperationsMask allowed_ops) override;
|
|
|
|
void DragTargetDragOver(const CefMouseEvent& event,
|
|
|
|
DragOperationsMask allowed_ops) override;
|
|
|
|
void DragTargetDragLeave() override;
|
|
|
|
void DragTargetDrop(const CefMouseEvent& event) override;
|
|
|
|
void DragSourceSystemDragEnded() override;
|
|
|
|
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
|
2019-02-26 17:44:17 +01:00
|
|
|
void SetAudioMuted(bool mute) override;
|
|
|
|
bool IsAudioMuted() override;
|
2017-08-04 00:55:19 +02:00
|
|
|
void SetAutoResizeEnabled(bool enabled,
|
|
|
|
const CefSize& min_size,
|
|
|
|
const CefSize& max_size) override;
|
2023-11-14 18:16:43 +01:00
|
|
|
bool CanExecuteChromeCommand(int command_id) override;
|
|
|
|
void ExecuteChromeCommand(int command_id,
|
|
|
|
cef_window_open_disposition_t disposition) override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2024-04-17 18:01:26 +02:00
|
|
|
// CefBrowserHostBase methods:
|
2021-04-18 03:12:54 +02:00
|
|
|
bool IsWindowless() const override;
|
2024-04-17 18:01:26 +02:00
|
|
|
bool IsAlloyStyle() const override { return true; }
|
2022-06-02 11:49:50 +02:00
|
|
|
bool IsVisible() const override;
|
|
|
|
|
2019-10-15 13:11:59 +02:00
|
|
|
// Returns true if this browser supports picture-in-picture.
|
|
|
|
bool IsPictureInPictureSupported() const;
|
|
|
|
|
2013-03-19 23:59:33 +01:00
|
|
|
// Called when the OS window hosting the browser is destroyed.
|
2021-02-18 02:58:25 +01:00
|
|
|
void WindowDestroyed() override;
|
2012-11-21 01:40:15 +01:00
|
|
|
|
2022-06-02 11:49:50 +02:00
|
|
|
bool WillBeDestroyed() const override;
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// Destroy the browser members. This method should only be called after the
|
|
|
|
// native browser window is not longer processing messages.
|
2020-09-18 00:24:08 +02:00
|
|
|
void DestroyBrowser() override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
// Cancel display of the context menu, if any.
|
|
|
|
void CancelContextMenu();
|
|
|
|
|
2020-09-25 03:40:47 +02:00
|
|
|
bool MaybeAllowNavigation(content::RenderFrameHost* opener,
|
|
|
|
const content::OpenURLParams& params) override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2022-05-13 13:38:41 +02:00
|
|
|
// Convert from view DIP coordinates to screen coordinates. If
|
|
|
|
// |want_dip_coords| is true return DIP instead of device (pixel) coordinates
|
|
|
|
// on Windows/Linux.
|
|
|
|
gfx::Point GetScreenPoint(const gfx::Point& view, bool want_dip_coords) const;
|
2015-11-17 19:20:13 +01:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void StartDragging(const content::DropData& drop_data,
|
2020-10-08 21:54:42 +02:00
|
|
|
blink::DragOperationsMask allowed_ops,
|
2017-05-17 11:29:28 +02:00
|
|
|
const gfx::ImageSkia& image,
|
|
|
|
const gfx::Vector2d& image_offset,
|
2020-10-08 21:54:42 +02:00
|
|
|
const blink::mojom::DragEventSourceInfo& event_info,
|
2017-05-17 11:29:28 +02:00
|
|
|
content::RenderWidgetHostImpl* source_rwh);
|
2023-10-19 20:08:48 +02:00
|
|
|
void UpdateDragOperation(ui::mojom::DragOperation operation,
|
|
|
|
bool document_is_handling_drag);
|
2016-11-23 21:54:29 +01:00
|
|
|
|
2020-09-18 00:24:08 +02:00
|
|
|
void OnSetFocus(cef_focus_source_t source) override;
|
2012-06-11 18:51:51 +02:00
|
|
|
|
2022-05-27 11:03:31 +02:00
|
|
|
bool ShowContextMenu(const content::ContextMenuParams& params);
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2013-03-19 23:59:33 +01:00
|
|
|
enum DestructionState {
|
|
|
|
DESTRUCTION_STATE_NONE = 0,
|
|
|
|
DESTRUCTION_STATE_PENDING,
|
|
|
|
DESTRUCTION_STATE_ACCEPTED,
|
|
|
|
DESTRUCTION_STATE_COMPLETED
|
|
|
|
};
|
|
|
|
DestructionState destruction_state() const { return destruction_state_; }
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// content::WebContentsDelegate methods.
|
2024-11-09 01:05:04 +01:00
|
|
|
void PrintCrossProcessSubframe(
|
|
|
|
content::WebContents* web_contents,
|
2024-10-22 22:05:16 +02:00
|
|
|
const gfx::Rect& rect,
|
|
|
|
int document_cookie,
|
|
|
|
content::RenderFrameHost* subframe_host) const override;
|
2014-11-12 20:25:15 +01:00
|
|
|
content::WebContents* OpenURLFromTab(
|
2012-04-03 03:34:16 +02:00
|
|
|
content::WebContents* source,
|
2024-04-23 22:06:00 +02:00
|
|
|
const content::OpenURLParams& params,
|
|
|
|
base::OnceCallback<void(content::NavigationHandle&)>
|
|
|
|
navigation_handle_callback) override;
|
2024-09-27 16:15:44 +02:00
|
|
|
content::WebContents* AddNewContents(
|
|
|
|
content::WebContents* source,
|
|
|
|
std::unique_ptr<content::WebContents> new_contents,
|
|
|
|
const GURL& target_url,
|
|
|
|
WindowOpenDisposition disposition,
|
|
|
|
const blink::mojom::WindowFeatures& window_features,
|
|
|
|
bool user_gesture,
|
|
|
|
bool* was_blocked) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void LoadingStateChanged(content::WebContents* source,
|
2021-12-16 23:35:54 +01:00
|
|
|
bool should_show_loading_ui) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void CloseContents(content::WebContents* source) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
2016-11-23 21:54:29 +01:00
|
|
|
bool DidAddMessageToConsole(content::WebContents* source,
|
2019-07-16 19:59:21 +02:00
|
|
|
blink::mojom::ConsoleMessageLevel log_level,
|
2021-04-21 00:52:34 +02:00
|
|
|
const std::u16string& message,
|
2016-11-23 21:54:29 +01:00
|
|
|
int32_t line_no,
|
2021-04-21 00:52:34 +02:00
|
|
|
const std::u16string& source_id) override;
|
2023-10-05 01:46:45 +02:00
|
|
|
void ContentsZoomChange(bool zoom_in) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void BeforeUnloadFired(content::WebContents* source,
|
|
|
|
bool proceed,
|
|
|
|
bool* proceed_to_fire_unload) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
bool TakeFocus(content::WebContents* source, bool reverse) override;
|
2022-03-22 22:40:28 +01:00
|
|
|
void CanDownload(const GURL& url,
|
|
|
|
const std::string& request_method,
|
|
|
|
base::OnceCallback<void(bool)> callback) override;
|
2017-04-20 21:28:17 +02:00
|
|
|
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
|
2012-08-29 00:26:35 +02:00
|
|
|
content::WebContents* source,
|
2024-06-14 19:01:45 +02:00
|
|
|
const input::NativeWebKeyboardEvent& event) override;
|
|
|
|
bool HandleKeyboardEvent(content::WebContents* source,
|
|
|
|
const input::NativeWebKeyboardEvent& event) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
bool CanDragEnter(content::WebContents* source,
|
|
|
|
const content::DropData& data,
|
2020-10-08 21:54:42 +02:00
|
|
|
blink::DragOperationsMask operations_allowed) override;
|
2017-02-10 23:44:11 +01:00
|
|
|
void GetCustomWebContentsView(
|
2014-07-01 00:30:29 +02:00
|
|
|
content::WebContents* web_contents,
|
|
|
|
const GURL& target_url,
|
2017-03-15 23:04:16 +01:00
|
|
|
int opener_render_process_id,
|
|
|
|
int opener_render_frame_id,
|
2024-06-21 17:26:59 +02:00
|
|
|
raw_ptr<content::WebContentsView>* view,
|
|
|
|
raw_ptr<content::RenderViewHostDelegateView>* delegate_view) override;
|
2017-07-27 01:19:27 +02:00
|
|
|
void WebContentsCreated(content::WebContents* source_contents,
|
|
|
|
int opener_render_process_id,
|
|
|
|
int opener_render_frame_id,
|
|
|
|
const std::string& frame_name,
|
|
|
|
const GURL& target_url,
|
|
|
|
content::WebContents* new_contents) override;
|
2024-03-12 20:47:10 +01:00
|
|
|
void RendererUnresponsive(
|
|
|
|
content::WebContents* source,
|
|
|
|
content::RenderWidgetHost* render_widget_host,
|
|
|
|
base::RepeatingClosure hang_monitor_restarter) override;
|
|
|
|
void RendererResponsive(
|
|
|
|
content::WebContents* source,
|
|
|
|
content::RenderWidgetHost* render_widget_host) override;
|
2014-12-13 21:18:31 +01:00
|
|
|
content::JavaScriptDialogManager* GetJavaScriptDialogManager(
|
|
|
|
content::WebContents* source) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
2020-08-29 00:39:23 +02:00
|
|
|
scoped_refptr<content::FileSelectListener> listener,
|
2018-10-02 14:14:11 +02:00
|
|
|
const blink::mojom::FileChooserParams& params) override;
|
2018-05-20 15:51:42 +02:00
|
|
|
void EnterFullscreenModeForTab(
|
2020-07-08 19:23:29 +02:00
|
|
|
content::RenderFrameHost* requesting_frame,
|
2019-11-12 17:11:44 +01:00
|
|
|
const blink::mojom::FullscreenOptions& options) override;
|
2015-06-05 00:33:24 +02:00
|
|
|
void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
|
|
|
|
bool IsFullscreenForTabOrPending(
|
2019-09-04 17:13:32 +02:00
|
|
|
const content::WebContents* web_contents) override;
|
2019-11-12 17:11:44 +01:00
|
|
|
blink::mojom::DisplayMode GetDisplayMode(
|
2019-09-04 17:13:32 +02:00
|
|
|
const content::WebContents* web_contents) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void FindReply(content::WebContents* web_contents,
|
|
|
|
int request_id,
|
|
|
|
int number_of_matches,
|
|
|
|
const gfx::Rect& selection_rect,
|
|
|
|
int active_match_ordinal,
|
|
|
|
bool final_update) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void UpdatePreferredSize(content::WebContents* source,
|
2015-06-05 00:33:24 +02:00
|
|
|
const gfx::Size& pref_size) override;
|
2017-08-04 00:55:19 +02:00
|
|
|
void ResizeDueToAutoResize(content::WebContents* source,
|
|
|
|
const gfx::Size& new_size) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void RequestMediaAccessPermission(
|
2012-06-22 00:50:34 +02:00
|
|
|
content::WebContents* web_contents,
|
2013-01-15 20:12:28 +01:00
|
|
|
const content::MediaStreamRequest& request,
|
2018-06-19 00:08:20 +02:00
|
|
|
content::MediaResponseCallback callback) override;
|
2018-04-19 17:44:42 +02:00
|
|
|
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
|
2023-12-06 21:16:15 +01:00
|
|
|
const url::Origin& security_origin,
|
2019-09-04 17:13:32 +02:00
|
|
|
blink::mojom::MediaStreamType type) override;
|
2019-10-15 13:11:59 +02:00
|
|
|
content::PictureInPictureResult EnterPictureInPicture(
|
2022-02-21 23:23:40 +01:00
|
|
|
content::WebContents* web_contents) override;
|
2019-10-15 13:11:59 +02:00
|
|
|
void ExitPictureInPicture() override;
|
2024-06-14 19:01:45 +02:00
|
|
|
bool IsBackForwardCacheSupported(content::WebContents& web_contents) override;
|
2023-01-30 18:43:54 +01:00
|
|
|
content::PreloadingEligibility IsPrerender2Supported(
|
|
|
|
content::WebContents& web_contents) override;
|
2024-04-23 22:06:00 +02:00
|
|
|
void DraggableRegionsChanged(
|
|
|
|
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
|
|
|
|
content::WebContents* contents) override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// content::WebContentsObserver methods.
|
2013-07-19 01:25:28 +02:00
|
|
|
using content::WebContentsObserver::BeforeUnloadFired;
|
2017-03-03 23:37:23 +01:00
|
|
|
void DidFinishNavigation(
|
|
|
|
content::NavigationHandle* navigation_handle) override;
|
2020-05-01 20:18:18 +02:00
|
|
|
void OnAudioStateChanged(bool audible) override;
|
2017-05-12 20:28:25 +02:00
|
|
|
void AccessibilityEventReceived(
|
2024-05-23 03:52:35 +02:00
|
|
|
const ui::AXUpdatesAndEvents& details) override;
|
2017-05-12 20:28:25 +02:00
|
|
|
void AccessibilityLocationChangesReceived(
|
2024-10-24 17:05:31 +02:00
|
|
|
const ui::AXTreeID& tree_id,
|
|
|
|
ui::AXLocationAndScrollUpdates& details) override;
|
2020-07-04 04:51:17 +02:00
|
|
|
void WebContentsDestroyed() override;
|
2017-10-20 19:45:20 +02:00
|
|
|
|
2014-07-08 00:17:33 +02:00
|
|
|
private:
|
2020-07-04 20:21:34 +02:00
|
|
|
friend class CefBrowserPlatformDelegateAlloy;
|
2020-07-03 22:13:27 +02:00
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> CreateInternal(
|
2014-07-08 00:17:33 +02:00
|
|
|
const CefBrowserSettings& settings,
|
|
|
|
CefRefPtr<CefClient> client,
|
|
|
|
content::WebContents* web_contents,
|
2018-05-18 12:45:18 +02:00
|
|
|
bool own_web_contents,
|
2014-07-08 00:17:33 +02:00
|
|
|
scoped_refptr<CefBrowserInfo> browser_info,
|
2020-09-22 21:54:02 +02:00
|
|
|
CefRefPtr<AlloyBrowserHostImpl> opener,
|
2016-01-19 21:09:01 +01:00
|
|
|
bool is_devtools_popup,
|
2019-03-24 00:40:32 +01:00
|
|
|
CefRefPtr<CefRequestContextImpl> request_context,
|
2024-06-26 02:12:37 +02:00
|
|
|
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate);
|
2014-07-08 00:17:33 +02:00
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
AlloyBrowserHostImpl(
|
2017-05-17 11:29:28 +02:00
|
|
|
const CefBrowserSettings& settings,
|
|
|
|
CefRefPtr<CefClient> client,
|
|
|
|
content::WebContents* web_contents,
|
|
|
|
scoped_refptr<CefBrowserInfo> browser_info,
|
2020-09-22 21:54:02 +02:00
|
|
|
CefRefPtr<AlloyBrowserHostImpl> opener,
|
2019-03-24 00:40:32 +01:00
|
|
|
CefRefPtr<CefRequestContextImpl> request_context,
|
2024-06-26 02:12:37 +02:00
|
|
|
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate);
|
2015-11-17 19:20:13 +01:00
|
|
|
|
|
|
|
// Give the platform delegate an opportunity to create the host window.
|
|
|
|
bool CreateHostWindow();
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2020-05-01 20:18:18 +02:00
|
|
|
void StartAudioCapturer();
|
|
|
|
void OnRecentlyAudibleTimerFired();
|
|
|
|
|
2024-11-09 01:05:04 +01:00
|
|
|
CefWindowHandle opener_window_handle_ = kNullWindowHandle;
|
2016-02-29 21:23:44 +01:00
|
|
|
const bool is_windowless_;
|
2020-06-13 02:54:08 +02:00
|
|
|
CefWindowHandle host_window_handle_ = kNullWindowHandle;
|
2018-05-18 12:45:18 +02:00
|
|
|
|
2013-03-19 23:59:33 +01:00
|
|
|
// Represents the current browser destruction state. Only accessed on the UI
|
|
|
|
// thread.
|
2020-06-13 02:54:08 +02:00
|
|
|
DestructionState destruction_state_ = DESTRUCTION_STATE_NONE;
|
2013-03-19 23:59:33 +01:00
|
|
|
|
|
|
|
// True if the OS window hosting the browser has been destroyed. Only accessed
|
|
|
|
// on the UI thread.
|
2020-06-13 02:54:08 +02:00
|
|
|
bool window_destroyed_ = false;
|
2013-03-19 23:59:33 +01:00
|
|
|
|
2012-04-19 22:31:46 +02:00
|
|
|
// Used for creating and managing context menus.
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<CefMenuManager> menu_manager_;
|
2012-04-19 22:31:46 +02:00
|
|
|
|
2020-05-01 20:18:18 +02:00
|
|
|
// Used for capturing audio for CefAudioHandler.
|
|
|
|
std::unique_ptr<CefAudioCapturer> audio_capturer_;
|
|
|
|
|
|
|
|
// Timer for determining when "recently audible" transitions to false. This
|
|
|
|
// starts running when a tab stops being audible, and is canceled if it starts
|
|
|
|
// being audible again before it fires.
|
2022-01-25 22:15:23 +01:00
|
|
|
std::unique_ptr<base::OneShotTimer> recently_audible_timer_;
|
2012-04-03 03:34:16 +02:00
|
|
|
};
|
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_HOST_IMPL_H_
|