mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium version 71.0.3578.0 (#599034)
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
||||
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
|
||||
#include "chrome/browser/plugins/plugin_prefs_factory.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||
#include "chrome/browser/themes/theme_service_factory.h"
|
||||
@@ -28,7 +27,6 @@ void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
|
||||
extensions::AlarmManager::GetFactoryInstance();
|
||||
extensions::RendererStartupHelperFactory::GetInstance();
|
||||
extensions::StorageFrontend::GetFactoryInstance();
|
||||
extensions::StreamsPrivateAPI::GetFactoryInstance();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -54,6 +54,7 @@
|
||||
#include "content/public/browser/desktop_media_id.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/download_request_utils.h"
|
||||
#include "content/public/browser/file_select_listener.h"
|
||||
#include "content/public/browser/host_zoom_map.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
@@ -2566,9 +2567,10 @@ CefBrowserHostImpl::GetJavaScriptDialogManager(content::WebContents* source) {
|
||||
|
||||
void CefBrowserHostImpl::RunFileChooser(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
const blink::mojom::FileChooserParams& params) {
|
||||
EnsureFileDialogManager();
|
||||
file_dialog_manager_->RunFileChooser(render_frame_host, params);
|
||||
file_dialog_manager_->RunFileChooser(std::move(listener), params);
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::HandleContextMenu(
|
||||
@@ -2869,6 +2871,17 @@ void CefBrowserHostImpl::DidFinishNavigation(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidStopLoading() {
|
||||
// Notify the renderer that loading has stopped. We used to use
|
||||
// RenderFrameObserver::DidStopLoading which was removed in
|
||||
// https://crrev.com/3e37dd0ead. However, that callback wasn't necessarily
|
||||
// accurate because it wasn't called in all of the cases where
|
||||
// RenderFrameImpl sends the FrameHostMsg_DidStopLoading message. This adds
|
||||
// an additional round trip but should provide the same or improved
|
||||
// functionality.
|
||||
Send(new CefMsg_DidStopLoading(MSG_ROUTING_NONE));
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
has_document_ = true;
|
||||
|
@@ -451,6 +451,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
content::JavaScriptDialogManager* GetJavaScriptDialogManager(
|
||||
content::WebContents* source) override;
|
||||
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
const blink::mojom::FileChooserParams& params) override;
|
||||
bool EmbedsFullscreenWidget() const override;
|
||||
void EnterFullscreenModeForTab(
|
||||
@@ -493,6 +494,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void RenderProcessGone(base::TerminationStatus status) override;
|
||||
void DidFinishNavigation(
|
||||
content::NavigationHandle* navigation_handle) override;
|
||||
void DidStopLoading() override;
|
||||
void DocumentAvailableInMainFrame() override;
|
||||
void DidFailLoad(content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url,
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include "chrome/browser/net/chrome_net_log_helper.h"
|
||||
#include "chrome/browser/printing/print_job_manager.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "components/net_log/net_export_file_writer.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "services/network/public/cpp/network_switches.h"
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
@@ -111,6 +112,14 @@ ChromeBrowserProcessStub::system_network_context_manager() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net_log::NetExportFileWriter*
|
||||
ChromeBrowserProcessStub::net_export_file_writer() {
|
||||
if (!net_export_file_writer_) {
|
||||
net_export_file_writer_ = std::make_unique<net_log::NetExportFileWriter>();
|
||||
}
|
||||
return net_export_file_writer_.get();
|
||||
}
|
||||
|
||||
network::NetworkQualityTracker*
|
||||
ChromeBrowserProcessStub::network_quality_tracker() {
|
||||
NOTREACHED();
|
||||
|
@@ -49,6 +49,7 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
rappor::RapporServiceImpl* rappor_service() override;
|
||||
IOThread* io_thread() override;
|
||||
SystemNetworkContextManager* system_network_context_manager() override;
|
||||
net_log::NetExportFileWriter* net_export_file_writer() override;
|
||||
network::NetworkQualityTracker* network_quality_tracker() override;
|
||||
WatchDogThread* watchdog_thread() override;
|
||||
ProfileManager* profile_manager() override;
|
||||
@@ -122,6 +123,7 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
std::unique_ptr<ChromeProfileManagerStub> profile_manager_;
|
||||
scoped_refptr<extensions::EventRouterForwarder> event_router_forwarder_;
|
||||
std::unique_ptr<net_log::ChromeNetLog> net_log_;
|
||||
std::unique_ptr<net_log::NetExportFileWriter> net_export_file_writer_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProcessStub);
|
||||
};
|
||||
|
@@ -13,7 +13,6 @@
|
||||
|
||||
#include "chrome/browser/extensions/api/content_settings/content_settings_api.h"
|
||||
#include "chrome/browser/extensions/api/resources_private/resources_private_api.h"
|
||||
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
|
||||
#include "extensions/browser/api/alarms/alarms_api.h"
|
||||
#include "extensions/browser/api/storage/storage_api.h"
|
||||
#include "extensions/browser/extension_function_registry.h"
|
||||
@@ -31,8 +30,6 @@ namespace cefimpl = extensions::cef;
|
||||
const char* const kSupportedAPIs[] = {
|
||||
"resourcesPrivate",
|
||||
EXTENSION_FUNCTION_NAME(ResourcesPrivateGetStringsFunction),
|
||||
"streamsPrivate",
|
||||
EXTENSION_FUNCTION_NAME(StreamsPrivateAbortFunction),
|
||||
"alarms",
|
||||
EXTENSION_FUNCTION_NAME(AlarmsCreateFunction),
|
||||
EXTENSION_FUNCTION_NAME(AlarmsGetFunction),
|
||||
@@ -77,7 +74,6 @@ bool ChromeFunctionRegistry::IsSupported(const std::string& name) {
|
||||
// static
|
||||
void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
|
||||
registry->RegisterFunction<ResourcesPrivateGetStringsFunction>();
|
||||
registry->RegisterFunction<StreamsPrivateAbortFunction>();
|
||||
registry->RegisterFunction<AlarmsCreateFunction>();
|
||||
registry->RegisterFunction<AlarmsGetFunction>();
|
||||
registry->RegisterFunction<AlarmsGetAllFunction>();
|
||||
|
@@ -14,8 +14,7 @@ namespace extensions {
|
||||
CefExtensionWebContentsObserver::CefExtensionWebContentsObserver(
|
||||
content::WebContents* web_contents)
|
||||
: ExtensionWebContentsObserver(web_contents),
|
||||
script_executor_(
|
||||
new ScriptExecutor(web_contents, &script_execution_observers_)) {}
|
||||
script_executor_(new ScriptExecutor(web_contents)) {}
|
||||
|
||||
CefExtensionWebContentsObserver::~CefExtensionWebContentsObserver() {}
|
||||
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#include "base/observer_list.h"
|
||||
#include "content/public/browser/web_contents_user_data.h"
|
||||
#include "extensions/browser/extension_web_contents_observer.h"
|
||||
#include "extensions/browser/script_execution_observer.h"
|
||||
#include "extensions/browser/script_executor.h"
|
||||
|
||||
namespace extensions {
|
||||
@@ -36,11 +35,6 @@ class CefExtensionWebContentsObserver
|
||||
// content::WebContentsObserver overrides.
|
||||
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
|
||||
|
||||
// Our content script observers. Declare at top so that it will outlive all
|
||||
// other members, since they might add themselves as observers.
|
||||
base::ObserverList<ScriptExecutionObserver>::Unchecked
|
||||
script_execution_observers_;
|
||||
|
||||
std::unique_ptr<ScriptExecutor> script_executor_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefExtensionWebContentsObserver);
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "content/public/browser/file_select_listener.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/common/file_chooser_file_info.h"
|
||||
#include "net/base/directory_lister.h"
|
||||
@@ -146,14 +147,10 @@ class UploadFolderHelper
|
||||
CefFileDialogManager::CefFileDialogManager(
|
||||
CefBrowserHostImpl* browser,
|
||||
std::unique_ptr<CefFileDialogRunner> runner)
|
||||
: content::WebContentsObserver(browser->web_contents()),
|
||||
browser_(browser),
|
||||
: browser_(browser),
|
||||
runner_(std::move(runner)),
|
||||
file_chooser_pending_(false),
|
||||
render_frame_host_(nullptr),
|
||||
weak_ptr_factory_(this) {
|
||||
DCHECK(web_contents());
|
||||
}
|
||||
weak_ptr_factory_(this) {}
|
||||
|
||||
CefFileDialogManager::~CefFileDialogManager() {}
|
||||
|
||||
@@ -209,10 +206,9 @@ void CefFileDialogManager::RunFileDialog(
|
||||
}
|
||||
|
||||
void CefFileDialogManager::RunFileChooser(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
const blink::mojom::FileChooserParams& params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(render_frame_host);
|
||||
|
||||
CefFileDialogRunner::FileChooserParams cef_params;
|
||||
static_cast<blink::mojom::FileChooserParams&>(cef_params) = params;
|
||||
@@ -221,14 +217,16 @@ void CefFileDialogManager::RunFileChooser(
|
||||
if (params.mode == blink::mojom::FileChooserParams::Mode::kUploadFolder) {
|
||||
callback = base::Bind(
|
||||
&CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode);
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode,
|
||||
base::Passed(std::move(listener)));
|
||||
} else {
|
||||
callback =
|
||||
base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode);
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode,
|
||||
base::Passed(std::move(listener)));
|
||||
}
|
||||
|
||||
RunFileChooserInternal(render_frame_host, cef_params, callback);
|
||||
RunFileChooserInternal(cef_params, callback);
|
||||
}
|
||||
|
||||
void CefFileDialogManager::RunFileChooser(
|
||||
@@ -237,11 +235,10 @@ void CefFileDialogManager::RunFileChooser(
|
||||
const CefFileDialogRunner::RunFileChooserCallback& host_callback =
|
||||
base::Bind(&CefFileDialogManager::OnRunFileChooserCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), callback);
|
||||
RunFileChooserInternal(nullptr, params, host_callback);
|
||||
RunFileChooserInternal(params, host_callback);
|
||||
}
|
||||
|
||||
void CefFileDialogManager::RunFileChooserInternal(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -253,7 +250,6 @@ void CefFileDialogManager::RunFileChooserInternal(
|
||||
}
|
||||
|
||||
file_chooser_pending_ = true;
|
||||
render_frame_host_ = render_frame_host;
|
||||
|
||||
bool handled = false;
|
||||
|
||||
@@ -335,6 +331,7 @@ void CefFileDialogManager::OnRunFileChooserCallback(
|
||||
|
||||
void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
|
||||
const blink::mojom::FileChooserParams::Mode mode,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -342,19 +339,22 @@ void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
|
||||
|
||||
if (file_paths.size() == 0) {
|
||||
// Client canceled the file chooser.
|
||||
OnRunFileChooserDelegateCallback(mode, selected_accept_filter, file_paths);
|
||||
OnRunFileChooserDelegateCallback(mode, std::move(listener),
|
||||
selected_accept_filter, file_paths);
|
||||
} else {
|
||||
lister_.reset(new net::DirectoryLister(
|
||||
file_paths[0], net::DirectoryLister::NO_SORT_RECURSIVE,
|
||||
new UploadFolderHelper(
|
||||
base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), mode))));
|
||||
weak_ptr_factory_.GetWeakPtr(), mode,
|
||||
base::Passed(std::move(listener))))));
|
||||
lister_->Start();
|
||||
}
|
||||
}
|
||||
|
||||
void CefFileDialogManager::OnRunFileChooserDelegateCallback(
|
||||
blink::mojom::FileChooserParams::Mode mode,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -367,9 +367,7 @@ void CefFileDialogManager::OnRunFileChooserDelegateCallback(
|
||||
selected_files.push_back(std::move(info));
|
||||
}
|
||||
|
||||
// Notify our RenderViewHost in all cases.
|
||||
if (render_frame_host_)
|
||||
render_frame_host_->FilesSelectedInChooser(selected_files, mode);
|
||||
listener->FileSelected(std::move(selected_files), mode);
|
||||
|
||||
Cleanup();
|
||||
}
|
||||
@@ -378,12 +376,5 @@ void CefFileDialogManager::Cleanup() {
|
||||
if (lister_)
|
||||
lister_.reset();
|
||||
|
||||
render_frame_host_ = nullptr;
|
||||
file_chooser_pending_ = false;
|
||||
}
|
||||
|
||||
void CefFileDialogManager::RenderFrameDeleted(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
if (render_frame_host == render_frame_host_)
|
||||
render_frame_host_ = nullptr;
|
||||
}
|
||||
|
@@ -15,8 +15,9 @@
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
|
||||
namespace content {
|
||||
class FileSelectListener;
|
||||
class WebContents;
|
||||
}
|
||||
} // namespace content
|
||||
|
||||
namespace net {
|
||||
class DirectoryLister;
|
||||
@@ -24,12 +25,12 @@ class DirectoryLister;
|
||||
|
||||
class CefBrowserHostImpl;
|
||||
|
||||
class CefFileDialogManager : public content::WebContentsObserver {
|
||||
class CefFileDialogManager {
|
||||
public:
|
||||
// |runner| may be NULL if the platform doesn't implement dialogs.
|
||||
CefFileDialogManager(CefBrowserHostImpl* browser,
|
||||
std::unique_ptr<CefFileDialogRunner> runner);
|
||||
~CefFileDialogManager() override;
|
||||
~CefFileDialogManager();
|
||||
|
||||
// Delete the runner to free any platform constructs.
|
||||
void Destroy();
|
||||
@@ -45,7 +46,7 @@ class CefFileDialogManager : public content::WebContentsObserver {
|
||||
|
||||
// Called from CefBrowserHostImpl::RunFileChooser.
|
||||
// See WebContentsDelegate::RunFileChooser documentation.
|
||||
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
||||
void RunFileChooser(std::unique_ptr<content::FileSelectListener> listener,
|
||||
const blink::mojom::FileChooserParams& params);
|
||||
|
||||
// Run the file chooser dialog specified by |params|. Only a single dialog may
|
||||
@@ -57,7 +58,6 @@ class CefFileDialogManager : public content::WebContentsObserver {
|
||||
|
||||
private:
|
||||
void RunFileChooserInternal(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback);
|
||||
|
||||
@@ -72,6 +72,7 @@ class CefFileDialogManager : public content::WebContentsObserver {
|
||||
// blink::mojom::FileChooserParams::Mode::kUploadFolder.
|
||||
void OnRunFileChooserUploadFolderDelegateCallback(
|
||||
const blink::mojom::FileChooserParams::Mode mode,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths);
|
||||
|
||||
@@ -79,15 +80,13 @@ class CefFileDialogManager : public content::WebContentsObserver {
|
||||
// RenderFrameHost.
|
||||
void OnRunFileChooserDelegateCallback(
|
||||
blink::mojom::FileChooserParams::Mode mode,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths);
|
||||
|
||||
// Clean up state associated with the last run.
|
||||
void Cleanup();
|
||||
|
||||
// WebContentsObserver methods:
|
||||
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||
|
||||
// CefBrowserHostImpl pointer is guaranteed to outlive this object.
|
||||
CefBrowserHostImpl* browser_;
|
||||
|
||||
@@ -96,9 +95,6 @@ class CefFileDialogManager : public content::WebContentsObserver {
|
||||
// True if a file chooser is currently pending.
|
||||
bool file_chooser_pending_;
|
||||
|
||||
// RenderFrameHost associated with the pending file chooser. May be nullptr.
|
||||
content::RenderFrameHost* render_frame_host_;
|
||||
|
||||
// Used for asynchronously listing directory contents.
|
||||
std::unique_ptr<net::DirectoryLister> lister_;
|
||||
|
||||
|
@@ -200,8 +200,8 @@ bool CefImageImpl::GetRepresentationInfo(float scale_factor,
|
||||
return false;
|
||||
|
||||
actual_scale_factor = rep.scale();
|
||||
pixel_width = rep.sk_bitmap().width();
|
||||
pixel_height = rep.sk_bitmap().height();
|
||||
pixel_width = rep.GetBitmap().width();
|
||||
pixel_height = rep.GetBitmap().height();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ const SkBitmap* CefImageImpl::GetBitmap(float scale_factor) const {
|
||||
if (rep.is_null())
|
||||
return nullptr;
|
||||
|
||||
return &rep.sk_bitmap();
|
||||
return &rep.GetBitmap();
|
||||
}
|
||||
|
||||
// static
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "content/browser/compositor/image_transport_factory.h"
|
||||
#include "content/browser/frame_host/render_widget_host_view_guest.h"
|
||||
#include "content/browser/renderer_host/cursor_manager.h"
|
||||
#include "content/browser/renderer_host/delegated_frame_host.h"
|
||||
#include "content/browser/renderer_host/dip_util.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_delegate.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
@@ -110,6 +111,58 @@ class CefCompositorFrameSinkClient
|
||||
CefRenderWidgetHostViewOSR* const render_widget_host_view_;
|
||||
};
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
|
||||
class CefDelegatedFrameHostClient : public content::DelegatedFrameHostClient {
|
||||
public:
|
||||
explicit CefDelegatedFrameHostClient(CefRenderWidgetHostViewOSR* view)
|
||||
: view_(view) {}
|
||||
|
||||
ui::Layer* DelegatedFrameHostGetLayer() const override {
|
||||
return view_->GetRootLayer();
|
||||
}
|
||||
|
||||
bool DelegatedFrameHostIsVisible() const override {
|
||||
// Called indirectly from DelegatedFrameHost::WasShown.
|
||||
return view_->IsShowing();
|
||||
}
|
||||
|
||||
SkColor DelegatedFrameHostGetGutterColor() const override {
|
||||
// When making an element on the page fullscreen the element's background
|
||||
// may not match the page's, so use black as the gutter color to avoid
|
||||
// flashes of brighter colors during the transition.
|
||||
if (view_->render_widget_host()->delegate() &&
|
||||
view_->render_widget_host()->delegate()->IsFullscreenForCurrentTab()) {
|
||||
return SK_ColorBLACK;
|
||||
}
|
||||
return *view_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override {
|
||||
}
|
||||
|
||||
void OnBeginFrame(base::TimeTicks frame_time) override {
|
||||
// TODO(cef): Maybe we can use this method in combination with
|
||||
// OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer.
|
||||
// See https://codereview.chromium.org/1841083007.
|
||||
}
|
||||
|
||||
void OnFrameTokenChanged(uint32_t frame_token) override {
|
||||
view_->render_widget_host()->DidProcessFrame(frame_token);
|
||||
}
|
||||
|
||||
float GetDeviceScaleFactor() const override {
|
||||
return view_->GetDeviceScaleFactor();
|
||||
}
|
||||
|
||||
private:
|
||||
CefRenderWidgetHostViewOSR* const view_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDelegatedFrameHostClient);
|
||||
};
|
||||
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
} // namespace
|
||||
|
||||
// Used for managing copy requests when GPU compositing is enabled. Based on
|
||||
@@ -203,7 +256,7 @@ class CefCopyFrameGenerator {
|
||||
bitmap->getPixels());
|
||||
}
|
||||
|
||||
CefRenderWidgetHostViewOSR* view_;
|
||||
CefRenderWidgetHostViewOSR* const view_;
|
||||
int frame_retry_count_;
|
||||
base::TimeTicks next_frame_time_;
|
||||
base::TimeDelta frame_duration_;
|
||||
@@ -291,10 +344,12 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
local_surface_id_ = local_surface_id_allocator_.GenerateId();
|
||||
delegated_frame_host_client_.reset(new CefDelegatedFrameHostClient(this));
|
||||
|
||||
// Matching the attributes from BrowserCompositorMac.
|
||||
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
|
||||
AllocateFrameSinkId(is_guest_view_hack), this,
|
||||
AllocateFrameSinkId(is_guest_view_hack),
|
||||
delegated_frame_host_client_.get(),
|
||||
true /* should_register_frame_sink_id */);
|
||||
|
||||
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
|
||||
@@ -1116,43 +1171,6 @@ CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice(
|
||||
return base::WrapUnique(software_output_device_);
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
|
||||
ui::Layer* CefRenderWidgetHostViewOSR::DelegatedFrameHostGetLayer() const {
|
||||
return GetRootLayer();
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::DelegatedFrameHostIsVisible() const {
|
||||
// Called indirectly from DelegatedFrameHost::WasShown.
|
||||
return is_showing_;
|
||||
}
|
||||
|
||||
SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor() const {
|
||||
// When making an element on the page fullscreen the element's background
|
||||
// may not match the page's, so use black as the gutter color to avoid
|
||||
// flashes of brighter colors during the transition.
|
||||
if (render_widget_host_->delegate() &&
|
||||
render_widget_host_->delegate()->IsFullscreenForCurrentTab()) {
|
||||
return SK_ColorBLACK;
|
||||
}
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnFirstSurfaceActivation(
|
||||
const viz::SurfaceInfo& surface_info) {}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnBeginFrame(base::TimeTicks frame_time) {
|
||||
// TODO(cef): Maybe we can use this method in combination with
|
||||
// OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer.
|
||||
// See https://codereview.chromium.org/1841083007.
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnFrameTokenChanged(uint32_t frame_token) {
|
||||
render_widget_host_->DidProcessFrame(frame_token);
|
||||
}
|
||||
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::InstallTransparency() {
|
||||
if (background_color_ == SK_ColorTRANSPARENT) {
|
||||
SetBackgroundColor(background_color_);
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include "build/build_config.h"
|
||||
#include "components/viz/common/frame_sinks/begin_frame_source.h"
|
||||
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
|
||||
#include "content/browser/renderer_host/delegated_frame_host.h"
|
||||
#include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||
#include "content/public/common/widget_type.h"
|
||||
@@ -44,6 +43,8 @@
|
||||
#endif
|
||||
|
||||
namespace content {
|
||||
class DelegatedFrameHost;
|
||||
class DelegatedFrameHostClient;
|
||||
class RenderWidgetHost;
|
||||
class RenderWidgetHostImpl;
|
||||
class RenderWidgetHostViewGuest;
|
||||
@@ -95,12 +96,7 @@ class MacHelper;
|
||||
|
||||
class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
public ui::ExternalBeginFrameClient,
|
||||
public ui::CompositorDelegate
|
||||
#if !defined(OS_MACOSX)
|
||||
,
|
||||
public content::DelegatedFrameHostClient
|
||||
#endif
|
||||
{
|
||||
public ui::CompositorDelegate {
|
||||
public:
|
||||
CefRenderWidgetHostViewOSR(SkColor background_color,
|
||||
bool use_shared_texture,
|
||||
@@ -213,16 +209,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
||||
ui::Compositor* compositor) override;
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
// DelegatedFrameHostClient implementation.
|
||||
ui::Layer* DelegatedFrameHostGetLayer() const override;
|
||||
bool DelegatedFrameHostIsVisible() const override;
|
||||
SkColor DelegatedFrameHostGetGutterColor() const override;
|
||||
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
|
||||
void OnBeginFrame(base::TimeTicks frame_time) override;
|
||||
void OnFrameTokenChanged(uint32_t frame_token) override;
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
||||
bool InstallTransparency();
|
||||
|
||||
void SynchronizeVisualProperties();
|
||||
@@ -349,6 +335,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
std::unique_ptr<ui::Compositor> compositor_;
|
||||
gfx::AcceleratedWidget compositor_widget_;
|
||||
std::unique_ptr<content::DelegatedFrameHost> delegated_frame_host_;
|
||||
std::unique_ptr<content::DelegatedFrameHostClient>
|
||||
delegated_frame_host_client_;
|
||||
std::unique_ptr<ui::Layer> root_layer_;
|
||||
viz::LocalSurfaceId local_surface_id_;
|
||||
viz::ParentLocalSurfaceIdAllocator local_surface_id_allocator_;
|
||||
|
@@ -101,9 +101,9 @@ void CefResourceDispatcherHostDelegate::OnStreamCreated(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(
|
||||
&extensions::StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent,
|
||||
request->GetExpectedContentSize(), ix->second.extension_id,
|
||||
ix->second.view_id, embedded, info->GetFrameTreeNodeId(),
|
||||
info->GetChildID(), info->GetRenderFrameID(), std::move(stream),
|
||||
ix->second.extension_id, ix->second.view_id, embedded,
|
||||
info->GetFrameTreeNodeId(), info->GetChildID(),
|
||||
info->GetRenderFrameID(), std::move(stream),
|
||||
nullptr /* transferrable_loader */, GURL()));
|
||||
stream_target_info_.erase(request);
|
||||
}
|
||||
|
@@ -147,6 +147,9 @@ IPC_MESSAGE_ROUTED1(CefMsg_Response, Cef_Response_Params)
|
||||
// has been processed.
|
||||
IPC_MESSAGE_ROUTED1(CefMsg_ResponseAck, int /* request_id */)
|
||||
|
||||
// Tells the renderer that loading has stopped.
|
||||
IPC_MESSAGE_ROUTED0(CefMsg_DidStopLoading)
|
||||
|
||||
// Tells the render frame to load all blocked plugins with the given identifier.
|
||||
// Based on ChromeViewMsg_LoadBlockedPlugins.
|
||||
IPC_MESSAGE_ROUTED1(CefViewMsg_LoadBlockedPlugins, std::string /* identifier */)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
This directory provides API definitions for CEF. Some extensions are implemented
|
||||
using Mojo and others use an older JSON-based format.
|
||||
|
||||
<api> is the name of the API definition (e.g. 'streams_private').
|
||||
<class> is the name of the class implementation (e.g. 'StreamsPrivateAPI').
|
||||
<api> is the name of the API definition (e.g. 'alarms').
|
||||
<class> is the name of the class implementation (e.g. 'AlarmManager').
|
||||
|
||||
To add a new extension API implemented only in CEF ***:
|
||||
|
||||
|
@@ -507,7 +507,7 @@ void CefRequestImpl::Get(blink::WebURLRequest& request,
|
||||
int64& upload_data_size) const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
request.SetRequestContext(blink::WebURLRequest::kRequestContextInternal);
|
||||
request.SetRequestContext(blink::mojom::RequestContextType::INTERNAL);
|
||||
request.SetURL(url_);
|
||||
request.SetHTTPMethod(blink::WebString::FromUTF8(method_));
|
||||
|
||||
|
@@ -429,10 +429,6 @@ void CefBrowserImpl::OnDestruct() {
|
||||
CefContentRendererClient::Get()->OnBrowserDestroyed(this);
|
||||
}
|
||||
|
||||
void CefBrowserImpl::DidStopLoading() {
|
||||
OnLoadingStateChange(false);
|
||||
}
|
||||
|
||||
void CefBrowserImpl::DidFinishLoad(blink::WebLocalFrame* frame) {
|
||||
blink::WebDocumentLoader* dl = frame->GetDocumentLoader();
|
||||
Send(new CefHostMsg_DidFinishLoad(routing_id(),
|
||||
@@ -528,6 +524,7 @@ bool CefBrowserImpl::OnMessageReceived(const IPC::Message& message) {
|
||||
IPC_MESSAGE_HANDLER(CefMsg_Response, OnResponse)
|
||||
IPC_MESSAGE_HANDLER(CefMsg_ResponseAck, OnResponseAck)
|
||||
IPC_MESSAGE_HANDLER(CefMsg_LoadRequest, LoadRequest)
|
||||
IPC_MESSAGE_HANDLER(CefMsg_DidStopLoading, OnDidStopLoading)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
return handled;
|
||||
@@ -659,6 +656,10 @@ void CefBrowserImpl::OnResponseAck(int request_id) {
|
||||
response_manager_->RunAckHandler(request_id);
|
||||
}
|
||||
|
||||
void CefBrowserImpl::OnDidStopLoading() {
|
||||
OnLoadingStateChange(false);
|
||||
}
|
||||
|
||||
void CefBrowserImpl::OnLoadingStateChange(bool isLoading) {
|
||||
CefRefPtr<CefApp> app = CefContentClient::Get()->application();
|
||||
if (app.get()) {
|
||||
|
@@ -107,7 +107,6 @@ class CefBrowserImpl : public CefBrowser, public content::RenderViewObserver {
|
||||
|
||||
// RenderViewObserver methods.
|
||||
void OnDestruct() override;
|
||||
void DidStopLoading() override;
|
||||
void DidFailProvisionalLoad(blink::WebLocalFrame* frame,
|
||||
const blink::WebURLError& error) override;
|
||||
void DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
|
||||
@@ -126,6 +125,7 @@ class CefBrowserImpl : public CefBrowser, public content::RenderViewObserver {
|
||||
void OnRequest(const Cef_Request_Params& params);
|
||||
void OnResponse(const Cef_Response_Params& params);
|
||||
void OnResponseAck(int request_id);
|
||||
void OnDidStopLoading();
|
||||
|
||||
void OnLoadingStateChange(bool isLoading);
|
||||
void OnLoadStart(blink::WebLocalFrame* frame);
|
||||
|
@@ -45,11 +45,13 @@ class CefWebURLLoaderClient : public blink::WebURLLoaderClient {
|
||||
unsigned long long totalBytesToBeSent) override;
|
||||
void DidReceiveResponse(const WebURLResponse& response) override;
|
||||
void DidReceiveData(const char* data, int dataLength) override;
|
||||
void DidFinishLoading(base::TimeTicks finish_time,
|
||||
int64_t total_encoded_data_length,
|
||||
int64_t total_encoded_body_length,
|
||||
int64_t total_decoded_body_length,
|
||||
bool blocked_cross_site_document) override;
|
||||
void DidFinishLoading(
|
||||
base::TimeTicks finish_time,
|
||||
int64_t total_encoded_data_length,
|
||||
int64_t total_encoded_body_length,
|
||||
int64_t total_decoded_body_length,
|
||||
bool should_report_corb_blocking,
|
||||
const std::vector<network::cors::PreflightTimingInfo>&) override;
|
||||
void DidFail(const WebURLError&,
|
||||
int64_t total_encoded_data_length,
|
||||
int64_t total_encoded_body_length,
|
||||
@@ -294,11 +296,13 @@ void CefWebURLLoaderClient::DidReceiveData(const char* data, int dataLength) {
|
||||
context_->OnDownloadData(data, dataLength);
|
||||
}
|
||||
|
||||
void CefWebURLLoaderClient::DidFinishLoading(base::TimeTicks finish_time,
|
||||
int64_t total_encoded_data_length,
|
||||
int64_t total_encoded_body_length,
|
||||
int64_t total_decoded_body_length,
|
||||
bool blocked_cross_site_document) {
|
||||
void CefWebURLLoaderClient::DidFinishLoading(
|
||||
base::TimeTicks finish_time,
|
||||
int64_t total_encoded_data_length,
|
||||
int64_t total_encoded_body_length,
|
||||
int64_t total_decoded_body_length,
|
||||
bool should_report_corb_blocking,
|
||||
const std::vector<network::cors::PreflightTimingInfo>&) {
|
||||
context_->OnComplete();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user