2012-04-03 01:34:16 +00: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 15:54:02 -04:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_HOST_IMPL_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_HOST_IMPL_H_
|
2012-04-03 01:34:16 +00: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-17 18:24:08 -04:00
|
|
|
#include "libcef/browser/browser_host_base.h"
|
2015-10-21 14:17:09 -04:00
|
|
|
#include "libcef/browser/browser_info.h"
|
2015-11-17 13:20:13 -05:00
|
|
|
#include "libcef/browser/file_dialog_manager.h"
|
2012-04-03 01:34:16 +00:00
|
|
|
#include "libcef/browser/frame_host_impl.h"
|
2013-02-23 00:43:28 +00:00
|
|
|
#include "libcef/browser/javascript_dialog_manager.h"
|
2015-11-17 13:20:13 -05:00
|
|
|
#include "libcef/browser/menu_manager.h"
|
2019-03-23 19:40:32 -04:00
|
|
|
#include "libcef/browser/request_context_impl.h"
|
2012-04-03 01:34:16 +00:00
|
|
|
|
|
|
|
#include "base/synchronization/lock.h"
|
2012-04-04 18:18:09 +00:00
|
|
|
#include "content/public/browser/web_contents.h"
|
2012-04-03 01:34:16 +00:00
|
|
|
#include "content/public/browser/web_contents_delegate.h"
|
|
|
|
#include "content/public/browser/web_contents_observer.h"
|
2021-04-20 18:52:34 -04:00
|
|
|
#include "extensions/common/mojom/view_type.mojom-forward.h"
|
2012-11-21 00:40:15 +00:00
|
|
|
|
2020-05-01 18:18:18 +00:00
|
|
|
class CefAudioCapturer;
|
2012-12-30 11:17:49 +00:00
|
|
|
class CefBrowserInfo;
|
2012-04-03 01:34:16 +00:00
|
|
|
class SiteInstance;
|
|
|
|
|
2020-09-17 18:24:08 -04: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 01:34:16 +00:00
|
|
|
//
|
2012-04-04 18:18:09 +00:00
|
|
|
// WebContentsDelegate: Interface for handling WebContents delegations. There is
|
2020-09-22 15:54:02 -04:00
|
|
|
// a one-to-one relationship between AlloyBrowserHostImpl and WebContents
|
2012-04-03 01:34:16 +00:00
|
|
|
// instances.
|
|
|
|
//
|
2012-04-04 18:18:09 +00:00
|
|
|
// WebContentsObserver: Interface for observing WebContents notifications and
|
|
|
|
// IPC messages. There is a one-to-one relationship between WebContents and
|
2012-04-03 01:34:16 +00:00
|
|
|
// RenderViewHost instances. IPC messages received by the RenderViewHost will be
|
2012-04-04 18:18:09 +00:00
|
|
|
// forwarded to this WebContentsObserver implementation via WebContents. IPC
|
2020-09-22 15:54:02 -04:00
|
|
|
// messages sent using AlloyBrowserHostImpl::Send() will be forwarded to the
|
2012-04-03 01:34:16 +00:00
|
|
|
// RenderViewHost (after posting to the UI thread if necessary). Use
|
|
|
|
// WebContentsObserver::routing_id() when sending IPC messages.
|
2020-09-22 15:54:02 -04:00
|
|
|
class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
|
|
|
public content::WebContentsDelegate,
|
2020-09-24 21:40:47 -04:00
|
|
|
public content::WebContentsObserver {
|
2012-04-03 01:34:16 +00:00
|
|
|
public:
|
|
|
|
// Used for handling the response to command messages.
|
2017-02-09 17:07:43 -05:00
|
|
|
class CommandResponseHandler : public virtual CefBaseRefCounted {
|
2012-04-03 01:34:16 +00:00
|
|
|
public:
|
2017-05-17 11:29:28 +02:00
|
|
|
virtual void OnResponse(const std::string& response) = 0;
|
2012-04-03 01:34:16 +00:00
|
|
|
};
|
|
|
|
|
2020-09-22 15:54:02 -04:00
|
|
|
~AlloyBrowserHostImpl() override;
|
2012-04-03 01:34:16 +00:00
|
|
|
|
2020-09-22 15:54:02 -04:00
|
|
|
// Create a new AlloyBrowserHostImpl instance with owned WebContents.
|
2020-09-24 21:40:47 -04:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> Create(
|
|
|
|
CefBrowserCreateParams& create_params);
|
2012-04-03 01:34:16 +00:00
|
|
|
|
|
|
|
// Returns the browser associated with the specified RenderViewHost.
|
2020-09-22 15:54:02 -04:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForHost(
|
2012-04-03 01:34:16 +00:00
|
|
|
const content::RenderViewHost* host);
|
2014-01-02 22:41:11 +00:00
|
|
|
// Returns the browser associated with the specified RenderFrameHost.
|
2020-09-22 15:54:02 -04:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForHost(
|
2014-01-02 22:41:11 +00:00
|
|
|
const content::RenderFrameHost* host);
|
2012-04-03 01:34:16 +00:00
|
|
|
// Returns the browser associated with the specified WebContents.
|
2020-09-22 15:54:02 -04:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForContents(
|
2015-07-16 17:40:01 -04:00
|
|
|
const content::WebContents* contents);
|
2019-05-24 23:23:43 +03:00
|
|
|
// Returns the browser associated with the specified FrameTreeNode ID.
|
2020-09-22 15:54:02 -04:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForFrameTreeNode(
|
2017-10-26 14:17:00 -04:00
|
|
|
int frame_tree_node_id);
|
2014-01-02 22:41:11 +00:00
|
|
|
// Returns the browser associated with the specified frame routing IDs.
|
2020-09-22 15:54:02 -04:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForFrameRoute(
|
2017-05-17 11:29:28 +02:00
|
|
|
int render_process_id,
|
|
|
|
int render_routing_id);
|
2012-04-03 01:34:16 +00:00
|
|
|
|
|
|
|
// CefBrowserHost methods.
|
2014-11-12 19:25:15 +00:00
|
|
|
void CloseBrowser(bool force_close) override;
|
2016-01-19 15:09:01 -05:00
|
|
|
bool TryCloseBrowser() override;
|
2014-11-12 19:25:15 +00:00
|
|
|
void SetFocus(bool focus) override;
|
|
|
|
CefWindowHandle GetWindowHandle() override;
|
|
|
|
CefWindowHandle GetOpenerWindowHandle() override;
|
|
|
|
double GetZoomLevel() override;
|
|
|
|
void SetZoomLevel(double zoomLevel) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void RunFileDialog(FileDialogMode mode,
|
|
|
|
const CefString& title,
|
|
|
|
const CefString& default_file_path,
|
|
|
|
const std::vector<CefString>& accept_filters,
|
|
|
|
int selected_accept_filter,
|
|
|
|
CefRefPtr<CefRunFileDialogCallback> callback) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
void Print() override;
|
2015-03-24 18:40:08 +03:00
|
|
|
void PrintToPDF(const CefString& path,
|
|
|
|
const CefPdfPrintSettings& settings,
|
|
|
|
CefRefPtr<CefPdfPrintCallback> callback) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void Find(int identifier,
|
|
|
|
const CefString& searchText,
|
|
|
|
bool forward,
|
|
|
|
bool matchCase,
|
|
|
|
bool findNext) override;
|
2014-11-12 19:25:15 +00: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 14:33:07 -04:00
|
|
|
bool HasDevTools() override;
|
2014-11-12 19:25:15 +00:00
|
|
|
bool IsWindowRenderingDisabled() override;
|
|
|
|
void WasResized() override;
|
|
|
|
void WasHidden(bool hidden) override;
|
|
|
|
void NotifyScreenInfoChanged() override;
|
|
|
|
void Invalidate(PaintElementType type) override;
|
2018-07-02 19:46:03 -05:00
|
|
|
void SendExternalBeginFrame() override;
|
2019-02-25 16:17:28 -05:00
|
|
|
void SendTouchEvent(const CefTouchEvent& event) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
void SendFocusEvent(bool setFocus) override;
|
|
|
|
void SendCaptureLostEvent() override;
|
|
|
|
void NotifyMoveOrResizeStarted() override;
|
2015-05-13 11:43:50 -04:00
|
|
|
int GetWindowlessFrameRate() override;
|
|
|
|
void SetWindowlessFrameRate(int frame_rate) override;
|
2016-10-28 12:11:24 -04: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 12:11:24 -04:00
|
|
|
int relative_cursor_pos) override;
|
|
|
|
void ImeFinishComposingText(bool keep_selection) override;
|
|
|
|
void ImeCancelComposition() override;
|
2014-11-12 19:25:15 +00: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 16:44:17 +00:00
|
|
|
void SetAudioMuted(bool mute) override;
|
|
|
|
bool IsAudioMuted() override;
|
2017-05-12 18:28:25 +00:00
|
|
|
void SetAccessibilityState(cef_state_t accessibility_state) override;
|
2017-08-03 18:55:19 -04:00
|
|
|
void SetAutoResizeEnabled(bool enabled,
|
|
|
|
const CefSize& min_size,
|
|
|
|
const CefSize& max_size) override;
|
|
|
|
CefRefPtr<CefExtension> GetExtension() override;
|
|
|
|
bool IsBackgroundHost() override;
|
2012-04-03 01:34:16 +00:00
|
|
|
|
2014-06-30 22:30:29 +00:00
|
|
|
// Returns true if windowless rendering is enabled.
|
2021-04-17 21:12:54 -04:00
|
|
|
bool IsWindowless() const override;
|
2014-06-30 22:30:29 +00:00
|
|
|
|
2019-10-15 11:11:59 +00:00
|
|
|
// Returns true if this browser supports picture-in-picture.
|
|
|
|
bool IsPictureInPictureSupported() const;
|
|
|
|
|
2013-03-19 22:59:33 +00:00
|
|
|
// Called when the OS window hosting the browser is destroyed.
|
2021-02-17 20:58:25 -05:00
|
|
|
void WindowDestroyed() override;
|
2012-11-21 00:40:15 +00:00
|
|
|
|
2012-04-03 01:34:16 +00:00
|
|
|
// Destroy the browser members. This method should only be called after the
|
|
|
|
// native browser window is not longer processing messages.
|
2020-09-17 18:24:08 -04:00
|
|
|
void DestroyBrowser() override;
|
2012-04-03 01:34:16 +00:00
|
|
|
|
2014-06-30 22:30:29 +00:00
|
|
|
// Cancel display of the context menu, if any.
|
|
|
|
void CancelContextMenu();
|
|
|
|
|
2020-09-24 21:40:47 -04:00
|
|
|
bool MaybeAllowNavigation(content::RenderFrameHost* opener,
|
|
|
|
bool is_guest_view,
|
|
|
|
const content::OpenURLParams& params) override;
|
2012-04-03 01:34:16 +00:00
|
|
|
|
2016-01-19 15:09:01 -05:00
|
|
|
// Convert from view coordinates to screen coordinates. Potential display
|
|
|
|
// scaling will be applied to the result.
|
2015-11-17 13:20:13 -05:00
|
|
|
gfx::Point GetScreenPoint(const gfx::Point& view) const;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void StartDragging(const content::DropData& drop_data,
|
2020-10-08 15:54:42 -04: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 15:54:42 -04:00
|
|
|
const blink::mojom::DragEventSourceInfo& event_info,
|
2017-05-17 11:29:28 +02:00
|
|
|
content::RenderWidgetHostImpl* source_rwh);
|
2021-01-27 18:13:12 -05:00
|
|
|
void UpdateDragCursor(ui::mojom::DragOperation operation);
|
2016-11-23 15:54:29 -05:00
|
|
|
|
2017-08-03 18:55:19 -04:00
|
|
|
// Accessors that must be called on the UI thread.
|
2020-07-03 16:13:27 -04:00
|
|
|
extensions::ExtensionHost* GetExtensionHost() const;
|
2017-08-03 18:55:19 -04:00
|
|
|
|
2020-09-17 18:24:08 -04:00
|
|
|
void OnSetFocus(cef_focus_source_t source) override;
|
2012-06-11 16:51:51 +00:00
|
|
|
|
2012-10-16 19:28:07 +00:00
|
|
|
// Run the file chooser dialog specified by |params|. Only a single dialog may
|
|
|
|
// be pending at any given time. |callback| will be executed asynchronously
|
|
|
|
// after the dialog is dismissed or if another dialog is already pending.
|
2020-03-03 19:29:39 -05:00
|
|
|
void RunFileChooser(const CefFileDialogRunner::FileChooserParams& params,
|
|
|
|
CefFileDialogRunner::RunFileChooserCallback callback);
|
2012-10-16 19:28:07 +00:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool HandleContextMenu(content::WebContents* web_contents,
|
|
|
|
const content::ContextMenuParams& params);
|
2015-07-16 17:40:01 -04:00
|
|
|
|
2013-03-19 22:59:33 +00: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 01:34:16 +00:00
|
|
|
// content::WebContentsDelegate methods.
|
2014-11-12 19:25:15 +00:00
|
|
|
content::WebContents* OpenURLFromTab(
|
2012-04-03 01:34:16 +00:00
|
|
|
content::WebContents* source,
|
2014-11-12 19:25:15 +00:00
|
|
|
const content::OpenURLParams& params) override;
|
2017-08-03 18:55:19 -04:00
|
|
|
bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
|
|
|
|
void AddNewContents(content::WebContents* source,
|
2018-05-18 13:45:18 +03:00
|
|
|
std::unique_ptr<content::WebContents> new_contents,
|
2020-06-09 13:48:00 -04:00
|
|
|
const GURL& target_url,
|
2017-08-03 18:55:19 -04:00
|
|
|
WindowOpenDisposition disposition,
|
|
|
|
const gfx::Rect& initial_rect,
|
|
|
|
bool user_gesture,
|
|
|
|
bool* was_blocked) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
void LoadingStateChanged(content::WebContents* source,
|
|
|
|
bool to_different_document) override;
|
|
|
|
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 15:54:29 -05:00
|
|
|
bool DidAddMessageToConsole(content::WebContents* source,
|
2019-07-16 13:59:21 -04:00
|
|
|
blink::mojom::ConsoleMessageLevel log_level,
|
2021-04-20 18:52:34 -04:00
|
|
|
const std::u16string& message,
|
2016-11-23 15:54:29 -05:00
|
|
|
int32_t line_no,
|
2021-04-20 18:52:34 -04:00
|
|
|
const std::u16string& source_id) override;
|
2014-11-12 19:25:15 +00: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;
|
2019-03-13 21:27:37 +00:00
|
|
|
bool HandleContextMenu(content::RenderFrameHost* render_frame_host,
|
|
|
|
const content::ContextMenuParams& params) override;
|
2017-04-20 15:28:17 -04:00
|
|
|
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
|
2012-08-28 22:26:35 +00:00
|
|
|
content::WebContents* source,
|
2017-04-20 15:28:17 -04:00
|
|
|
const content::NativeWebKeyboardEvent& event) override;
|
2018-11-02 21:15:09 -04:00
|
|
|
bool HandleKeyboardEvent(
|
2012-08-28 22:26:35 +00:00
|
|
|
content::WebContents* source,
|
2014-11-12 19:25:15 +00:00
|
|
|
const content::NativeWebKeyboardEvent& event) override;
|
2017-08-03 18:55:19 -04: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 15:54:42 -04:00
|
|
|
blink::DragOperationsMask operations_allowed) override;
|
2017-02-10 17:44:11 -05:00
|
|
|
void GetCustomWebContentsView(
|
2014-06-30 22:30:29 +00:00
|
|
|
content::WebContents* web_contents,
|
|
|
|
const GURL& target_url,
|
2017-03-15 18:04:16 -04:00
|
|
|
int opener_render_process_id,
|
|
|
|
int opener_render_frame_id,
|
2014-06-30 22:30:29 +00:00
|
|
|
content::WebContentsView** view,
|
2014-11-12 19:25:15 +00:00
|
|
|
content::RenderViewHostDelegateView** delegate_view) override;
|
2017-07-26 19:19:27 -04: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-11-12 19:25:15 +00:00
|
|
|
void DidNavigateMainFramePostCommit(
|
2015-01-20 18:24:54 +00:00
|
|
|
content::WebContents* web_contents) override;
|
2014-12-13 20:18:31 +00: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-28 18:39:23 -04:00
|
|
|
scoped_refptr<content::FileSelectListener> listener,
|
2018-10-02 15:14:11 +03:00
|
|
|
const blink::mojom::FileChooserParams& params) override;
|
2018-05-20 16:51:42 +03:00
|
|
|
void EnterFullscreenModeForTab(
|
2020-07-08 13:23:29 -04:00
|
|
|
content::RenderFrameHost* requesting_frame,
|
2019-11-12 11:11:44 -05:00
|
|
|
const blink::mojom::FullscreenOptions& options) override;
|
2015-06-04 18:33:24 -04:00
|
|
|
void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
|
|
|
|
bool IsFullscreenForTabOrPending(
|
2019-09-04 15:13:32 +00:00
|
|
|
const content::WebContents* web_contents) override;
|
2019-11-12 11:11:44 -05:00
|
|
|
blink::mojom::DisplayMode GetDisplayMode(
|
2019-09-04 15:13:32 +00: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 19:25:15 +00:00
|
|
|
void UpdatePreferredSize(content::WebContents* source,
|
2015-06-04 18:33:24 -04:00
|
|
|
const gfx::Size& pref_size) override;
|
2017-08-03 18:55:19 -04:00
|
|
|
void ResizeDueToAutoResize(content::WebContents* source,
|
|
|
|
const gfx::Size& new_size) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
void RequestMediaAccessPermission(
|
2012-06-21 22:50:34 +00:00
|
|
|
content::WebContents* web_contents,
|
2013-01-15 19:12:28 +00:00
|
|
|
const content::MediaStreamRequest& request,
|
2018-06-18 18:08:20 -04:00
|
|
|
content::MediaResponseCallback callback) override;
|
2018-04-19 11:44:42 -04:00
|
|
|
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
|
2015-03-25 17:22:47 -04:00
|
|
|
const GURL& security_origin,
|
2019-09-04 15:13:32 +00:00
|
|
|
blink::mojom::MediaStreamType type) override;
|
2020-03-03 19:29:39 -05:00
|
|
|
bool IsNeverComposited(content::WebContents* web_contents) override;
|
2019-10-15 11:11:59 +00:00
|
|
|
content::PictureInPictureResult EnterPictureInPicture(
|
|
|
|
content::WebContents* web_contents,
|
|
|
|
const viz::SurfaceId& surface_id,
|
|
|
|
const gfx::Size& natural_size) override;
|
|
|
|
void ExitPictureInPicture() override;
|
2012-04-03 01:34:16 +00:00
|
|
|
|
|
|
|
// content::WebContentsObserver methods.
|
2013-07-18 23:25:28 +00:00
|
|
|
using content::WebContentsObserver::BeforeUnloadFired;
|
2021-03-04 17:36:57 -05:00
|
|
|
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
void RenderViewReady() override;
|
2017-03-03 17:37:23 -05:00
|
|
|
void DidFinishNavigation(
|
|
|
|
content::NavigationHandle* navigation_handle) override;
|
2020-05-01 18:18:18 +00:00
|
|
|
void OnAudioStateChanged(bool audible) override;
|
2017-05-12 18:28:25 +00:00
|
|
|
void AccessibilityEventReceived(
|
2018-06-08 12:53:10 -04:00
|
|
|
const content::AXEventNotificationDetails& content_event_bundle) override;
|
2017-05-12 18:28:25 +00:00
|
|
|
void AccessibilityLocationChangesReceived(
|
|
|
|
const std::vector<content::AXLocationChangeNotificationDetails>& locData)
|
|
|
|
override;
|
2020-07-03 22:51:17 -04:00
|
|
|
void WebContentsDestroyed() override;
|
2017-10-20 13:45:20 -04:00
|
|
|
|
2014-07-07 22:17:33 +00:00
|
|
|
private:
|
2020-07-04 14:21:34 -04:00
|
|
|
friend class CefBrowserPlatformDelegateAlloy;
|
2020-07-03 16:13:27 -04:00
|
|
|
|
2020-09-22 15:54:02 -04:00
|
|
|
static CefRefPtr<AlloyBrowserHostImpl> CreateInternal(
|
2014-07-07 22:17:33 +00:00
|
|
|
const CefBrowserSettings& settings,
|
|
|
|
CefRefPtr<CefClient> client,
|
|
|
|
content::WebContents* web_contents,
|
2018-05-18 13:45:18 +03:00
|
|
|
bool own_web_contents,
|
2014-07-07 22:17:33 +00:00
|
|
|
scoped_refptr<CefBrowserInfo> browser_info,
|
2020-09-22 15:54:02 -04:00
|
|
|
CefRefPtr<AlloyBrowserHostImpl> opener,
|
2016-01-19 15:09:01 -05:00
|
|
|
bool is_devtools_popup,
|
2019-03-23 19:40:32 -04:00
|
|
|
CefRefPtr<CefRequestContextImpl> request_context,
|
2017-08-03 18:55:19 -04:00
|
|
|
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
|
|
|
CefRefPtr<CefExtension> extension);
|
2014-07-07 22:17:33 +00:00
|
|
|
|
2020-09-22 15:54:02 -04: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 15:54:02 -04:00
|
|
|
CefRefPtr<AlloyBrowserHostImpl> opener,
|
2019-03-23 19:40:32 -04:00
|
|
|
CefRefPtr<CefRequestContextImpl> request_context,
|
2017-08-03 18:55:19 -04:00
|
|
|
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
|
|
|
CefRefPtr<CefExtension> extension);
|
2015-11-17 13:20:13 -05:00
|
|
|
|
|
|
|
// Give the platform delegate an opportunity to create the host window.
|
|
|
|
bool CreateHostWindow();
|
2012-04-03 01:34:16 +00:00
|
|
|
|
2015-11-17 13:20:13 -05:00
|
|
|
// Create the CefFileDialogManager if it doesn't already exist.
|
|
|
|
void EnsureFileDialogManager();
|
|
|
|
|
2020-05-01 18:18:18 +00:00
|
|
|
void StartAudioCapturer();
|
|
|
|
void OnRecentlyAudibleTimerFired();
|
|
|
|
|
2020-11-25 12:57:53 -05:00
|
|
|
void SetFocusInternal(bool focus);
|
|
|
|
|
2012-04-03 01:34:16 +00:00
|
|
|
CefWindowHandle opener_;
|
2016-02-29 15:23:44 -05:00
|
|
|
const bool is_windowless_;
|
2020-06-12 20:54:08 -04:00
|
|
|
CefWindowHandle host_window_handle_ = kNullWindowHandle;
|
2020-07-03 16:13:27 -04:00
|
|
|
CefRefPtr<CefExtension> extension_;
|
|
|
|
bool is_background_host_ = false;
|
2018-05-18 13:45:18 +03:00
|
|
|
|
2013-03-19 22:59:33 +00:00
|
|
|
// Represents the current browser destruction state. Only accessed on the UI
|
|
|
|
// thread.
|
2020-06-12 20:54:08 -04:00
|
|
|
DestructionState destruction_state_ = DESTRUCTION_STATE_NONE;
|
2013-03-19 22:59:33 +00:00
|
|
|
|
|
|
|
// True if the OS window hosting the browser has been destroyed. Only accessed
|
|
|
|
// on the UI thread.
|
2020-06-12 20:54:08 -04:00
|
|
|
bool window_destroyed_ = false;
|
2013-03-19 22:59:33 +00:00
|
|
|
|
2015-11-17 13:20:13 -05:00
|
|
|
// Used for creating and managing file dialogs.
|
2016-04-27 16:38:52 -04:00
|
|
|
std::unique_ptr<CefFileDialogManager> file_dialog_manager_;
|
2015-11-17 13:20:13 -05:00
|
|
|
|
2012-04-16 21:15:27 +00:00
|
|
|
// Used for creating and managing JavaScript dialogs.
|
2016-04-27 16:38:52 -04:00
|
|
|
std::unique_ptr<CefJavaScriptDialogManager> javascript_dialog_manager_;
|
2012-04-16 21:15:27 +00:00
|
|
|
|
2012-04-19 20:31:46 +00:00
|
|
|
// Used for creating and managing context menus.
|
2016-04-27 16:38:52 -04:00
|
|
|
std::unique_ptr<CefMenuManager> menu_manager_;
|
2012-04-19 20:31:46 +00:00
|
|
|
|
2020-05-01 18:18:18 +00: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.
|
|
|
|
base::OneShotTimer recently_audible_timer_;
|
2012-04-03 01:34:16 +00:00
|
|
|
};
|
|
|
|
|
2020-09-22 15:54:02 -04:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_HOST_IMPL_H_
|