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 "include/cef_browser.h"
|
|
|
|
#include "include/cef_client.h"
|
|
|
|
#include "include/cef_frame.h"
|
2020-09-18 00:24:08 +02:00
|
|
|
#include "libcef/browser/browser_host_base.h"
|
2015-10-21 20:17:09 +02:00
|
|
|
#include "libcef/browser/browser_info.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "libcef/browser/frame_host_impl.h"
|
2013-02-23 01:43:28 +01:00
|
|
|
#include "libcef/browser/javascript_dialog_manager.h"
|
2015-11-17 19:20:13 +01:00
|
|
|
#include "libcef/browser/menu_manager.h"
|
2019-03-24 00:40:32 +01:00
|
|
|
#include "libcef/browser/request_context_impl.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
#include "base/synchronization/lock.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"
|
2021-04-21 00:52:34 +02:00
|
|
|
#include "extensions/common/mojom/view_type.mojom-forward.h"
|
2012-11-21 01:40:15 +01: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;
|
|
|
|
|
2020-09-18 00:24:08 +02:00
|
|
|
// CefBrowser implementation for the alloy runtime. Method calls are delegated
|
|
|
|
// to the CefPlatformDelegate or the WebContents as appropriate. All methods are
|
|
|
|
// 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
|
|
|
|
|
|
|
// 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;
|
|
|
|
double GetZoomLevel() override;
|
|
|
|
void SetZoomLevel(double zoomLevel) 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;
|
|
|
|
void ShowDevTools(const CefWindowInfo& windowInfo,
|
|
|
|
CefRefPtr<CefClient> client,
|
|
|
|
const CefBrowserSettings& settings,
|
|
|
|
const CefPoint& inspect_element_at) override;
|
|
|
|
void CloseDevTools() override;
|
2016-06-10 20:33:07 +02:00
|
|
|
bool HasDevTools() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
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-05-12 20:28:25 +02:00
|
|
|
void SetAccessibilityState(cef_state_t accessibility_state) override;
|
2017-08-04 00:55:19 +02:00
|
|
|
void SetAutoResizeEnabled(bool enabled,
|
|
|
|
const CefSize& min_size,
|
|
|
|
const CefSize& max_size) override;
|
|
|
|
CefRefPtr<CefExtension> GetExtension() override;
|
|
|
|
bool IsBackgroundHost() override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
// Returns true if windowless rendering is enabled.
|
2021-04-18 03:12:54 +02:00
|
|
|
bool IsWindowless() const override;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
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,
|
|
|
|
bool is_guest_view,
|
|
|
|
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);
|
2021-01-28 00:13:12 +01:00
|
|
|
void UpdateDragCursor(ui::mojom::DragOperation operation);
|
2016-11-23 21:54:29 +01:00
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
// Accessors that must be called on the UI thread.
|
2020-07-03 22:13:27 +02:00
|
|
|
extensions::ExtensionHost* GetExtensionHost() const;
|
2017-08-04 00:55:19 +02: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.
|
2014-11-12 20:25:15 +01:00
|
|
|
content::WebContents* OpenURLFromTab(
|
2012-04-03 03:34:16 +02:00
|
|
|
content::WebContents* source,
|
2014-11-12 20:25:15 +01:00
|
|
|
const content::OpenURLParams& params) override;
|
2021-07-23 18:40:13 +02:00
|
|
|
bool ShouldAllowRendererInitiatedCrossProcessNavigation(
|
|
|
|
bool is_main_frame_navigation) override;
|
2017-08-04 00:55:19 +02:00
|
|
|
void AddNewContents(content::WebContents* source,
|
2018-05-18 12:45:18 +02:00
|
|
|
std::unique_ptr<content::WebContents> new_contents,
|
2020-06-09 19:48:00 +02:00
|
|
|
const GURL& target_url,
|
2017-08-04 00:55:19 +02:00
|
|
|
WindowOpenDisposition disposition,
|
2022-09-26 21:30:45 +02:00
|
|
|
const blink::mojom::WindowFeatures& window_features,
|
2017-08-04 00:55:19 +02:00
|
|
|
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;
|
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,
|
2017-04-20 21:28:17 +02:00
|
|
|
const content::NativeWebKeyboardEvent& event) override;
|
2018-11-03 02:15:09 +01:00
|
|
|
bool HandleKeyboardEvent(
|
2012-08-29 00:26:35 +02:00
|
|
|
content::WebContents* source,
|
2014-11-12 20:25:15 +01:00
|
|
|
const content::NativeWebKeyboardEvent& event) override;
|
2017-08-04 00:55:19 +02:00
|
|
|
bool PreHandleGestureEvent(content::WebContents* source,
|
|
|
|
const blink::WebGestureEvent& 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,
|
2014-07-01 00:30:29 +02:00
|
|
|
content::WebContentsView** view,
|
2014-11-12 20:25:15 +01:00
|
|
|
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;
|
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,
|
2015-03-25 22:22:47 +01:00
|
|
|
const GURL& security_origin,
|
2019-09-04 17:13:32 +02:00
|
|
|
blink::mojom::MediaStreamType type) override;
|
2020-03-04 01:29:39 +01:00
|
|
|
bool IsNeverComposited(content::WebContents* web_contents) 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;
|
2021-09-15 19:38:44 +02:00
|
|
|
bool IsBackForwardCacheSupported() override;
|
2023-01-30 18:43:54 +01:00
|
|
|
content::PreloadingEligibility IsPrerender2Supported(
|
|
|
|
content::WebContents& web_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(
|
2018-06-08 18:53:10 +02:00
|
|
|
const content::AXEventNotificationDetails& content_event_bundle) override;
|
2017-05-12 20:28:25 +02:00
|
|
|
void AccessibilityLocationChangesReceived(
|
|
|
|
const std::vector<content::AXLocationChangeNotificationDetails>& locData)
|
|
|
|
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,
|
2017-08-04 00:55:19 +02:00
|
|
|
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
|
|
|
CefRefPtr<CefExtension> extension);
|
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,
|
2017-08-04 00:55:19 +02:00
|
|
|
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
|
|
|
CefRefPtr<CefExtension> extension);
|
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();
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
CefWindowHandle opener_;
|
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;
|
2020-07-03 22:13:27 +02:00
|
|
|
CefRefPtr<CefExtension> extension_;
|
|
|
|
bool is_background_host_ = false;
|
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-16 23:15:27 +02:00
|
|
|
// Used for creating and managing JavaScript dialogs.
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<CefJavaScriptDialogManager> javascript_dialog_manager_;
|
2012-04-16 23:15:27 +02: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_
|