mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-03-06 20:58:06 +01:00
Update to Chromium version 92.0.4515.0 (#885287)
This commit is contained in:
parent
f2f52c1e2c
commit
00dca9601e
7
BUILD.gn
7
BUILD.gn
@ -363,6 +363,9 @@ if (is_win) {
|
||||
|
||||
# Required by content_switches.cc
|
||||
"//media:media_buildflags",
|
||||
|
||||
# Required by crash_keys.cc (from base/stl_util.h)
|
||||
"//third_party/abseil-cpp:absl",
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -796,6 +799,10 @@ static_library("libcef_static") {
|
||||
# For Chrome runtime support.
|
||||
"//chrome/app/chrome_main_delegate.cc",
|
||||
"//chrome/app/chrome_main_delegate.h",
|
||||
|
||||
# Part of //content//test::test_support which is testingonly.
|
||||
"//content/public/test/scoped_web_ui_controller_factory_registration.cc",
|
||||
"//content/public/test/scoped_web_ui_controller_factory_registration.h",
|
||||
]
|
||||
|
||||
configs += [
|
||||
|
@ -7,5 +7,5 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/91.0.4472.0'
|
||||
'chromium_checkout': 'refs/tags/92.0.4515.0'
|
||||
}
|
||||
|
@ -311,13 +311,12 @@ AlloyBrowserContext::GetClientHintsControllerDelegate() {
|
||||
|
||||
ChromeZoomLevelPrefs* AlloyBrowserContext::GetZoomLevelPrefs() {
|
||||
return static_cast<ChromeZoomLevelPrefs*>(
|
||||
GetStoragePartition(this, nullptr)->GetZoomLevelDelegate());
|
||||
GetStoragePartition(nullptr)->GetZoomLevelDelegate());
|
||||
}
|
||||
|
||||
scoped_refptr<network::SharedURLLoaderFactory>
|
||||
AlloyBrowserContext::GetURLLoaderFactory() {
|
||||
return GetDefaultStoragePartition(this)
|
||||
->GetURLLoaderFactoryForBrowserProcess();
|
||||
return GetDefaultStoragePartition()->GetURLLoaderFactoryForBrowserProcess();
|
||||
}
|
||||
|
||||
base::FilePath AlloyBrowserContext::GetPath() {
|
||||
@ -339,18 +338,11 @@ AlloyBrowserContext::CreateZoomLevelDelegate(
|
||||
zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()));
|
||||
}
|
||||
|
||||
bool AlloyBrowserContext::IsOffTheRecord() const {
|
||||
// Alloy contexts are never flagged as off-the-record. It causes problems
|
||||
// for the extension system.
|
||||
return false;
|
||||
}
|
||||
|
||||
content::DownloadManagerDelegate*
|
||||
AlloyBrowserContext::GetDownloadManagerDelegate() {
|
||||
if (!download_manager_delegate_) {
|
||||
content::DownloadManager* manager =
|
||||
BrowserContext::GetDownloadManager(this);
|
||||
download_manager_delegate_.reset(new CefDownloadManagerDelegate(manager));
|
||||
download_manager_delegate_.reset(
|
||||
new CefDownloadManagerDelegate(GetDownloadManager()));
|
||||
}
|
||||
return download_manager_delegate_.get();
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
base::FilePath GetPath() const override;
|
||||
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
|
||||
const base::FilePath& partition_path) override;
|
||||
bool IsOffTheRecord() const override;
|
||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||
|
@ -639,7 +639,7 @@ void AlloyBrowserHostImpl::SendExternalBeginFrame() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&AlloyBrowserHostImpl::SendExternalBeginFrame, this));
|
||||
base::BindOnce(&AlloyBrowserHostImpl::SendExternalBeginFrame, this));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -654,8 +654,8 @@ void AlloyBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) {
|
||||
}
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&AlloyBrowserHostImpl::SendTouchEvent,
|
||||
this, event));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SendTouchEvent,
|
||||
this, event));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -800,10 +800,10 @@ bool AlloyBrowserHostImpl::MaybeAllowNavigation(
|
||||
// The PDF viewer will load the PDF extension in the guest view, and print
|
||||
// preview will load chrome://print in the guest view. All other navigations
|
||||
// are passed to the owner browser.
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(base::IgnoreResult(&AlloyBrowserHostImpl::OpenURLFromTab),
|
||||
this, nullptr, params));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(
|
||||
base::IgnoreResult(&AlloyBrowserHostImpl::OpenURLFromTab),
|
||||
this, nullptr, params));
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -1077,8 +1077,8 @@ void AlloyBrowserHostImpl::DragSourceEndedAt(
|
||||
|
||||
void AlloyBrowserHostImpl::SetAudioMuted(bool mute) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&AlloyBrowserHostImpl::SetAudioMuted, this, mute));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetAudioMuted,
|
||||
this, mute));
|
||||
return;
|
||||
}
|
||||
if (!web_contents())
|
||||
|
@ -109,7 +109,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
||||
#endif // defined(TOOLKIT_VIEWS)
|
||||
}
|
||||
|
||||
void AlloyBrowserMainParts::PreMainMessageLoopStart() {
|
||||
void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
|
||||
#if defined(USE_AURA) && defined(USE_X11)
|
||||
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
|
||||
#endif
|
||||
@ -129,7 +129,7 @@ void AlloyBrowserMainParts::PreMainMessageLoopStart() {
|
||||
media_router::ChromeMediaRouterFactory::DoPlatformInit();
|
||||
}
|
||||
|
||||
void AlloyBrowserMainParts::PostMainMessageLoopStart() {
|
||||
void AlloyBrowserMainParts::PostCreateMainMessageLoop() {
|
||||
#if defined(OS_LINUX)
|
||||
printing::PrintingContextLinux::SetCreatePrintDialogFunction(
|
||||
&CefPrintDialogLinux::CreatePrintDialog);
|
||||
@ -155,7 +155,8 @@ int AlloyBrowserMainParts::PreCreateThreads() {
|
||||
|
||||
int AlloyBrowserMainParts::PreMainMessageLoopRun() {
|
||||
#if defined(USE_AURA)
|
||||
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
|
||||
screen_ = views::CreateDesktopScreen();
|
||||
display::Screen::SetScreenInstance(screen_.get());
|
||||
#endif
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
|
@ -24,6 +24,9 @@ class ExtensionsClient;
|
||||
} // namespace extensions
|
||||
|
||||
#if defined(USE_AURA)
|
||||
namespace display {
|
||||
class Screen;
|
||||
}
|
||||
namespace wm {
|
||||
class WMState;
|
||||
}
|
||||
@ -47,8 +50,8 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
|
||||
|
||||
int PreEarlyInitialization() override;
|
||||
void ToolkitInitialized() override;
|
||||
void PreMainMessageLoopStart() override;
|
||||
void PostMainMessageLoopStart() override;
|
||||
void PreCreateMainMessageLoop() override;
|
||||
void PostCreateMainMessageLoop() override;
|
||||
int PreCreateThreads() override;
|
||||
int PreMainMessageLoopRun() override;
|
||||
void PostMainMessageLoopRun() override;
|
||||
@ -91,6 +94,7 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
|
||||
scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner_;
|
||||
|
||||
#if defined(USE_AURA)
|
||||
std::unique_ptr<display::Screen> screen_;
|
||||
std::unique_ptr<wm::WMState> wm_state_;
|
||||
#endif
|
||||
|
||||
|
@ -98,6 +98,7 @@
|
||||
#include "content/public/common/storage_quota_params.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "extensions/browser/event_router.h"
|
||||
#include "extensions/browser/extension_message_filter.h"
|
||||
#include "extensions/browser/extension_protocols.h"
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
@ -238,9 +239,10 @@ class CefAllowCertificateErrorCallbackImpl : public CefRequestCallback {
|
||||
RunNow(std::move(callback_), allow);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefAllowCertificateErrorCallbackImpl::Continue,
|
||||
this, allow));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefAllowCertificateErrorCallbackImpl::Continue, this,
|
||||
allow));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1043,6 +1045,11 @@ void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
|
||||
associated_registry->AddInterface(
|
||||
base::BindRepeating(&BindPluginInfoHost, host->GetID()));
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
associated_registry->AddInterface(base::BindRepeating(
|
||||
&extensions::EventRouter::BindForRenderer, host->GetID()));
|
||||
}
|
||||
|
||||
CefBrowserManager::ExposeInterfacesToRenderer(registry, associated_registry,
|
||||
host);
|
||||
}
|
||||
@ -1152,7 +1159,7 @@ bool AlloyContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
base::Optional<int64_t> navigation_id,
|
||||
absl::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
@ -1250,7 +1257,7 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const base::Optional<url::Origin>& initiating_origin,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||
// Call the other HandleExternalProtocol variant.
|
||||
return false;
|
||||
@ -1269,8 +1276,8 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
|
||||
// nothing handles the request.
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
web_contents_getter, frame_tree_node_id, resource_request,
|
||||
base::Bind(CefBrowserPlatformDelegate::HandleExternalProtocol,
|
||||
resource_request.url));
|
||||
base::BindRepeating(CefBrowserPlatformDelegate::HandleExternalProtocol,
|
||||
resource_request.url));
|
||||
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
web_contents_getter, std::move(receiver), std::move(request_handler));
|
||||
@ -1366,7 +1373,7 @@ bool AlloyContentBrowserClient::ArePersistentMediaDeviceIDsAllowed(
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& url,
|
||||
const GURL& site_for_cookies,
|
||||
const base::Optional<url::Origin>& top_frame_origin) {
|
||||
const absl::optional<url::Origin>& top_frame_origin) {
|
||||
// Persistent MediaDevice IDs are allowed if cookies are allowed.
|
||||
return CookieSettingsFactory::GetForProfile(
|
||||
Profile::FromBrowserContext(browser_context))
|
||||
|
@ -158,7 +158,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
base::Optional<int64_t> navigation_id,
|
||||
absl::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
@ -185,7 +185,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const base::Optional<url::Origin>& initiating_origin,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||
override;
|
||||
bool HandleExternalProtocol(
|
||||
@ -211,7 +211,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& scope,
|
||||
const GURL& site_for_cookies,
|
||||
const base::Optional<url::Origin>& top_frame_origin) override;
|
||||
const absl::optional<url::Origin>& top_frame_origin) override;
|
||||
bool ShouldAllowPluginCreation(
|
||||
const url::Origin& embedder_origin,
|
||||
const content::PepperPluginInfo& plugin_info) override;
|
||||
|
@ -379,12 +379,12 @@ void CefBrowserPlatformDelegateAlloy::PrintToPDF(
|
||||
return;
|
||||
printing::CefPrintViewManager::PdfPrintCallback pdf_callback;
|
||||
if (callback.get()) {
|
||||
pdf_callback = base::Bind(&CefPdfPrintCallback::OnPdfPrintFinished,
|
||||
callback.get(), path);
|
||||
pdf_callback = base::BindOnce(&CefPdfPrintCallback::OnPdfPrintFinished,
|
||||
callback.get(), path);
|
||||
}
|
||||
GetPrintViewManager(actionable_contents)
|
||||
->PrintToPDF(actionable_contents->GetMainFrame(), base::FilePath(path),
|
||||
settings, pdf_callback);
|
||||
settings, std::move(pdf_callback));
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::Find(int identifier,
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "libcef/browser/alloy/chrome_profile_alloy.h"
|
||||
|
||||
#include "base/no_destructor.h"
|
||||
#include "components/profile_metrics/browser_profile_type.h"
|
||||
#include "components/variations/variations_client.h"
|
||||
#include "components/variations/variations_ids_provider.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
@ -35,7 +36,10 @@ class CefVariationsClient : public variations::VariationsClient {
|
||||
|
||||
} // namespace
|
||||
|
||||
ChromeProfileAlloy::ChromeProfileAlloy() {}
|
||||
ChromeProfileAlloy::ChromeProfileAlloy() {
|
||||
profile_metrics::SetBrowserProfileType(
|
||||
this, profile_metrics::BrowserProfileType::kRegular);
|
||||
}
|
||||
|
||||
ChromeProfileAlloy::~ChromeProfileAlloy() {}
|
||||
|
||||
@ -44,13 +48,15 @@ bool ChromeProfileAlloy::IsOffTheRecord() {
|
||||
}
|
||||
|
||||
bool ChromeProfileAlloy::IsOffTheRecord() const {
|
||||
// Alloy contexts are never flagged as off-the-record. It causes problems
|
||||
// for the extension system.
|
||||
return false;
|
||||
}
|
||||
|
||||
const Profile::OTRProfileID& ChromeProfileAlloy::GetOTRProfileID() const {
|
||||
NOTREACHED();
|
||||
static base::NoDestructor<Profile::OTRProfileID> otr_profile_id(
|
||||
"ProfileImp::NoOTRProfileID");
|
||||
Profile::OTRProfileID::PrimaryID());
|
||||
return *otr_profile_id;
|
||||
}
|
||||
|
||||
@ -116,11 +122,6 @@ ChromeProfileAlloy::GetExtensionSpecialStoragePolicy() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PrefService* ChromeProfileAlloy::GetOffTheRecordPrefs() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ChromeProfileAlloy::IsSameOrParent(Profile* profile) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
|
@ -38,7 +38,6 @@ class ChromeProfileAlloy : public Profile {
|
||||
bool IsSupervised() const override;
|
||||
bool IsChild() const override;
|
||||
ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override;
|
||||
PrefService* GetOffTheRecordPrefs() override;
|
||||
bool IsSameOrParent(Profile* profile) override;
|
||||
base::Time GetStartTime() const override;
|
||||
base::FilePath last_selected_directory() override;
|
||||
|
@ -56,10 +56,3 @@ bool ChromeProfileManagerAlloy::IsValidProfile(const void* profile) {
|
||||
return !!CefBrowserContext::FromBrowserContext(
|
||||
static_cast<const content::BrowserContext*>(profile));
|
||||
}
|
||||
|
||||
Profile* ChromeProfileManagerAlloy::GetLastUsedProfile(
|
||||
const base::FilePath& user_data_dir) {
|
||||
// Override this method to avoid having to register prefs::kProfileLastUsed,
|
||||
// usage of which doesn't make sense for CEF.
|
||||
return GetActiveBrowserContext()->AsProfile();
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ class ChromeProfileManagerAlloy : public ProfileManager {
|
||||
|
||||
Profile* GetProfile(const base::FilePath& profile_dir) override;
|
||||
bool IsValidProfile(const void* profile) override;
|
||||
Profile* GetLastUsedProfile(const base::FilePath& user_data_dir) override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ChromeProfileManagerAlloy);
|
||||
|
@ -44,7 +44,7 @@ class StreamCreatedCallbackAdapter final
|
||||
client_receiver,
|
||||
media::mojom::ReadOnlyAudioDataPipePtr data_pipe,
|
||||
bool initially_muted,
|
||||
const base::Optional<base::UnguessableToken>& stream_id) override {
|
||||
const absl::optional<base::UnguessableToken>& stream_id) override {
|
||||
DCHECK(!initially_muted); // Loopback streams shouldn't be started muted.
|
||||
callback_.Run(std::move(stream), std::move(client_receiver),
|
||||
std::move(data_pipe));
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/browser_util.h"
|
||||
|
||||
#include "content/public/browser/focused_node_details.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/navigation_entry.h"
|
||||
@ -17,6 +18,7 @@
|
||||
#include "content/public/browser/notification_types.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
|
||||
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
|
||||
|
||||
using content::KeyboardEventProcessingResult;
|
||||
|
||||
@ -232,18 +234,6 @@ bool CefBrowserContentsDelegate::HandleKeyboardEvent(
|
||||
void CefBrowserContentsDelegate::RenderFrameCreated(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
browser_info_->MaybeCreateFrame(render_frame_host, false /* is_guest_view */);
|
||||
|
||||
if (render_frame_host->GetParent() == nullptr) {
|
||||
// May be already registered if the renderer crashed previously.
|
||||
auto render_view_host = render_frame_host->GetRenderViewHost();
|
||||
if (!registrar_->IsRegistered(
|
||||
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||
content::Source<content::RenderViewHost>(render_view_host))) {
|
||||
registrar_->Add(
|
||||
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||
content::Source<content::RenderViewHost>(render_view_host));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::RenderFrameHostChanged(
|
||||
@ -264,17 +254,6 @@ void CefBrowserContentsDelegate::RenderFrameDeleted(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::RenderViewDeleted(
|
||||
content::RenderViewHost* render_view_host) {
|
||||
if (registrar_->IsRegistered(
|
||||
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||
content::Source<content::RenderViewHost>(render_view_host))) {
|
||||
registrar_->Remove(
|
||||
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
|
||||
content::Source<content::RenderViewHost>(render_view_host));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::RenderViewReady() {
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetRequestHandler()) {
|
||||
@ -472,6 +451,13 @@ void CefBrowserContentsDelegate::OnWebContentsFocused(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::OnFocusChangedInPage(
|
||||
content::FocusedNodeDetails* details) {
|
||||
focus_on_editable_field_ =
|
||||
details->focus_type != blink::mojom::blink::FocusType::kNone &&
|
||||
details->is_editable_node;
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::WebContentsDestroyed() {
|
||||
auto wc = web_contents();
|
||||
ObserveWebContents(nullptr);
|
||||
@ -484,15 +470,12 @@ void CefBrowserContentsDelegate::Observe(
|
||||
int type,
|
||||
const content::NotificationSource& source,
|
||||
const content::NotificationDetails& details) {
|
||||
DCHECK(type == content::NOTIFICATION_LOAD_STOP ||
|
||||
type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE);
|
||||
DCHECK_EQ(type, content::NOTIFICATION_LOAD_STOP);
|
||||
|
||||
if (type == content::NOTIFICATION_LOAD_STOP) {
|
||||
content::NavigationController* controller =
|
||||
content::Source<content::NavigationController>(source).ptr();
|
||||
OnTitleChange(controller->GetWebContents()->GetTitle());
|
||||
} else if (type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE) {
|
||||
focus_on_editable_field_ = *content::Details<bool>(details).ptr();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "libcef/browser/frame_host_impl.h"
|
||||
|
||||
#include "base/callback_list.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "content/public/browser/notification_observer.h"
|
||||
#include "content/public/browser/notification_registrar.h"
|
||||
@ -108,7 +109,6 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
void RenderFrameHostChanged(content::RenderFrameHost* old_host,
|
||||
content::RenderFrameHost* new_host) override;
|
||||
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||
void RenderViewDeleted(content::RenderViewHost* render_view_host) override;
|
||||
void RenderViewReady() override;
|
||||
void RenderProcessGone(base::TerminationStatus status) override;
|
||||
void OnFrameFocused(content::RenderFrameHost* render_frame_host) override;
|
||||
@ -129,6 +129,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;
|
||||
void OnWebContentsFocused(
|
||||
content::RenderWidgetHost* render_widget_host) override;
|
||||
void OnFocusChangedInPage(content::FocusedNodeDetails* details) override;
|
||||
void WebContentsDestroyed() override;
|
||||
|
||||
// NotificationObserver methods.
|
||||
|
@ -300,9 +300,9 @@ void CefBrowserContext::OnRenderFrameCreated(
|
||||
frame_tree_node_id, handler);
|
||||
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefIOThreadState::AddHandler, iothread_state_,
|
||||
render_process_id, render_frame_id,
|
||||
frame_tree_node_id, handler));
|
||||
base::BindOnce(&CefIOThreadState::AddHandler, iothread_state_,
|
||||
render_process_id, render_frame_id,
|
||||
frame_tree_node_id, handler));
|
||||
}
|
||||
}
|
||||
|
||||
@ -332,9 +332,9 @@ void CefBrowserContext::OnRenderFrameDeleted(
|
||||
handler_map_.RemoveHandler(render_process_id, render_frame_id,
|
||||
frame_tree_node_id);
|
||||
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefIOThreadState::RemoveHandler,
|
||||
iothread_state_, render_process_id,
|
||||
render_frame_id, frame_tree_node_id));
|
||||
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefIOThreadState::RemoveHandler,
|
||||
iothread_state_, render_process_id,
|
||||
render_frame_id, frame_tree_node_id));
|
||||
}
|
||||
|
||||
if (is_main_frame) {
|
||||
@ -438,15 +438,16 @@ void CefBrowserContext::RegisterSchemeHandlerFactory(
|
||||
const CefString& scheme_name,
|
||||
const CefString& domain_name,
|
||||
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefIOThreadState::RegisterSchemeHandlerFactory,
|
||||
iothread_state_, scheme_name, domain_name, factory));
|
||||
CEF_POST_TASK(
|
||||
CEF_IOT,
|
||||
base::BindOnce(&CefIOThreadState::RegisterSchemeHandlerFactory,
|
||||
iothread_state_, scheme_name, domain_name, factory));
|
||||
}
|
||||
|
||||
void CefBrowserContext::ClearSchemeHandlerFactories() {
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefIOThreadState::ClearSchemeHandlerFactories,
|
||||
iothread_state_));
|
||||
base::BindOnce(&CefIOThreadState::ClearSchemeHandlerFactories,
|
||||
iothread_state_));
|
||||
}
|
||||
|
||||
void CefBrowserContext::LoadExtension(
|
||||
@ -482,8 +483,7 @@ bool CefBrowserContext::IsPrintPreviewSupported() const {
|
||||
network::mojom::NetworkContext* CefBrowserContext::GetNetworkContext() {
|
||||
CEF_REQUIRE_UIT();
|
||||
auto browser_context = AsBrowserContext();
|
||||
return browser_context->GetDefaultStoragePartition(browser_context)
|
||||
->GetNetworkContext();
|
||||
return browser_context->GetDefaultStoragePartition()->GetNetworkContext();
|
||||
}
|
||||
|
||||
CefMediaRouterManager* CefBrowserContext::GetMediaRouterManager() {
|
||||
@ -517,7 +517,7 @@ CefBrowserContext::GetGlobalCookieableSchemes() {
|
||||
CefString(&settings.cookieable_schemes_list),
|
||||
!settings.cookieable_schemes_exclude_defaults);
|
||||
}
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}());
|
||||
return *schemes;
|
||||
}
|
||||
|
@ -16,9 +16,9 @@
|
||||
#include "base/callback.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "chrome/common/plugin.mojom.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
/*
|
||||
@ -200,7 +200,7 @@ class CefBrowserContext {
|
||||
|
||||
CefMediaRouterManager* GetMediaRouterManager();
|
||||
|
||||
using CookieableSchemes = base::Optional<std::vector<std::string>>;
|
||||
using CookieableSchemes = absl::optional<std::vector<std::string>>;
|
||||
|
||||
// Returns the schemes associated with this context specifically, or the
|
||||
// global configuration if unset.
|
||||
|
@ -58,7 +58,7 @@ void CefBrowserFrame::DidFinishFrameLoad(const GURL& validated_url,
|
||||
}
|
||||
|
||||
void CefBrowserFrame::UpdateDraggableRegions(
|
||||
base::Optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
|
||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
|
||||
if (auto host = GetFrameHost()) {
|
||||
host->UpdateDraggableRegions(std::move(regions));
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class CefBrowserFrame
|
||||
void DidFinishFrameLoad(const GURL& validated_url,
|
||||
int32_t http_status_code) override;
|
||||
void UpdateDraggableRegions(
|
||||
base::Optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
|
||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
|
||||
override;
|
||||
|
||||
// FrameServiceBase methods:
|
||||
|
@ -232,8 +232,7 @@ void CefBrowserHostBase::StartDownload(const CefString& url) {
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
content::DownloadManager* manager =
|
||||
content::BrowserContext::GetDownloadManager(browser_context);
|
||||
content::DownloadManager* manager = browser_context->GetDownloadManager();
|
||||
if (!manager)
|
||||
return;
|
||||
|
||||
|
@ -56,8 +56,9 @@ void ChromeBrowserContext::InitializeAsync(base::OnceClosure initialized_cb) {
|
||||
// Create or load a specific disk-based profile. May continue
|
||||
// synchronously or asynchronously.
|
||||
profile_manager->CreateProfileAsync(
|
||||
cache_path_, base::Bind(&ChromeBrowserContext::ProfileCreated,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
cache_path_,
|
||||
base::BindRepeating(&ChromeBrowserContext::ProfileCreated,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
return;
|
||||
} else {
|
||||
// All profile directories must be relative to |user_data_dir|.
|
||||
@ -96,7 +97,8 @@ void ChromeBrowserContext::ProfileCreated(Profile* profile,
|
||||
const auto& profile_id = Profile::OTRProfileID::CreateUniqueForCEF();
|
||||
parent_profile =
|
||||
g_browser_process->profile_manager()->GetPrimaryUserProfile();
|
||||
profile_ = parent_profile->GetOffTheRecordProfile(profile_id);
|
||||
profile_ = parent_profile->GetOffTheRecordProfile(
|
||||
profile_id, /*create_if_needed=*/true);
|
||||
otr_profile = static_cast<OffTheRecordProfileImpl*>(profile_);
|
||||
status = Profile::CreateStatus::CREATE_STATUS_INITIALIZED;
|
||||
should_destroy_ = true;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/chrome/browser_delegate.h"
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
class CefBrowserContentsDelegate;
|
||||
class CefRequestContextImpl;
|
||||
|
@ -199,7 +199,7 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
base::Optional<int64_t> navigation_id,
|
||||
absl::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
@ -243,7 +243,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const base::Optional<url::Origin>& initiating_origin,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||
// |out_factory| will be non-nullptr when this method is initially called
|
||||
// from NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
|
||||
@ -273,9 +273,9 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||
// HandleExternalProtocolHelper may be called if nothing handles the request.
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
web_contents_getter, frame_tree_node_id, resource_request,
|
||||
base::Bind(HandleExternalProtocolHelper, base::Unretained(this),
|
||||
web_contents_getter, frame_tree_node_id, navigation_data,
|
||||
resource_request));
|
||||
base::BindRepeating(HandleExternalProtocolHelper, base::Unretained(this),
|
||||
web_contents_getter, frame_tree_node_id,
|
||||
navigation_data, resource_request));
|
||||
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
web_contents_getter, std::move(receiver), std::move(request_handler));
|
||||
|
@ -48,7 +48,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
base::Optional<int64_t> navigation_id,
|
||||
absl::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
@ -65,7 +65,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const base::Optional<url::Origin>& initiating_origin,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||
override;
|
||||
bool HandleExternalProtocol(
|
||||
|
@ -111,7 +111,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
}
|
||||
|
||||
void SetAccelerator(int command_id,
|
||||
base::Optional<ui::Accelerator> accel) override {
|
||||
absl::optional<ui::Accelerator> accel) override {
|
||||
// No-op if already at the default state.
|
||||
if (!accel && !GetItemInfo(command_id))
|
||||
return;
|
||||
@ -127,7 +127,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
ItemInfo() {}
|
||||
|
||||
bool checked = false;
|
||||
base::Optional<ui::Accelerator> accel;
|
||||
absl::optional<ui::Accelerator> accel;
|
||||
};
|
||||
|
||||
ItemInfo* GetItemInfo(int command_id) {
|
||||
|
@ -74,7 +74,7 @@ ToolbarView* ChromeBrowserView::OverrideCreateToolbar(
|
||||
BrowserView* browser_view) {
|
||||
if (cef_delegate()) {
|
||||
auto toolbar_type = cef_delegate()->GetChromeToolbarType();
|
||||
base::Optional<ToolbarView::DisplayMode> display_mode;
|
||||
absl::optional<ToolbarView::DisplayMode> display_mode;
|
||||
switch (toolbar_type) {
|
||||
case CEF_CTT_NORMAL:
|
||||
display_mode = ToolbarView::DisplayMode::NORMAL;
|
||||
|
@ -9,7 +9,7 @@ CefRefPtr<CefToolbarViewImpl> CefToolbarViewImpl::Create(
|
||||
CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<ToolbarView::DisplayMode> display_mode) {
|
||||
absl::optional<ToolbarView::DisplayMode> display_mode) {
|
||||
CEF_REQUIRE_UIT_RETURN(nullptr);
|
||||
CefRefPtr<CefToolbarViewImpl> view =
|
||||
new CefToolbarViewImpl(delegate, browser, browser_view, display_mode);
|
||||
@ -24,7 +24,7 @@ CefToolbarViewImpl::CefToolbarViewImpl(
|
||||
CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<ToolbarView::DisplayMode> display_mode)
|
||||
absl::optional<ToolbarView::DisplayMode> display_mode)
|
||||
: ParentClass(delegate),
|
||||
browser_(browser),
|
||||
browser_view_(browser_view),
|
||||
|
@ -24,7 +24,7 @@ class CefToolbarViewImpl
|
||||
CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<ToolbarView::DisplayMode> display_mode);
|
||||
absl::optional<ToolbarView::DisplayMode> display_mode);
|
||||
|
||||
static const char* const kTypeString;
|
||||
|
||||
@ -38,7 +38,7 @@ class CefToolbarViewImpl
|
||||
CefToolbarViewImpl(CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<ToolbarView::DisplayMode> display_mode);
|
||||
absl::optional<ToolbarView::DisplayMode> display_mode);
|
||||
|
||||
// CefViewImpl methods:
|
||||
CefToolbarViewView* CreateRootView() override;
|
||||
@ -46,7 +46,7 @@ class CefToolbarViewImpl
|
||||
|
||||
Browser* const browser_;
|
||||
BrowserView* const browser_view_;
|
||||
base::Optional<ToolbarView::DisplayMode> const display_mode_;
|
||||
absl::optional<ToolbarView::DisplayMode> const display_mode_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefToolbarViewImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefToolbarViewImpl);
|
||||
|
@ -7,5 +7,5 @@
|
||||
CefToolbarViewView::CefToolbarViewView(CefViewDelegate* cef_delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<DisplayMode> display_mode)
|
||||
absl::optional<DisplayMode> display_mode)
|
||||
: ParentClass(cef_delegate, browser, browser_view, display_mode) {}
|
||||
|
@ -18,7 +18,7 @@ class CefToolbarViewView : public CefViewView<ToolbarView, CefViewDelegate> {
|
||||
explicit CefToolbarViewView(CefViewDelegate* cef_delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
base::Optional<DisplayMode> display_mode);
|
||||
absl::optional<DisplayMode> display_mode);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CefToolbarViewView);
|
||||
|
@ -294,10 +294,12 @@ void CefSetOSModalLoop(bool osModalLoop) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (CEF_CURRENTLY_ON_UIT())
|
||||
base::CurrentThread::Get()->set_os_modal_loop(osModalLoop);
|
||||
else
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(CefSetOSModalLoop, osModalLoop));
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(CefSetOSModalLoop, osModalLoop));
|
||||
return;
|
||||
}
|
||||
|
||||
base::CurrentThread::Get()->set_os_modal_loop(osModalLoop);
|
||||
#endif // defined(OS_WIN)
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ void WriteToFile(const base::FilePath& path, const std::string& content) {
|
||||
|
||||
void AppendToFile(const base::FilePath& path, const std::string& content) {
|
||||
DCHECK(!path.empty());
|
||||
base::AppendToFile(path, content.c_str(), content.size());
|
||||
base::AppendToFile(path, base::StringPiece(content));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -53,27 +53,27 @@ void CefDevToolsFileManager::SaveToFile(const std::string& url,
|
||||
const std::string& content,
|
||||
bool save_as) {
|
||||
Save(url, content, save_as,
|
||||
base::Bind(&CefDevToolsFileManager::FileSavedAs,
|
||||
weak_factory_.GetWeakPtr(), url),
|
||||
base::Bind(&CefDevToolsFileManager::CanceledFileSaveAs,
|
||||
weak_factory_.GetWeakPtr(), url));
|
||||
base::BindOnce(&CefDevToolsFileManager::FileSavedAs,
|
||||
weak_factory_.GetWeakPtr(), url),
|
||||
base::BindOnce(&CefDevToolsFileManager::CanceledFileSaveAs,
|
||||
weak_factory_.GetWeakPtr(), url));
|
||||
}
|
||||
|
||||
void CefDevToolsFileManager::AppendToFile(const std::string& url,
|
||||
const std::string& content) {
|
||||
Append(url, content,
|
||||
base::Bind(&CefDevToolsFileManager::AppendedTo,
|
||||
weak_factory_.GetWeakPtr(), url));
|
||||
base::BindOnce(&CefDevToolsFileManager::AppendedTo,
|
||||
weak_factory_.GetWeakPtr(), url));
|
||||
}
|
||||
|
||||
void CefDevToolsFileManager::Save(const std::string& url,
|
||||
const std::string& content,
|
||||
bool save_as,
|
||||
const SaveCallback& saveCallback,
|
||||
const CancelCallback& cancelCallback) {
|
||||
SaveCallback saveCallback,
|
||||
CancelCallback cancelCallback) {
|
||||
auto it = saved_files_.find(url);
|
||||
if (it != saved_files_.end() && !save_as) {
|
||||
SaveAsFileSelected(url, content, saveCallback, it->second);
|
||||
SaveAsFileSelected(url, content, std::move(saveCallback), it->second);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ void CefDevToolsFileManager::Save(const std::string& url,
|
||||
|
||||
const base::Value* path_value;
|
||||
if (file_map->Get(base::MD5String(url), &path_value)) {
|
||||
base::Optional<base::FilePath> path = util::ValueToFilePath(*path_value);
|
||||
absl::optional<base::FilePath> path = util::ValueToFilePath(*path_value);
|
||||
if (path)
|
||||
initial_path = std::move(*path);
|
||||
}
|
||||
@ -116,28 +116,29 @@ void CefDevToolsFileManager::Save(const std::string& url,
|
||||
}
|
||||
|
||||
browser_impl_->RunFileChooser(
|
||||
params, base::Bind(&CefDevToolsFileManager::SaveAsDialogDismissed,
|
||||
weak_factory_.GetWeakPtr(), url, content, saveCallback,
|
||||
cancelCallback));
|
||||
params,
|
||||
base::BindOnce(&CefDevToolsFileManager::SaveAsDialogDismissed,
|
||||
weak_factory_.GetWeakPtr(), url, content,
|
||||
std::move(saveCallback), std::move(cancelCallback)));
|
||||
}
|
||||
|
||||
void CefDevToolsFileManager::SaveAsDialogDismissed(
|
||||
const std::string& url,
|
||||
const std::string& content,
|
||||
const SaveCallback& saveCallback,
|
||||
const CancelCallback& cancelCallback,
|
||||
SaveCallback saveCallback,
|
||||
CancelCallback cancelCallback,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths) {
|
||||
if (file_paths.size() == 1) {
|
||||
SaveAsFileSelected(url, content, saveCallback, file_paths[0]);
|
||||
SaveAsFileSelected(url, content, std::move(saveCallback), file_paths[0]);
|
||||
} else {
|
||||
cancelCallback.Run();
|
||||
std::move(cancelCallback).Run();
|
||||
}
|
||||
}
|
||||
|
||||
void CefDevToolsFileManager::SaveAsFileSelected(const std::string& url,
|
||||
const std::string& content,
|
||||
const SaveCallback& callback,
|
||||
SaveCallback callback,
|
||||
const base::FilePath& path) {
|
||||
*g_last_save_path.Pointer() = path;
|
||||
saved_files_[url] = path;
|
||||
@ -146,7 +147,7 @@ void CefDevToolsFileManager::SaveAsFileSelected(const std::string& url,
|
||||
base::DictionaryValue* files_map = update.Get();
|
||||
files_map->SetKey(base::MD5String(url), util::FilePathToValue(path));
|
||||
std::string file_system_path = path.AsUTF8Unsafe();
|
||||
callback.Run(file_system_path);
|
||||
std::move(callback).Run(file_system_path);
|
||||
file_task_runner_->PostTask(FROM_HERE,
|
||||
base::BindOnce(&::WriteToFile, path, content));
|
||||
}
|
||||
@ -167,11 +168,11 @@ void CefDevToolsFileManager::CanceledFileSaveAs(const std::string& url) {
|
||||
|
||||
void CefDevToolsFileManager::Append(const std::string& url,
|
||||
const std::string& content,
|
||||
const AppendCallback& callback) {
|
||||
AppendCallback callback) {
|
||||
auto it = saved_files_.find(url);
|
||||
if (it == saved_files_.end())
|
||||
return;
|
||||
callback.Run();
|
||||
std::move(callback).Run();
|
||||
file_task_runner_->PostTask(
|
||||
FROM_HERE, base::BindOnce(&::AppendToFile, it->second, content));
|
||||
}
|
||||
|
@ -36,31 +36,31 @@ class CefDevToolsFileManager {
|
||||
|
||||
private:
|
||||
// SaveToFile implementation:
|
||||
typedef base::Callback<void(const std::string&)> SaveCallback;
|
||||
typedef base::Callback<void()> CancelCallback;
|
||||
typedef base::OnceCallback<void(const std::string&)> SaveCallback;
|
||||
typedef base::OnceCallback<void()> CancelCallback;
|
||||
void Save(const std::string& url,
|
||||
const std::string& content,
|
||||
bool save_as,
|
||||
const SaveCallback& saveCallback,
|
||||
const CancelCallback& cancelCallback);
|
||||
SaveCallback saveCallback,
|
||||
CancelCallback cancelCallback);
|
||||
void SaveAsDialogDismissed(const std::string& url,
|
||||
const std::string& content,
|
||||
const SaveCallback& saveCallback,
|
||||
const CancelCallback& cancelCallback,
|
||||
SaveCallback saveCallback,
|
||||
CancelCallback cancelCallback,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths);
|
||||
void SaveAsFileSelected(const std::string& url,
|
||||
const std::string& content,
|
||||
const SaveCallback& callback,
|
||||
SaveCallback callback,
|
||||
const base::FilePath& path);
|
||||
void FileSavedAs(const std::string& url, const std::string& file_system_path);
|
||||
void CanceledFileSaveAs(const std::string& url);
|
||||
|
||||
// AppendToFile implementation:
|
||||
typedef base::Callback<void(void)> AppendCallback;
|
||||
typedef base::OnceCallback<void(void)> AppendCallback;
|
||||
void Append(const std::string& url,
|
||||
const std::string& content,
|
||||
const AppendCallback& callback);
|
||||
AppendCallback callback);
|
||||
void AppendedTo(const std::string& url);
|
||||
|
||||
void CallClientFunction(const std::string& function_name,
|
||||
|
@ -160,7 +160,7 @@ void LogProtocolMessage(const base::FilePath& log_file,
|
||||
WriteTimestamp(stream);
|
||||
stream << ": " << type_label << ": " << to_log << "\n";
|
||||
const std::string& str = stream.str();
|
||||
if (!base::AppendToFile(log_file, str.c_str(), str.size())) {
|
||||
if (!base::AppendToFile(log_file, base::StringPiece(str))) {
|
||||
LOG(ERROR) << "Failed to write file " << log_file.value();
|
||||
log_error = true;
|
||||
}
|
||||
@ -294,8 +294,8 @@ void CefDevToolsFrontend::InspectElementAt(int x, int y) {
|
||||
|
||||
void CefDevToolsFrontend::Close() {
|
||||
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
|
||||
base::Bind(&AlloyBrowserHostImpl::CloseBrowser,
|
||||
frontend_browser_.get(), true));
|
||||
base::BindOnce(&AlloyBrowserHostImpl::CloseBrowser,
|
||||
frontend_browser_.get(), true));
|
||||
}
|
||||
|
||||
CefDevToolsFrontend::CefDevToolsFrontend(
|
||||
@ -323,8 +323,8 @@ void CefDevToolsFrontend::ReadyToCommitNavigation(
|
||||
content::RenderFrameHost* frame = navigation_handle->GetRenderFrameHost();
|
||||
if (navigation_handle->IsInMainFrame()) {
|
||||
frontend_host_ = content::DevToolsFrontendHost::Create(
|
||||
frame,
|
||||
base::Bind(&CefDevToolsFrontend::HandleMessageFromDevToolsFrontend,
|
||||
frame, base::BindRepeating(
|
||||
&CefDevToolsFrontend::HandleMessageFromDevToolsFrontend,
|
||||
base::Unretained(this)));
|
||||
return;
|
||||
}
|
||||
@ -367,13 +367,11 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
const std::string& message) {
|
||||
base::Value message) {
|
||||
std::string method;
|
||||
base::ListValue* params = nullptr;
|
||||
base::DictionaryValue* dict = nullptr;
|
||||
base::Optional<base::Value> parsed_message = base::JSONReader::Read(message);
|
||||
if (!parsed_message || !parsed_message->GetAsDictionary(&dict) ||
|
||||
!dict->GetString("method", &method)) {
|
||||
if (!message.GetAsDictionary(&dict) || !dict->GetString("method", &method)) {
|
||||
return;
|
||||
}
|
||||
int request_id = 0;
|
||||
@ -461,8 +459,8 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
SendMessageAck(request_id, &response);
|
||||
return;
|
||||
} else {
|
||||
auto* partition = content::BrowserContext::GetStoragePartitionForUrl(
|
||||
web_contents()->GetBrowserContext(), gurl);
|
||||
auto* partition =
|
||||
web_contents()->GetBrowserContext()->GetStoragePartitionForUrl(gurl);
|
||||
url_loader_factory = partition->GetURLLoaderFactoryForBrowserProcess();
|
||||
}
|
||||
|
||||
@ -608,7 +606,7 @@ void CefDevToolsFrontend::LogProtocolMessage(ProtocolMessageType type,
|
||||
const base::StringPiece& message) {
|
||||
DCHECK(ProtocolLoggingEnabled());
|
||||
|
||||
std::string to_log = message.substr(0, kMaxLogLineLength).as_string();
|
||||
std::string to_log(message.substr(0, kMaxLogLineLength));
|
||||
|
||||
// Execute in an ordered context that allows blocking.
|
||||
auto task_runner = CefTaskRunnerManager::Get()->GetBackgroundTaskRunner();
|
||||
|
@ -70,7 +70,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
|
||||
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
|
||||
base::span<const uint8_t> message) override;
|
||||
void HandleMessageFromDevToolsFrontend(const std::string& message);
|
||||
void HandleMessageFromDevToolsFrontend(base::Value message);
|
||||
|
||||
private:
|
||||
// WebContentsObserver overrides
|
||||
|
@ -62,7 +62,7 @@ class CefDevToolsRegistrationImpl : public CefRegistration,
|
||||
void OnDevToolsEvent(const base::StringPiece& method,
|
||||
const base::StringPiece& params) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
observer_->OnDevToolsEvent(browser_, method.as_string(), params.data(),
|
||||
observer_->OnDevToolsEvent(browser_, std::string(method), params.data(),
|
||||
params.size());
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsEvent) {
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsEvent());
|
||||
EXPECT_STREQ("Test.myMethod", parser.method_.as_string().data());
|
||||
EXPECT_STREQ("Test.myMethod", parser.method_.data());
|
||||
EXPECT_TRUE(parser.params_.empty());
|
||||
|
||||
parser.Reset();
|
||||
@ -94,8 +94,8 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsEvent) {
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsEvent());
|
||||
EXPECT_STREQ("Test.myMethod2", parser.method_.as_string().data());
|
||||
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||
EXPECT_STREQ("Test.myMethod2", parser.method_.data());
|
||||
EXPECT_STREQ("{}", parser.params_.data());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
@ -105,8 +105,8 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsEvent) {
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsEvent());
|
||||
EXPECT_STREQ("Test.myMethod3", parser.method_.as_string().data());
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||
EXPECT_STREQ("Test.myMethod3", parser.method_.data());
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.data());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsFailure_ResultMalformed) {
|
||||
@ -162,7 +162,7 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Result) {
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(1, parser.message_id_);
|
||||
EXPECT_TRUE(parser.success_);
|
||||
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||
EXPECT_STREQ("{}", parser.params_.data());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
@ -174,7 +174,7 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Result) {
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(2, parser.message_id_);
|
||||
EXPECT_TRUE(parser.success_);
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.data());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Error) {
|
||||
@ -188,7 +188,7 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Error) {
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(1, parser.message_id_);
|
||||
EXPECT_FALSE(parser.success_);
|
||||
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||
EXPECT_STREQ("{}", parser.params_.data());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
@ -200,5 +200,5 @@ TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Error) {
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(2, parser.message_id_);
|
||||
EXPECT_FALSE(parser.success_);
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.data());
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DownloadItem::MixedContentStatus::UNKNOWN, suggested_path,
|
||||
base::nullopt /*download_schedule*/,
|
||||
absl::nullopt /*download_schedule*/,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
}
|
||||
}
|
||||
@ -172,7 +172,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
std::move(callback).Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DownloadItem::MixedContentStatus::UNKNOWN,
|
||||
path, base::nullopt /*download_schedule*/,
|
||||
path, absl::nullopt /*download_schedule*/,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
}
|
||||
|
||||
@ -195,17 +195,17 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
|
||||
|
||||
void Cancel() override {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefDownloadItemCallbackImpl::DoCancel, this));
|
||||
base::BindOnce(&CefDownloadItemCallbackImpl::DoCancel, this));
|
||||
}
|
||||
|
||||
void Pause() override {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefDownloadItemCallbackImpl::DoPause, this));
|
||||
base::BindOnce(&CefDownloadItemCallbackImpl::DoPause, this));
|
||||
}
|
||||
|
||||
void Resume() override {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefDownloadItemCallbackImpl::DoResume, this));
|
||||
base::BindOnce(&CefDownloadItemCallbackImpl::DoResume, this));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -358,7 +358,7 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
||||
item->GetForcedFilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DownloadItem::MixedContentStatus::UNKNOWN,
|
||||
item->GetForcedFilePath(), base::nullopt /*download_schedule*/,
|
||||
item->GetForcedFilePath(), absl::nullopt /*download_schedule*/,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
return true;
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "extensions/common/permissions/permissions_data.h"
|
||||
#include "third_party/blink/public/common/page/page_zoom.h"
|
||||
|
||||
using zoom::ZoomController;
|
||||
|
||||
namespace extensions {
|
||||
namespace cef {
|
||||
|
||||
@ -256,153 +258,124 @@ content::WebContents* ZoomAPIFunction::GetWebContents(int tab_id) {
|
||||
return browser->web_contents();
|
||||
}
|
||||
|
||||
void ZoomAPIFunction::SendResponse(bool success) {
|
||||
ResponseValue response;
|
||||
if (success) {
|
||||
response = ArgumentList(std::move(results_));
|
||||
} else {
|
||||
response = results_ ? ErrorWithArguments(std::move(results_), error_)
|
||||
: Error(error_);
|
||||
}
|
||||
Respond(std::move(response));
|
||||
}
|
||||
|
||||
ExtensionFunction::ResponseAction ZoomAPIFunction::Run() {
|
||||
if (RunAsync())
|
||||
return RespondLater();
|
||||
// TODO(devlin): Track these down and eliminate them if possible. We
|
||||
// shouldn't return results and an error.
|
||||
if (results_)
|
||||
return RespondNow(ErrorWithArguments(std::move(results_), error_));
|
||||
return RespondNow(Error(error_));
|
||||
}
|
||||
|
||||
bool TabsSetZoomFunction::RunAsync() {
|
||||
ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||
std::unique_ptr<tabs::SetZoom::Params> params(
|
||||
tabs::SetZoom::Params::Create(*args_));
|
||||
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
content::WebContents* web_contents = GetWebContents(tab_id);
|
||||
if (!web_contents)
|
||||
return false;
|
||||
return RespondNow(Error(std::move(error_)));
|
||||
|
||||
GURL url(web_contents->GetVisibleURL());
|
||||
if (extension()->permissions_data()->IsRestrictedUrl(url, &error_))
|
||||
return false;
|
||||
return RespondNow(Error(std::move(error_)));
|
||||
|
||||
zoom::ZoomController* zoom_controller =
|
||||
zoom::ZoomController::FromWebContents(web_contents);
|
||||
ZoomController* zoom_controller =
|
||||
ZoomController::FromWebContents(web_contents);
|
||||
double zoom_level =
|
||||
params->zoom_factor > 0
|
||||
? blink::PageZoomFactorToZoomLevel(params->zoom_factor)
|
||||
: zoom_controller->GetDefaultZoomLevel();
|
||||
|
||||
scoped_refptr<extensions::ExtensionZoomRequestClient> client(
|
||||
new extensions::ExtensionZoomRequestClient(extension()));
|
||||
auto client = base::MakeRefCounted<ExtensionZoomRequestClient>(extension());
|
||||
if (!zoom_controller->SetZoomLevelByClient(zoom_level, client)) {
|
||||
// Tried to zoom a tab in disabled mode.
|
||||
error_ = keys::kCannotZoomDisabledTabError;
|
||||
return false;
|
||||
return RespondNow(Error(tabs_constants::kCannotZoomDisabledTabError));
|
||||
}
|
||||
|
||||
SendResponse(true);
|
||||
return true;
|
||||
return RespondNow(NoArguments());
|
||||
}
|
||||
|
||||
bool TabsGetZoomFunction::RunAsync() {
|
||||
ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
||||
std::unique_ptr<tabs::GetZoom::Params> params(
|
||||
tabs::GetZoom::Params::Create(*args_));
|
||||
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
content::WebContents* web_contents = GetWebContents(tab_id);
|
||||
if (!web_contents)
|
||||
return false;
|
||||
return RespondNow(Error(std::move(error_)));
|
||||
|
||||
double zoom_level =
|
||||
zoom::ZoomController::FromWebContents(web_contents)->GetZoomLevel();
|
||||
double zoom_factor = blink::PageZoomLevelToZoomFactor(zoom_level);
|
||||
results_ = tabs::GetZoom::Results::Create(zoom_factor);
|
||||
SendResponse(true);
|
||||
return true;
|
||||
|
||||
return RespondNow(ArgumentList(tabs::GetZoom::Results::Create(zoom_factor)));
|
||||
}
|
||||
|
||||
bool TabsSetZoomSettingsFunction::RunAsync() {
|
||||
ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
||||
using api::tabs::ZoomSettings;
|
||||
|
||||
std::unique_ptr<tabs::SetZoomSettings::Params> params(
|
||||
tabs::SetZoomSettings::Params::Create(*args_));
|
||||
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
content::WebContents* web_contents = GetWebContents(tab_id);
|
||||
if (!web_contents)
|
||||
return false;
|
||||
return RespondNow(Error(std::move(error_)));
|
||||
|
||||
GURL url(web_contents->GetVisibleURL());
|
||||
std::string error;
|
||||
if (extension()->permissions_data()->IsRestrictedUrl(url, &error_))
|
||||
return false;
|
||||
return RespondNow(Error(std::move(error_)));
|
||||
|
||||
// "per-origin" scope is only available in "automatic" mode.
|
||||
if (params->zoom_settings.scope == tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN &&
|
||||
params->zoom_settings.mode != tabs::ZOOM_SETTINGS_MODE_AUTOMATIC &&
|
||||
params->zoom_settings.mode != tabs::ZOOM_SETTINGS_MODE_NONE) {
|
||||
error_ = keys::kPerOriginOnlyInAutomaticError;
|
||||
return false;
|
||||
return RespondNow(Error(tabs_constants::kPerOriginOnlyInAutomaticError));
|
||||
}
|
||||
|
||||
// Determine the correct internal zoom mode to set |web_contents| to from the
|
||||
// user-specified |zoom_settings|.
|
||||
zoom::ZoomController::ZoomMode zoom_mode =
|
||||
zoom::ZoomController::ZOOM_MODE_DEFAULT;
|
||||
ZoomController::ZoomMode zoom_mode = ZoomController::ZOOM_MODE_DEFAULT;
|
||||
switch (params->zoom_settings.mode) {
|
||||
case tabs::ZOOM_SETTINGS_MODE_NONE:
|
||||
case tabs::ZOOM_SETTINGS_MODE_AUTOMATIC:
|
||||
switch (params->zoom_settings.scope) {
|
||||
case tabs::ZOOM_SETTINGS_SCOPE_NONE:
|
||||
case tabs::ZOOM_SETTINGS_SCOPE_PER_ORIGIN:
|
||||
zoom_mode = zoom::ZoomController::ZOOM_MODE_DEFAULT;
|
||||
zoom_mode = ZoomController::ZOOM_MODE_DEFAULT;
|
||||
break;
|
||||
case tabs::ZOOM_SETTINGS_SCOPE_PER_TAB:
|
||||
zoom_mode = zoom::ZoomController::ZOOM_MODE_ISOLATED;
|
||||
zoom_mode = ZoomController::ZOOM_MODE_ISOLATED;
|
||||
}
|
||||
break;
|
||||
case tabs::ZOOM_SETTINGS_MODE_MANUAL:
|
||||
zoom_mode = zoom::ZoomController::ZOOM_MODE_MANUAL;
|
||||
zoom_mode = ZoomController::ZOOM_MODE_MANUAL;
|
||||
break;
|
||||
case tabs::ZOOM_SETTINGS_MODE_DISABLED:
|
||||
zoom_mode = zoom::ZoomController::ZOOM_MODE_DISABLED;
|
||||
zoom_mode = ZoomController::ZOOM_MODE_DISABLED;
|
||||
}
|
||||
|
||||
zoom::ZoomController::FromWebContents(web_contents)->SetZoomMode(zoom_mode);
|
||||
ZoomController::FromWebContents(web_contents)->SetZoomMode(zoom_mode);
|
||||
|
||||
SendResponse(true);
|
||||
return true;
|
||||
return RespondNow(NoArguments());
|
||||
}
|
||||
|
||||
bool TabsGetZoomSettingsFunction::RunAsync() {
|
||||
ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
||||
std::unique_ptr<tabs::GetZoomSettings::Params> params(
|
||||
tabs::GetZoomSettings::Params::Create(*args_));
|
||||
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
int tab_id = params->tab_id ? *params->tab_id : -1;
|
||||
content::WebContents* web_contents = GetWebContents(tab_id);
|
||||
if (!web_contents)
|
||||
return false;
|
||||
zoom::ZoomController* zoom_controller =
|
||||
zoom::ZoomController::FromWebContents(web_contents);
|
||||
return RespondNow(Error(std::move(error_)));
|
||||
ZoomController* zoom_controller =
|
||||
ZoomController::FromWebContents(web_contents);
|
||||
|
||||
zoom::ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode();
|
||||
ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode();
|
||||
api::tabs::ZoomSettings zoom_settings;
|
||||
ZoomModeToZoomSettings(zoom_mode, &zoom_settings);
|
||||
zoom_settings.default_zoom_factor.reset(
|
||||
new double(blink::PageZoomLevelToZoomFactor(
|
||||
zoom_controller->GetDefaultZoomLevel())));
|
||||
zoom_settings.default_zoom_factor = std::make_unique<double>(
|
||||
blink::PageZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()));
|
||||
|
||||
results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings);
|
||||
SendResponse(true);
|
||||
return true;
|
||||
return RespondNow(
|
||||
ArgumentList(api::tabs::GetZoomSettings::Results::Create(zoom_settings)));
|
||||
}
|
||||
|
||||
} // namespace cef
|
||||
|
@ -108,23 +108,9 @@ class ZoomAPIFunction : public ExtensionFunction {
|
||||
// may set |error_|.
|
||||
content::WebContents* GetWebContents(int tab_id);
|
||||
|
||||
virtual bool RunAsync() = 0;
|
||||
|
||||
// Responds with success/failure. |results_| or |error_| should be set
|
||||
// accordingly.
|
||||
void SendResponse(bool success);
|
||||
|
||||
// Exposed versions of ExtensionFunction::results_ and
|
||||
// ExtensionFunction::error_ that are curried into the response.
|
||||
// These need to keep the same name to avoid breaking existing
|
||||
// implementations, but this should be temporary with crbug.com/648275
|
||||
// and crbug.com/634140.
|
||||
std::unique_ptr<base::ListValue> results_;
|
||||
std::string error_;
|
||||
|
||||
private:
|
||||
ResponseAction Run() final;
|
||||
|
||||
const CefExtensionFunctionDetails cef_details_;
|
||||
};
|
||||
|
||||
@ -132,7 +118,7 @@ class TabsSetZoomFunction : public ZoomAPIFunction {
|
||||
private:
|
||||
~TabsSetZoomFunction() override {}
|
||||
|
||||
bool RunAsync() override;
|
||||
ResponseAction Run() override;
|
||||
|
||||
DECLARE_EXTENSION_FUNCTION("tabs.setZoom", TABS_SETZOOM)
|
||||
};
|
||||
@ -141,7 +127,7 @@ class TabsGetZoomFunction : public ZoomAPIFunction {
|
||||
private:
|
||||
~TabsGetZoomFunction() override {}
|
||||
|
||||
bool RunAsync() override;
|
||||
ResponseAction Run() override;
|
||||
|
||||
DECLARE_EXTENSION_FUNCTION("tabs.getZoom", TABS_GETZOOM)
|
||||
};
|
||||
@ -150,7 +136,7 @@ class TabsSetZoomSettingsFunction : public ZoomAPIFunction {
|
||||
private:
|
||||
~TabsSetZoomSettingsFunction() override {}
|
||||
|
||||
bool RunAsync() override;
|
||||
ResponseAction Run() override;
|
||||
|
||||
DECLARE_EXTENSION_FUNCTION("tabs.setZoomSettings", TABS_SETZOOMSETTINGS)
|
||||
};
|
||||
@ -159,7 +145,7 @@ class TabsGetZoomSettingsFunction : public ZoomAPIFunction {
|
||||
private:
|
||||
~TabsGetZoomSettingsFunction() override {}
|
||||
|
||||
bool RunAsync() override;
|
||||
ResponseAction Run() override;
|
||||
|
||||
DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS)
|
||||
};
|
||||
|
@ -54,8 +54,8 @@ void GetAllGuestsForOwnerContents(content::WebContents* owner,
|
||||
std::vector<content::WebContents*>* guests) {
|
||||
content::BrowserPluginGuestManager* plugin_guest_manager =
|
||||
owner->GetBrowserContext()->GetGuestManager();
|
||||
plugin_guest_manager->ForEachGuest(owner,
|
||||
base::Bind(InsertWebContents, guests));
|
||||
plugin_guest_manager->ForEachGuest(
|
||||
owner, base::BindRepeating(InsertWebContents, guests));
|
||||
}
|
||||
|
||||
content::WebContents* GetOwnerForGuestContents(content::WebContents* guest) {
|
||||
|
@ -29,8 +29,8 @@ void CefBrowserPlatformDelegateBackground::CloseHostWindow() {
|
||||
// No host window, so continue browser destruction now. Do it asynchronously
|
||||
// so the call stack has a chance to unwind.
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&AlloyBrowserHostImpl::WindowDestroyed,
|
||||
static_cast<AlloyBrowserHostImpl*>(browser_)));
|
||||
base::BindOnce(&AlloyBrowserHostImpl::WindowDestroyed,
|
||||
static_cast<AlloyBrowserHostImpl*>(browser_)));
|
||||
}
|
||||
|
||||
CefWindowHandle CefBrowserPlatformDelegateBackground::GetHostWindowHandle()
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/file_util.h"
|
||||
@ -446,10 +447,10 @@ void CefExtensionSystem::RegisterExtensionWithRequestContexts(
|
||||
// manifest settings.
|
||||
content::GetIOThreadTaskRunner({})->PostTaskAndReply(
|
||||
FROM_HERE,
|
||||
base::Bind(&InfoMap::AddExtension, info_map(),
|
||||
base::RetainedRef(extension), base::Time::Now(),
|
||||
true, // incognito_enabled
|
||||
false), // notifications_disabled
|
||||
base::BindOnce(&InfoMap::AddExtension, info_map(),
|
||||
base::RetainedRef(extension), base::Time::Now(),
|
||||
true, // incognito_enabled
|
||||
false), // notifications_disabled
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
@ -459,8 +460,8 @@ void CefExtensionSystem::UnregisterExtensionWithRequestContexts(
|
||||
const std::string& extension_id,
|
||||
const UnloadedExtensionReason reason) {
|
||||
content::GetIOThreadTaskRunner({})->PostTask(
|
||||
FROM_HERE,
|
||||
base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
|
||||
FROM_HERE, base::BindOnce(&InfoMap::RemoveExtension, info_map(),
|
||||
extension_id, reason));
|
||||
}
|
||||
|
||||
const base::OneShotEvent& CefExtensionSystem::ready() const {
|
||||
@ -634,9 +635,9 @@ void CefExtensionSystem::NotifyExtensionLoaded(const Extension* extension) {
|
||||
// extension.
|
||||
RegisterExtensionWithRequestContexts(
|
||||
extension,
|
||||
base::Bind(&CefExtensionSystem::OnExtensionRegisteredWithRequestContexts,
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
base::WrapRefCounted(extension)));
|
||||
base::BindOnce(
|
||||
&CefExtensionSystem::OnExtensionRegisteredWithRequestContexts,
|
||||
weak_ptr_factory_.GetWeakPtr(), base::WrapRefCounted(extension)));
|
||||
|
||||
// Tell renderers about the loaded extension.
|
||||
renderer_helper_->OnExtensionLoaded(*extension);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "third_party/blink/public/common/chrome_debug_urls.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
@ -45,7 +46,7 @@ void CefExtensionWebContentsObserver::RenderFrameCreated(
|
||||
if ((extension->is_extension() || extension->is_platform_app()) &&
|
||||
Manifest::IsComponentLocation(extension->location())) {
|
||||
policy->GrantRequestOrigin(
|
||||
process_id, url::Origin::Create(GURL(content::kChromeUIResourcesURL)));
|
||||
process_id, url::Origin::Create(GURL(blink::kChromeUIResourcesURL)));
|
||||
policy->GrantRequestOrigin(
|
||||
process_id, url::Origin::Create(GURL(chrome::kChromeUIThemeURL)));
|
||||
}
|
||||
|
@ -100,8 +100,8 @@ ValueStore::WriteResult CefValueStore::Set(
|
||||
!old_value->Equals(&it.value())) {
|
||||
changes.emplace_back(it.key(),
|
||||
old_value
|
||||
? base::Optional<base::Value>(old_value->Clone())
|
||||
: base::nullopt,
|
||||
? absl::optional<base::Value>(old_value->Clone())
|
||||
: absl::nullopt,
|
||||
it.value().Clone());
|
||||
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
|
||||
}
|
||||
@ -123,7 +123,7 @@ ValueStore::WriteResult CefValueStore::Remove(
|
||||
for (auto it = keys.cbegin(); it != keys.cend(); ++it) {
|
||||
std::unique_ptr<base::Value> old_value;
|
||||
if (storage_.RemoveWithoutPathExpansion(*it, &old_value)) {
|
||||
changes.emplace_back(*it, std::move(*old_value), base::nullopt);
|
||||
changes.emplace_back(*it, std::move(*old_value), absl::nullopt);
|
||||
}
|
||||
}
|
||||
return WriteResult(std::move(changes), CreateStatusCopy(status_));
|
||||
|
@ -197,7 +197,7 @@ void CefFileDialogManager::RunFileDialog(
|
||||
params.accept_types.push_back(*it);
|
||||
}
|
||||
|
||||
RunFileChooser(params, base::Bind(RunFileDialogDismissed, callback));
|
||||
RunFileChooser(params, base::BindOnce(RunFileDialogDismissed, callback));
|
||||
}
|
||||
|
||||
void CefFileDialogManager::RunFileChooser(
|
||||
|
@ -590,7 +590,7 @@ void CefFrameHostImpl::DidFinishFrameLoad(const GURL& validated_url,
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::UpdateDraggableRegions(
|
||||
base::Optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
|
||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
|
||||
auto browser = GetBrowserHostBase();
|
||||
if (!browser)
|
||||
return;
|
||||
|
@ -124,7 +124,7 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
|
||||
void DidFinishFrameLoad(const GURL& validated_url,
|
||||
int32_t http_status_code) override;
|
||||
void UpdateDraggableRegions(
|
||||
base::Optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
|
||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
|
||||
override;
|
||||
|
||||
static int64_t MakeFrameId(const content::RenderFrameHost* host);
|
||||
|
@ -366,7 +366,7 @@ bool CefImageImpl::ConvertBitmap(const SkBitmap& src_bitmap,
|
||||
// static
|
||||
bool CefImageImpl::WriteCompressedFormat(const SkBitmap& bitmap,
|
||||
std::vector<unsigned char>* compressed,
|
||||
const CompressionMethod& method) {
|
||||
CompressionMethod method) {
|
||||
const SkBitmap* bitmap_ptr = nullptr;
|
||||
SkBitmap bitmap_postalpha;
|
||||
if (bitmap.alphaType() == kPremul_SkAlphaType) {
|
||||
@ -386,7 +386,7 @@ bool CefImageImpl::WriteCompressedFormat(const SkBitmap& bitmap,
|
||||
DCHECK(bitmap_ptr->alphaType() == kOpaque_SkAlphaType ||
|
||||
bitmap_ptr->alphaType() == kUnpremul_SkAlphaType);
|
||||
|
||||
return method.Run(*bitmap_ptr, compressed);
|
||||
return std::move(method).Run(*bitmap_ptr, compressed);
|
||||
}
|
||||
|
||||
// static
|
||||
@ -394,7 +394,7 @@ bool CefImageImpl::WritePNG(const SkBitmap& bitmap,
|
||||
std::vector<unsigned char>* compressed,
|
||||
bool with_transparency) {
|
||||
return WriteCompressedFormat(bitmap, compressed,
|
||||
base::Bind(PNGMethod, with_transparency));
|
||||
base::BindOnce(PNGMethod, with_transparency));
|
||||
}
|
||||
|
||||
// static
|
||||
@ -402,5 +402,5 @@ bool CefImageImpl::WriteJPEG(const SkBitmap& bitmap,
|
||||
std::vector<unsigned char>* compressed,
|
||||
int quality) {
|
||||
return WriteCompressedFormat(bitmap, compressed,
|
||||
base::Bind(JPEGMethod, quality));
|
||||
base::BindOnce(JPEGMethod, quality));
|
||||
}
|
||||
|
@ -95,14 +95,14 @@ class CefImageImpl : public CefImage {
|
||||
|
||||
// The |bitmap| argument will be RGBA or BGRA and either opaque or transparent
|
||||
// with post-multiplied alpha. Writes the compressed output into |compressed|.
|
||||
typedef base::Callback<bool(const SkBitmap& /*bitmap*/,
|
||||
std::vector<unsigned char>* /*compressed*/)>
|
||||
typedef base::OnceCallback<bool(const SkBitmap& /*bitmap*/,
|
||||
std::vector<unsigned char>* /*compressed*/)>
|
||||
CompressionMethod;
|
||||
|
||||
// Write |bitmap| into |compressed| using |method|.
|
||||
static bool WriteCompressedFormat(const SkBitmap& bitmap,
|
||||
std::vector<unsigned char>* compressed,
|
||||
const CompressionMethod& method);
|
||||
CompressionMethod method);
|
||||
|
||||
// Write |bitmap| into |compressed| using PNG encoding.
|
||||
static bool WritePNG(const SkBitmap& bitmap,
|
||||
|
@ -19,8 +19,8 @@ CefIOThreadState::CefIOThreadState() {
|
||||
// Using base::Unretained() is safe because both this callback and possible
|
||||
// deletion of |this| will execute on the IO thread, and this callback will
|
||||
// be executed first.
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefIOThreadState::InitOnIOThread,
|
||||
base::Unretained(this)));
|
||||
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefIOThreadState::InitOnIOThread,
|
||||
base::Unretained(this)));
|
||||
}
|
||||
|
||||
CefIOThreadState::~CefIOThreadState() {
|
||||
|
@ -426,7 +426,7 @@ bool CefMainRunner::ContentMainRun(bool* initialized,
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefMainRunner::PreCreateMainMessageLoop() {
|
||||
void CefMainRunner::PreBrowserMain() {
|
||||
if (external_message_pump_) {
|
||||
InitExternalMessagePumpFactoryForUI();
|
||||
}
|
||||
@ -439,7 +439,7 @@ int CefMainRunner::RunMainProcess(
|
||||
browser_runner_ = content::BrowserMainRunner::Create();
|
||||
|
||||
// Initialize browser process state. Results in a call to
|
||||
// AlloyBrowserMain::PreMainMessageLoopStart() which creates the UI message
|
||||
// AlloyBrowserMain::PreBrowserMain() which creates the UI message
|
||||
// loop.
|
||||
int exit_code = browser_runner_->Initialize(main_function_params);
|
||||
if (exit_code >= 0)
|
||||
|
@ -60,7 +60,7 @@ class CefMainRunner : public CefMainRunnerHandler {
|
||||
bool ContentMainRun(bool* initialized, base::OnceClosure context_initialized);
|
||||
|
||||
// CefMainRunnerHandler methods:
|
||||
void PreCreateMainMessageLoop() override;
|
||||
void PreBrowserMain() override;
|
||||
int RunMainProcess(
|
||||
const content::MainFunctionParams& main_function_params) override;
|
||||
|
||||
|
@ -162,8 +162,8 @@ void CefMediaRouterImpl::Initialize(
|
||||
|
||||
if (callback) {
|
||||
// Execute client callback asynchronously for consistency.
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefCompletionCallback::OnComplete,
|
||||
callback.get()));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefCompletionCallback::OnComplete,
|
||||
callback.get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,21 +35,21 @@ const cef_event_flags_t kEmptyEventFlags = static_cast<cef_event_flags_t>(0);
|
||||
|
||||
class CefRunContextMenuCallbackImpl : public CefRunContextMenuCallback {
|
||||
public:
|
||||
typedef base::Callback<void(int, cef_event_flags_t)> Callback;
|
||||
typedef base::OnceCallback<void(int, cef_event_flags_t)> Callback;
|
||||
|
||||
explicit CefRunContextMenuCallbackImpl(const Callback& callback)
|
||||
: callback_(callback) {}
|
||||
explicit CefRunContextMenuCallbackImpl(Callback callback)
|
||||
: callback_(std::move(callback)) {}
|
||||
|
||||
~CefRunContextMenuCallbackImpl() {
|
||||
if (!callback_.is_null()) {
|
||||
// The callback is still pending. Cancel it now.
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
RunNow(callback_, kInvalidCommandId, kEmptyEventFlags);
|
||||
RunNow(std::move(callback_), kInvalidCommandId, kEmptyEventFlags);
|
||||
} else {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefRunContextMenuCallbackImpl::RunNow, callback_,
|
||||
kInvalidCommandId, kEmptyEventFlags));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefRunContextMenuCallbackImpl::RunNow,
|
||||
std::move(callback_), kInvalidCommandId,
|
||||
kEmptyEventFlags));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -57,13 +57,13 @@ class CefRunContextMenuCallbackImpl : public CefRunContextMenuCallback {
|
||||
void Continue(int command_id, cef_event_flags_t event_flags) override {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!callback_.is_null()) {
|
||||
RunNow(callback_, command_id, event_flags);
|
||||
RunNow(std::move(callback_), command_id, event_flags);
|
||||
callback_.Reset();
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefRunContextMenuCallbackImpl::Continue, this,
|
||||
command_id, event_flags));
|
||||
base::BindOnce(&CefRunContextMenuCallbackImpl::Continue,
|
||||
this, command_id, event_flags));
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,11 +72,11 @@ class CefRunContextMenuCallbackImpl : public CefRunContextMenuCallback {
|
||||
void Disconnect() { callback_.Reset(); }
|
||||
|
||||
private:
|
||||
static void RunNow(const Callback& callback,
|
||||
static void RunNow(Callback callback,
|
||||
int command_id,
|
||||
cef_event_flags_t event_flags) {
|
||||
CEF_REQUIRE_UIT();
|
||||
callback.Run(command_id, event_flags);
|
||||
std::move(callback).Run(command_id, event_flags);
|
||||
}
|
||||
|
||||
Callback callback_;
|
||||
@ -154,8 +154,8 @@ bool CefMenuManager::CreateContextMenu(
|
||||
if (model_->GetCount() > 0) {
|
||||
CefRefPtr<CefRunContextMenuCallbackImpl> callbackImpl(
|
||||
new CefRunContextMenuCallbackImpl(
|
||||
base::Bind(&CefMenuManager::ExecuteCommandCallback,
|
||||
weak_ptr_factory_.GetWeakPtr())));
|
||||
base::BindOnce(&CefMenuManager::ExecuteCommandCallback,
|
||||
weak_ptr_factory_.GetWeakPtr())));
|
||||
|
||||
// This reference will be cleared when the callback is executed or
|
||||
// the callback object is deleted.
|
||||
|
@ -785,8 +785,8 @@ void CefMenuModelImpl::MouseOutsideMenu(const gfx::Point& screen_point) {
|
||||
// Allow the callstack to unwind before notifying the delegate since it may
|
||||
// result in the menu being destroyed.
|
||||
CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask(
|
||||
FROM_HERE,
|
||||
base::Bind(&CefMenuModelImpl::OnMouseOutsideMenu, this, screen_point));
|
||||
FROM_HERE, base::BindOnce(&CefMenuModelImpl::OnMouseOutsideMenu, this,
|
||||
screen_point));
|
||||
}
|
||||
|
||||
void CefMenuModelImpl::UnhandledOpenSubmenu(bool is_rtl) {
|
||||
@ -797,7 +797,7 @@ void CefMenuModelImpl::UnhandledOpenSubmenu(bool is_rtl) {
|
||||
// result in the menu being destroyed.
|
||||
CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask(
|
||||
FROM_HERE,
|
||||
base::Bind(&CefMenuModelImpl::OnUnhandledOpenSubmenu, this, is_rtl));
|
||||
base::BindOnce(&CefMenuModelImpl::OnUnhandledOpenSubmenu, this, is_rtl));
|
||||
}
|
||||
|
||||
void CefMenuModelImpl::UnhandledCloseSubmenu(bool is_rtl) {
|
||||
@ -808,7 +808,7 @@ void CefMenuModelImpl::UnhandledCloseSubmenu(bool is_rtl) {
|
||||
// result in the menu being destroyed.
|
||||
CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask(
|
||||
FROM_HERE,
|
||||
base::Bind(&CefMenuModelImpl::OnUnhandledCloseSubmenu, this, is_rtl));
|
||||
base::BindOnce(&CefMenuModelImpl::OnUnhandledCloseSubmenu, this, is_rtl));
|
||||
}
|
||||
|
||||
bool CefMenuModelImpl::GetTextColor(int index,
|
||||
@ -883,7 +883,7 @@ void CefMenuModelImpl::MenuWillClose() {
|
||||
// called after this. It's more convenient for the delegate to be called
|
||||
// afterwards, though, so post a task.
|
||||
CefTaskRunnerImpl::GetCurrentTaskRunner()->PostTask(
|
||||
FROM_HERE, base::Bind(&CefMenuModelImpl::OnMenuClosed, this));
|
||||
FROM_HERE, base::BindOnce(&CefMenuModelImpl::OnMenuClosed, this));
|
||||
}
|
||||
|
||||
std::u16string CefMenuModelImpl::GetFormattedLabelAt(int index) {
|
||||
|
@ -349,7 +349,7 @@ void CefBrowserPlatformDelegateNativeWin::ViewText(const std::string& text) {
|
||||
std::string str = text;
|
||||
scoped_refptr<base::RefCountedString> str_ref =
|
||||
base::RefCountedString::TakeString(&str);
|
||||
CEF_POST_USER_VISIBLE_TASK(base::Bind(WriteTempFileAndView, str_ref));
|
||||
CEF_POST_USER_VISIBLE_TASK(base::BindOnce(WriteTempFileAndView, str_ref));
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
|
||||
@ -395,7 +395,7 @@ bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
|
||||
|
||||
// static
|
||||
void CefBrowserPlatformDelegate::HandleExternalProtocol(const GURL& url) {
|
||||
CEF_POST_USER_VISIBLE_TASK(base::Bind(ExecuteExternalProtocol, url));
|
||||
CEF_POST_USER_VISIBLE_TASK(base::BindOnce(ExecuteExternalProtocol, url));
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateNativeWin::GetEventHandle(
|
||||
|
@ -36,7 +36,7 @@ bool OnCursorChange(CefBrowserHostBase* browser, const ui::Cursor& ui_cursor) {
|
||||
|
||||
#if defined(USE_AURA)
|
||||
CefCursorHandle platform_cursor;
|
||||
ui::PlatformCursor image_cursor = nullptr;
|
||||
scoped_refptr<ui::PlatformCursor> image_cursor;
|
||||
|
||||
if (ui_cursor.type() == ui::mojom::CursorType::kCustom) {
|
||||
image_cursor = ui::CursorFactory::GetInstance()->CreateImageCursor(
|
||||
@ -49,10 +49,6 @@ bool OnCursorChange(CefBrowserHostBase* browser, const ui::Cursor& ui_cursor) {
|
||||
|
||||
handled = handler->OnCursorChange(browser, platform_cursor, cursor_type,
|
||||
custom_cursor_info);
|
||||
|
||||
if (image_cursor) {
|
||||
ui::CursorFactory::GetInstance()->UnrefImageCursor(image_cursor);
|
||||
}
|
||||
#elif defined(OS_MAC)
|
||||
// |web_cursor| owns the resulting |native_cursor|.
|
||||
content::WebCursor web_cursor(ui_cursor);
|
||||
|
@ -10,13 +10,17 @@
|
||||
#include "ui/base/cursor/cursor.h"
|
||||
#include "ui/base/cursor/mojom/cursor_type.mojom-forward.h"
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#include "ui/base/cursor/platform_cursor.h"
|
||||
#endif
|
||||
|
||||
class CefBrowserHostBase;
|
||||
|
||||
namespace cursor_util {
|
||||
|
||||
#if defined(USE_AURA)
|
||||
cef_cursor_handle_t GetPlatformCursor(ui::mojom::CursorType type);
|
||||
cef_cursor_handle_t ToCursorHandle(ui::PlatformCursor cursor);
|
||||
cef_cursor_handle_t ToCursorHandle(scoped_refptr<ui::PlatformCursor> cursor);
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
// Returns true if the client handled the cursor change.
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#if defined(USE_X11)
|
||||
#include "ui/base/x/x11_cursor.h"
|
||||
#elif defined(USE_OZONE)
|
||||
#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
|
||||
#endif
|
||||
|
||||
namespace cursor_util {
|
||||
@ -20,13 +22,16 @@ cef_cursor_handle_t GetPlatformCursor(ui::mojom::CursorType type) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
cef_cursor_handle_t ToCursorHandle(ui::PlatformCursor cursor) {
|
||||
cef_cursor_handle_t ToCursorHandle(scoped_refptr<ui::PlatformCursor> cursor) {
|
||||
#if defined(USE_X11)
|
||||
// See https://crbug.com/1029142 for background.
|
||||
return static_cast<cef_cursor_handle_t>(
|
||||
static_cast<ui::X11Cursor*>(cursor)->xcursor());
|
||||
ui::X11Cursor::FromPlatformCursor(cursor)->xcursor());
|
||||
#elif defined(USE_OZONE)
|
||||
return static_cast<cef_cursor_handle_t>(
|
||||
ui::BitmapCursorOzone::FromPlatformCursor(cursor)->platform_data());
|
||||
#else
|
||||
return cursor;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -156,8 +156,8 @@ cef_cursor_handle_t GetPlatformCursor(ui::mojom::CursorType type) {
|
||||
return LoadCursor(module_handle, cursor_id);
|
||||
}
|
||||
|
||||
cef_cursor_handle_t ToCursorHandle(ui::PlatformCursor cursor) {
|
||||
return static_cast<ui::WinCursor*>(cursor)->hcursor();
|
||||
cef_cursor_handle_t ToCursorHandle(scoped_refptr<ui::PlatformCursor> cursor) {
|
||||
return ui::WinCursor::FromPlatformCursor(cursor)->hcursor();
|
||||
}
|
||||
|
||||
} // namespace cursor_util
|
||||
|
@ -487,8 +487,8 @@ void CefNativeMenuWin::RunMenuAt(const gfx::Point& point, int alignment) {
|
||||
// does.
|
||||
menu_to_select_factory_.InvalidateWeakPtrs();
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::Bind(&CefNativeMenuWin::DelayedSelect,
|
||||
menu_to_select_factory_.GetWeakPtr()));
|
||||
FROM_HERE, base::BindOnce(&CefNativeMenuWin::DelayedSelect,
|
||||
menu_to_select_factory_.GetWeakPtr()));
|
||||
menu_action_ = MENU_ACTION_SELECTED;
|
||||
}
|
||||
// Send MenuWillClose after we schedule the select, otherwise MenuWillClose is
|
||||
|
@ -48,7 +48,7 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
|
||||
params.remove_standard_frame = true;
|
||||
// Cause WidgetDelegate::CanActivate to return true. See comments in
|
||||
// AlloyBrowserHostImpl::PlatformSetFocus.
|
||||
params.activatable = views::Widget::InitParams::ACTIVATABLE_YES;
|
||||
params.activatable = views::Widget::InitParams::Activatable::kYes;
|
||||
|
||||
params.z_order = always_on_top_ ? ui::ZOrderLevel::kFloatingWindow
|
||||
: ui::ZOrderLevel::kNormal;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "net/base/network_interfaces.h"
|
||||
#include "ui/base/x/x11_util.h"
|
||||
#include "ui/events/platform/platform_event_source.h"
|
||||
#include "ui/events/platform/x11/x11_event_source.h"
|
||||
@ -391,8 +392,8 @@ void CefWindowX11::ProcessXEvent(const x11::Event& event) {
|
||||
if (!focus_pending_) {
|
||||
focus_pending_ = true;
|
||||
CEF_POST_DELAYED_TASK(CEF_UIT,
|
||||
base::Bind(&CefWindowX11::ContinueFocus,
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
base::BindOnce(&CefWindowX11::ContinueFocus,
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
100);
|
||||
}
|
||||
} else {
|
||||
|
@ -44,7 +44,9 @@
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "content/public/common/url_utils.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "content/public/test/scoped_web_ui_controller_factory_registration.h"
|
||||
#include "ipc/ipc_channel.h"
|
||||
#include "third_party/blink/public/common/chrome_debug_urls.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
@ -182,7 +184,7 @@ bool IsAllowedWebUIHost(const std::string& host) {
|
||||
|
||||
// Additional debug URLs that are not included in chrome::kChromeDebugURLs.
|
||||
const char* kAllowedDebugURLs[] = {
|
||||
content::kChromeUIBrowserCrashURL,
|
||||
blink::kChromeUIBrowserCrashURL,
|
||||
};
|
||||
|
||||
void GetDebugURLs(std::vector<std::string>* urls) {
|
||||
@ -639,7 +641,9 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
|
||||
static CefWebUIControllerFactory* GetInstance();
|
||||
|
||||
protected:
|
||||
CefWebUIControllerFactory() {}
|
||||
CefWebUIControllerFactory()
|
||||
: remove_content_registration_(
|
||||
content::ContentWebUIControllerFactory::GetInstance()) {}
|
||||
~CefWebUIControllerFactory() override {}
|
||||
|
||||
private:
|
||||
@ -662,6 +666,9 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
|
||||
return false;
|
||||
}
|
||||
|
||||
content::ScopedWebUIControllerFactoryRegistration
|
||||
remove_content_registration_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefWebUIControllerFactory);
|
||||
};
|
||||
|
||||
@ -677,9 +684,6 @@ CefWebUIControllerFactory* CefWebUIControllerFactory::GetInstance() {
|
||||
|
||||
void RegisterWebUIControllerFactory() {
|
||||
// Channel all WebUI handling through CefWebUIControllerFactory.
|
||||
content::WebUIControllerFactory::UnregisterFactoryForTesting(
|
||||
content::ContentWebUIControllerFactory::GetInstance());
|
||||
|
||||
content::WebUIControllerFactory::RegisterFactory(
|
||||
CefWebUIControllerFactory::GetInstance());
|
||||
}
|
||||
|
@ -107,8 +107,9 @@ void CreateThrottlesForNavigation(content::NavigationHandle* navigation_handle,
|
||||
std::unique_ptr<content::NavigationThrottle> throttle =
|
||||
std::make_unique<navigation_interception::InterceptNavigationThrottle>(
|
||||
navigation_handle,
|
||||
base::Bind(&NavigationOnUIThread, is_main_frame, frame_id,
|
||||
parent_frame_id, navigation_handle->GetFrameTreeNodeId()),
|
||||
base::BindRepeating(&NavigationOnUIThread, is_main_frame, frame_id,
|
||||
parent_frame_id,
|
||||
navigation_handle->GetFrameTreeNodeId()),
|
||||
navigation_interception::SynchronyMode::kSync);
|
||||
throttles.push_back(std::move(throttle));
|
||||
}
|
||||
|
@ -82,16 +82,16 @@ class RequestManager {
|
||||
map_.erase(it);
|
||||
}
|
||||
|
||||
base::Optional<CefBrowserURLRequest::RequestInfo> Get(int32_t request_id) {
|
||||
absl::optional<CefBrowserURLRequest::RequestInfo> Get(int32_t request_id) {
|
||||
if (request_id > kInitialRequestID)
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
RequestMap::const_iterator it = map_.find(request_id);
|
||||
if (it != map_.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -230,8 +230,7 @@ class CefBrowserURLRequest::Context
|
||||
net_service::URLLoaderFactoryGetter::Create(nullptr, browser_context);
|
||||
url_loader_network_observer =
|
||||
static_cast<content::StoragePartitionImpl*>(
|
||||
content::BrowserContext::GetDefaultStoragePartition(
|
||||
browser_context))
|
||||
browser_context->GetDefaultStoragePartition())
|
||||
->CreateAuthCertObserverForServiceWorker();
|
||||
}
|
||||
|
||||
@ -346,7 +345,7 @@ class CefBrowserURLRequest::Context
|
||||
content_type = net_service::kContentTypeApplicationFormURLEncoded;
|
||||
}
|
||||
loader_->AttachStringForUpload(
|
||||
bytes_element.AsStringPiece().as_string(), content_type);
|
||||
std::string(bytes_element.AsStringPiece()), content_type);
|
||||
|
||||
if (request_flags & UR_FLAG_REPORT_UPLOAD_PROGRESS) {
|
||||
// Report the expected upload data size.
|
||||
@ -376,14 +375,14 @@ class CefBrowserURLRequest::Context
|
||||
if (request_flags & UR_FLAG_STOP_ON_REDIRECT) {
|
||||
// The request will be canceled in OnRedirect.
|
||||
loader_->SetOnRedirectCallback(
|
||||
base::Bind(&CefBrowserURLRequest::Context::OnRedirect,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
base::BindRepeating(&CefBrowserURLRequest::Context::OnRedirect,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
if (request_flags & UR_FLAG_REPORT_UPLOAD_PROGRESS) {
|
||||
loader_->SetOnUploadProgressCallback(
|
||||
base::Bind(&CefBrowserURLRequest::Context::OnUploadProgress,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
base::BindRepeating(&CefBrowserURLRequest::Context::OnUploadProgress,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
if ((request_flags & UR_FLAG_NO_DOWNLOAD_DATA) || method == "HEAD") {
|
||||
@ -395,9 +394,9 @@ class CefBrowserURLRequest::Context
|
||||
loader_->SetOnResponseStartedCallback(
|
||||
base::BindOnce(&CefBrowserURLRequest::Context::OnResponseStarted,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
loader_->SetOnDownloadProgressCallback(
|
||||
base::Bind(&CefBrowserURLRequest::Context::OnDownloadProgress,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
loader_->SetOnDownloadProgressCallback(base::BindRepeating(
|
||||
&CefBrowserURLRequest::Context::OnDownloadProgress,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
|
||||
loader_->DownloadAsStream(loader_factory.get(), this);
|
||||
}
|
||||
@ -597,16 +596,16 @@ class CefBrowserURLRequest::Context
|
||||
// CefBrowserURLRequest -------------------------------------------------------
|
||||
|
||||
// static
|
||||
base::Optional<CefBrowserURLRequest::RequestInfo>
|
||||
absl::optional<CefBrowserURLRequest::RequestInfo>
|
||||
CefBrowserURLRequest::FromRequestID(int32_t request_id) {
|
||||
if (IsValidRequestID(request_id)) {
|
||||
return g_manager.Get().Get(request_id);
|
||||
}
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
// static
|
||||
base::Optional<CefBrowserURLRequest::RequestInfo>
|
||||
absl::optional<CefBrowserURLRequest::RequestInfo>
|
||||
CefBrowserURLRequest::FromRequestID(
|
||||
const content::GlobalRequestID& request_id) {
|
||||
return FromRequestID(request_id.request_id);
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "include/cef_urlrequest.h"
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace content {
|
||||
struct GlobalRequestID;
|
||||
@ -27,8 +27,8 @@ class CefBrowserURLRequest : public CefURLRequest {
|
||||
CefRefPtr<CefURLRequestClient>>;
|
||||
|
||||
// Retrieve the request objects, if any, associated with |request_id|.
|
||||
static base::Optional<RequestInfo> FromRequestID(int32_t request_id);
|
||||
static base::Optional<RequestInfo> FromRequestID(
|
||||
static absl::optional<RequestInfo> FromRequestID(int32_t request_id);
|
||||
static absl::optional<RequestInfo> FromRequestID(
|
||||
const content::GlobalRequestID& request_id);
|
||||
|
||||
// If |frame| is nullptr requests can still be intercepted but no
|
||||
|
@ -26,7 +26,7 @@ namespace {
|
||||
network::mojom::CookieManager* GetCookieManager(
|
||||
content::BrowserContext* browser_context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
return content::BrowserContext::GetDefaultStoragePartition(browser_context)
|
||||
return browser_context->GetDefaultStoragePartition()
|
||||
->GetCookieManagerForBrowserProcess();
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ void SaveCookiesOnUIThread(content::BrowserContext* browser_context,
|
||||
|
||||
bool IsCookieableScheme(
|
||||
const GURL& url,
|
||||
const base::Optional<std::vector<std::string>>& cookieable_schemes) {
|
||||
const absl::optional<std::vector<std::string>>& cookieable_schemes) {
|
||||
if (!url.has_scheme())
|
||||
return false;
|
||||
|
||||
|
@ -28,10 +28,11 @@ namespace cookie_helper {
|
||||
// cookieable, which may intentionally exclude standard schemes.
|
||||
bool IsCookieableScheme(
|
||||
const GURL& url,
|
||||
const base::Optional<std::vector<std::string>>& cookieable_schemes);
|
||||
const absl::optional<std::vector<std::string>>& cookieable_schemes);
|
||||
|
||||
using AllowCookieCallback =
|
||||
base::Callback<void(const net::CanonicalCookie&, bool* /* allow */)>;
|
||||
base::RepeatingCallback<void(const net::CanonicalCookie&,
|
||||
bool* /* allow */)>;
|
||||
using DoneCookieCallback =
|
||||
base::OnceCallback<void(int /* total_count */,
|
||||
net::CookieList /* allowed_cookies */)>;
|
||||
|
@ -30,8 +30,8 @@ CefBrowserContext* GetBrowserContext(const CefBrowserContext::Getter& getter) {
|
||||
// Do not keep a reference to the object returned by this method.
|
||||
CookieManager* GetCookieManager(CefBrowserContext* browser_context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
return content::BrowserContext::GetDefaultStoragePartition(
|
||||
browser_context->AsBrowserContext())
|
||||
return browser_context->AsBrowserContext()
|
||||
->GetDefaultStoragePartition()
|
||||
->GetCookieManagerForBrowserProcess();
|
||||
}
|
||||
|
||||
@ -39,8 +39,8 @@ CookieManager* GetCookieManager(CefBrowserContext* browser_context) {
|
||||
void RunAsyncCompletionOnUIThread(CefRefPtr<CefCompletionCallback> callback) {
|
||||
if (!callback.get())
|
||||
return;
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefCompletionCallback::OnComplete, callback.get()));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefCompletionCallback::OnComplete,
|
||||
callback.get()));
|
||||
}
|
||||
|
||||
// Always execute the callback asynchronously.
|
||||
@ -53,8 +53,8 @@ void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback,
|
||||
LOG(WARNING) << "SetCookie failed with reason: "
|
||||
<< access_result.status.GetDebugString();
|
||||
}
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefSetCookieCallback::OnComplete,
|
||||
callback.get(), is_include));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefSetCookieCallback::OnComplete,
|
||||
callback.get(), is_include));
|
||||
}
|
||||
|
||||
// Always execute the callback asynchronously.
|
||||
@ -62,8 +62,8 @@ void DeleteCookiesCallbackImpl(CefRefPtr<CefDeleteCookiesCallback> callback,
|
||||
uint32_t num_deleted) {
|
||||
if (!callback.get())
|
||||
return;
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefDeleteCookiesCallback::OnComplete,
|
||||
callback.get(), num_deleted));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefDeleteCookiesCallback::OnComplete,
|
||||
callback.get(), num_deleted));
|
||||
}
|
||||
|
||||
void ExecuteVisitor(CefRefPtr<CefCookieVisitor> visitor,
|
||||
@ -99,8 +99,8 @@ void GetAllCookiesCallbackImpl(
|
||||
CefRefPtr<CefCookieVisitor> visitor,
|
||||
const CefBrowserContext::Getter& browser_context_getter,
|
||||
const net::CookieList& cookies) {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&ExecuteVisitor, visitor,
|
||||
browser_context_getter, cookies));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&ExecuteVisitor, visitor,
|
||||
browser_context_getter, cookies));
|
||||
}
|
||||
|
||||
void GetCookiesCallbackImpl(
|
||||
@ -233,8 +233,8 @@ bool CefCookieManagerImpl::VisitAllCookiesInternal(
|
||||
return false;
|
||||
|
||||
GetCookieManager(browser_context)
|
||||
->GetAllCookies(base::Bind(&GetAllCookiesCallbackImpl, visitor,
|
||||
browser_context_getter_));
|
||||
->GetAllCookies(base::BindOnce(&GetAllCookiesCallbackImpl, visitor,
|
||||
browser_context_getter_));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -258,8 +258,8 @@ bool CefCookieManagerImpl::VisitUrlCookiesInternal(
|
||||
|
||||
GetCookieManager(browser_context)
|
||||
->GetCookieList(url, options,
|
||||
base::Bind(&GetCookiesCallbackImpl, visitor,
|
||||
browser_context_getter_));
|
||||
base::BindOnce(&GetCookiesCallbackImpl, visitor,
|
||||
browser_context_getter_));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ bool CefCookieManagerImpl::SetCookieInternal(
|
||||
|
||||
GetCookieManager(browser_context)
|
||||
->SetCanonicalCookie(*canonical_cookie, url, options,
|
||||
base::Bind(SetCookieCallbackImpl, callback));
|
||||
base::BindOnce(SetCookieCallbackImpl, callback));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -342,7 +342,7 @@ bool CefCookieManagerImpl::DeleteCookiesInternal(
|
||||
|
||||
GetCookieManager(browser_context)
|
||||
->DeleteCookies(std::move(deletion_filter),
|
||||
base::Bind(DeleteCookiesCallbackImpl, callback));
|
||||
base::BindOnce(DeleteCookiesCallbackImpl, callback));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -355,7 +355,8 @@ bool CefCookieManagerImpl::FlushStoreInternal(
|
||||
return false;
|
||||
|
||||
GetCookieManager(browser_context)
|
||||
->FlushCookieStore(base::Bind(RunAsyncCompletionOnUIThread, callback));
|
||||
->FlushCookieStore(
|
||||
base::BindOnce(RunAsyncCompletionOnUIThread, callback));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ class AuthCallbackImpl : public CefAuthCallback {
|
||||
|
||||
void RunCallbackOnIOThread(
|
||||
CefRefPtr<CefBrowserHostBase> browser,
|
||||
base::Optional<CefBrowserURLRequest::RequestInfo> url_request_info,
|
||||
absl::optional<CefBrowserURLRequest::RequestInfo> url_request_info,
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
const GURL& origin_url,
|
||||
CefRefPtr<AuthCallbackImpl> callback_impl) {
|
||||
@ -142,7 +142,7 @@ void LoginDelegate::Continue(const CefString& username,
|
||||
void LoginDelegate::Cancel() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!callback_.is_null()) {
|
||||
std::move(callback_).Run(base::nullopt);
|
||||
std::move(callback_).Run(absl::nullopt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,12 +33,12 @@ namespace {
|
||||
// User data key for ResourceContextData.
|
||||
const void* const kResourceContextUserDataKey = &kResourceContextUserDataKey;
|
||||
|
||||
base::Optional<std::string> GetHeaderString(
|
||||
absl::optional<std::string> GetHeaderString(
|
||||
const net::HttpResponseHeaders* headers,
|
||||
const std::string& header_name) {
|
||||
std::string header_value;
|
||||
if (!headers || !headers->GetNormalizedHeader(header_name, &header_value)) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
return header_value;
|
||||
}
|
||||
@ -147,13 +147,13 @@ class CorsPreflightRequest : public network::mojom::TrustedHeaderClient {
|
||||
// mojom::TrustedHeaderClient methods:
|
||||
void OnBeforeSendHeaders(const net::HttpRequestHeaders& headers,
|
||||
OnBeforeSendHeadersCallback callback) override {
|
||||
std::move(callback).Run(net::OK, base::nullopt);
|
||||
std::move(callback).Run(net::OK, absl::nullopt);
|
||||
}
|
||||
|
||||
void OnHeadersReceived(const std::string& headers,
|
||||
const net::IPEndPoint& remote_endpoint,
|
||||
OnHeadersReceivedCallback callback) override {
|
||||
std::move(callback).Run(net::OK, base::nullopt, GURL());
|
||||
std::move(callback).Run(net::OK, absl::nullopt, GURL());
|
||||
OnDestroy();
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const base::Optional<GURL>& new_url) override;
|
||||
const absl::optional<GURL>& new_url) override;
|
||||
void SetPriority(net::RequestPriority priority,
|
||||
int32_t intra_priority_value) override;
|
||||
void PauseReadingBodyFromNet() override;
|
||||
@ -246,7 +246,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||
|
||||
// Helpers for optionally overriding headers.
|
||||
void HandleResponseOrRedirectHeaders(
|
||||
base::Optional<net::RedirectInfo> redirect_info,
|
||||
absl::optional<net::RedirectInfo> redirect_info,
|
||||
net::CompletionOnceCallback continuation);
|
||||
void ContinueResponseOrRedirect(
|
||||
net::CompletionOnceCallback continuation,
|
||||
@ -412,7 +412,7 @@ InterceptedRequest::~InterceptedRequest() {
|
||||
SendErrorCallback(status_.error_code, false);
|
||||
if (on_headers_received_callback_) {
|
||||
std::move(on_headers_received_callback_)
|
||||
.Run(net::ERR_ABORTED, base::nullopt, GURL());
|
||||
.Run(net::ERR_ABORTED, absl::nullopt, GURL());
|
||||
}
|
||||
}
|
||||
|
||||
@ -493,12 +493,12 @@ void InterceptedRequest::OnBeforeSendHeaders(
|
||||
const net::HttpRequestHeaders& headers,
|
||||
OnBeforeSendHeadersCallback callback) {
|
||||
if (!current_request_uses_header_client_) {
|
||||
std::move(callback).Run(net::OK, base::nullopt);
|
||||
std::move(callback).Run(net::OK, absl::nullopt);
|
||||
return;
|
||||
}
|
||||
|
||||
request_.headers = headers;
|
||||
std::move(callback).Run(net::OK, base::nullopt);
|
||||
std::move(callback).Run(net::OK, absl::nullopt);
|
||||
|
||||
// Resume handling of client messages after continuing from an async callback.
|
||||
if (proxied_client_receiver_.is_bound())
|
||||
@ -510,14 +510,14 @@ void InterceptedRequest::OnHeadersReceived(
|
||||
const net::IPEndPoint& remote_endpoint,
|
||||
OnHeadersReceivedCallback callback) {
|
||||
if (!current_request_uses_header_client_) {
|
||||
std::move(callback).Run(net::OK, base::nullopt, GURL());
|
||||
std::move(callback).Run(net::OK, absl::nullopt, GURL());
|
||||
return;
|
||||
}
|
||||
|
||||
current_headers_ = base::MakeRefCounted<net::HttpResponseHeaders>(headers);
|
||||
on_headers_received_callback_ = std::move(callback);
|
||||
|
||||
base::Optional<net::RedirectInfo> redirect_info;
|
||||
absl::optional<net::RedirectInfo> redirect_info;
|
||||
std::string location;
|
||||
if (current_headers_->IsRedirect(&location)) {
|
||||
const GURL new_url = request_.url.Resolve(location);
|
||||
@ -551,7 +551,7 @@ void InterceptedRequest::OnReceiveResponse(
|
||||
ContinueToResponseStarted(net::OK);
|
||||
} else {
|
||||
HandleResponseOrRedirectHeaders(
|
||||
base::nullopt,
|
||||
absl::nullopt,
|
||||
base::BindOnce(&InterceptedRequest::ContinueToResponseStarted,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
}
|
||||
@ -659,7 +659,7 @@ void InterceptedRequest::FollowRedirect(
|
||||
const std::vector<std::string>& removed_headers_ext,
|
||||
const net::HttpRequestHeaders& modified_headers_ext,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const base::Optional<GURL>& new_url) {
|
||||
const absl::optional<GURL>& new_url) {
|
||||
std::vector<std::string> removed_headers = removed_headers_ext;
|
||||
net::HttpRequestHeaders modified_headers = modified_headers_ext;
|
||||
OnProcessRequestHeaders(new_url.value_or(GURL()), &modified_headers,
|
||||
@ -802,7 +802,7 @@ void InterceptedRequest::ContinueAfterInterceptWithOverride(
|
||||
}
|
||||
|
||||
void InterceptedRequest::HandleResponseOrRedirectHeaders(
|
||||
base::Optional<net::RedirectInfo> redirect_info,
|
||||
absl::optional<net::RedirectInfo> redirect_info,
|
||||
net::CompletionOnceCallback continuation) {
|
||||
override_headers_ = nullptr;
|
||||
redirect_url_ = redirect_info.has_value() ? redirect_info->new_url : GURL();
|
||||
@ -860,7 +860,7 @@ void InterceptedRequest::ContinueToHandleOverrideHeaders(int error_code) {
|
||||
}
|
||||
|
||||
DCHECK(on_headers_received_callback_);
|
||||
base::Optional<std::string> headers;
|
||||
absl::optional<std::string> headers;
|
||||
if (override_headers_)
|
||||
headers = override_headers_->raw_headers();
|
||||
header_client_redirect_url_ = redirect_url_;
|
||||
@ -954,7 +954,7 @@ void InterceptedRequest::ContinueToBeforeRedirect(
|
||||
net::RedirectUtil::UpdateHttpRequest(original_url, original_method,
|
||||
new_redirect_info,
|
||||
base::make_optional(remove_headers),
|
||||
/*modified_headers=*/base::nullopt,
|
||||
/*modified_headers=*/absl::nullopt,
|
||||
&request_.headers, &should_clear_upload);
|
||||
|
||||
if (should_clear_upload) {
|
||||
@ -1164,7 +1164,7 @@ void InterceptedRequestHandler::OnRequestResponse(
|
||||
int32_t request_id,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
base::Optional<net::RedirectInfo> redirect_info,
|
||||
absl::optional<net::RedirectInfo> redirect_info,
|
||||
OnRequestResponseResultCallback callback) {
|
||||
std::move(callback).Run(
|
||||
ResponseMode::CONTINUE, nullptr,
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "base/containers/unique_ptr_adapters.h"
|
||||
#include "base/hash/hash.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
@ -20,6 +19,7 @@
|
||||
#include "mojo/public/cpp/bindings/receiver_set.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace content {
|
||||
class ResourceContext;
|
||||
@ -104,7 +104,7 @@ class InterceptedRequestHandler {
|
||||
int32_t request_id,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
base::Optional<net::RedirectInfo> redirect_info,
|
||||
absl::optional<net::RedirectInfo> redirect_info,
|
||||
OnRequestResponseResultCallback callback);
|
||||
|
||||
// Called to optionally filter the response body.
|
||||
|
@ -233,7 +233,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
bool is_navigation,
|
||||
bool is_download,
|
||||
const url::Origin& request_initiator,
|
||||
const base::Closure& unhandled_request_callback) {
|
||||
const base::RepeatingClosure& unhandled_request_callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
browser_context_ = browser_context;
|
||||
@ -297,7 +297,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
bool is_navigation_ = true;
|
||||
bool is_download_ = false;
|
||||
CefString request_initiator_;
|
||||
base::Closure unhandled_request_callback_;
|
||||
base::RepeatingClosure unhandled_request_callback_;
|
||||
|
||||
// Default values for standard headers.
|
||||
std::string accept_language_;
|
||||
@ -705,7 +705,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
void OnRequestResponse(int32_t request_id,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
base::Optional<net::RedirectInfo> redirect_info,
|
||||
absl::optional<net::RedirectInfo> redirect_info,
|
||||
OnRequestResponseResultCallback callback) override {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
@ -1179,7 +1179,7 @@ void InitOnUIThread(
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
const network::ResourceRequest& request,
|
||||
const base::Closure& unhandled_request_callback) {
|
||||
const base::RepeatingClosure& unhandled_request_callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// May return nullptr if the WebContents was destroyed while this callback was
|
||||
@ -1278,7 +1278,8 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
|
||||
std::make_unique<InterceptedRequestHandlerWrapper::InitState>();
|
||||
init_state->Initialize(browser_context, browserPtr, framePtr,
|
||||
render_process_id, frame_tree_node_id, is_navigation,
|
||||
is_download, request_initiator, base::Closure());
|
||||
is_download, request_initiator,
|
||||
base::RepeatingClosure());
|
||||
|
||||
auto wrapper = std::make_unique<InterceptedRequestHandlerWrapper>();
|
||||
wrapper->init_helper()->MaybeSetInitialized(std::move(init_state));
|
||||
@ -1290,7 +1291,7 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
const network::ResourceRequest& request,
|
||||
const base::Closure& unhandled_request_callback) {
|
||||
const base::RepeatingClosure& unhandled_request_callback) {
|
||||
auto wrapper = std::make_unique<InterceptedRequestHandlerWrapper>();
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(InitOnUIThread, wrapper->init_helper(),
|
||||
web_contents_getter, frame_tree_node_id,
|
||||
|
@ -43,7 +43,7 @@ std::unique_ptr<InterceptedRequestHandler> CreateInterceptedRequestHandler(
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
const network::ResourceRequest& request,
|
||||
const base::Closure& unhandled_request_callback);
|
||||
const base::RepeatingClosure& unhandled_request_callback);
|
||||
|
||||
} // namespace net_service
|
||||
|
||||
|
@ -508,13 +508,13 @@ void StreamReaderURLLoader::Start() {
|
||||
base::BindOnce(&StreamReaderURLLoader::ContinueWithRequestHeaders,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
} else {
|
||||
ContinueWithRequestHeaders(net::OK, base::nullopt);
|
||||
ContinueWithRequestHeaders(net::OK, absl::nullopt);
|
||||
}
|
||||
}
|
||||
|
||||
void StreamReaderURLLoader::ContinueWithRequestHeaders(
|
||||
int32_t result,
|
||||
const base::Optional<net::HttpRequestHeaders>& headers) {
|
||||
const absl::optional<net::HttpRequestHeaders>& headers) {
|
||||
if (result != net::OK) {
|
||||
RequestComplete(result);
|
||||
return;
|
||||
@ -540,7 +540,7 @@ void StreamReaderURLLoader::FollowRedirect(
|
||||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const base::Optional<GURL>& new_url) {
|
||||
const absl::optional<GURL>& new_url) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
@ -651,15 +651,15 @@ void StreamReaderURLLoader::HeadersComplete(int orig_status_code,
|
||||
std::move(pending_response)));
|
||||
} else {
|
||||
ContinueWithResponseHeaders(std::move(pending_response), net::OK,
|
||||
base::nullopt, base::nullopt);
|
||||
absl::nullopt, absl::nullopt);
|
||||
}
|
||||
}
|
||||
|
||||
void StreamReaderURLLoader::ContinueWithResponseHeaders(
|
||||
network::mojom::URLResponseHeadPtr pending_response,
|
||||
int32_t result,
|
||||
const base::Optional<std::string>& headers,
|
||||
const base::Optional<GURL>& redirect_url) {
|
||||
const absl::optional<std::string>& headers,
|
||||
const absl::optional<GURL>& redirect_url) {
|
||||
if (result != net::OK) {
|
||||
RequestComplete(result);
|
||||
return;
|
||||
|
@ -127,7 +127,7 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
|
||||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const base::Optional<GURL>& new_url) override;
|
||||
const absl::optional<GURL>& new_url) override;
|
||||
void SetPriority(net::RequestPriority priority,
|
||||
int intra_priority_value) override;
|
||||
void PauseReadingBodyFromNet() override;
|
||||
@ -136,7 +136,7 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
|
||||
private:
|
||||
void ContinueWithRequestHeaders(
|
||||
int32_t result,
|
||||
const base::Optional<net::HttpRequestHeaders>& headers);
|
||||
const absl::optional<net::HttpRequestHeaders>& headers);
|
||||
void OnInputStreamOpened(std::unique_ptr<Delegate> returned_delegate,
|
||||
std::unique_ptr<InputStream> input_stream);
|
||||
|
||||
@ -145,8 +145,8 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
|
||||
void ContinueWithResponseHeaders(
|
||||
network::mojom::URLResponseHeadPtr pending_response,
|
||||
int32_t result,
|
||||
const base::Optional<std::string>& headers,
|
||||
const base::Optional<GURL>& redirect_url);
|
||||
const absl::optional<std::string>& headers,
|
||||
const absl::optional<GURL>& redirect_url);
|
||||
|
||||
void SendBody();
|
||||
void ReadMore();
|
||||
|
@ -32,9 +32,8 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
|
||||
// initialize additional state, and that should be done on the UI thread
|
||||
// instead of potentially racing with the WillCreateURLLoaderFactory
|
||||
// implementation.
|
||||
auto loader_factory =
|
||||
content::BrowserContext::GetDefaultStoragePartition(browser_context)
|
||||
->GetURLLoaderFactoryForBrowserProcess();
|
||||
auto loader_factory = browser_context->GetDefaultStoragePartition()
|
||||
->GetURLLoaderFactoryForBrowserProcess();
|
||||
|
||||
network::mojom::URLLoaderFactoryPtrInfo proxy_factory_ptr_info;
|
||||
network::mojom::URLLoaderFactoryRequest proxy_factory_request;
|
||||
@ -65,7 +64,7 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
|
||||
should_proxy |= browser_client->WillCreateURLLoaderFactory(
|
||||
browser_context, render_frame_host, render_process_id,
|
||||
content::ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource,
|
||||
url::Origin(), base::nullopt /* navigation_id */, ukm::SourceIdObj(),
|
||||
url::Origin(), absl::nullopt /* navigation_id */, ukm::SourceIdObj(),
|
||||
&maybe_proxy_factory_request, nullptr /* header_client */,
|
||||
nullptr /* bypass_redirect_checks */, nullptr /* disable_secure_dns */,
|
||||
nullptr /* factory_override */);
|
||||
|
@ -101,7 +101,7 @@ class CefOriginWhitelistManager {
|
||||
}
|
||||
|
||||
void GetCrossOriginWhitelistEntries(
|
||||
base::Optional<CrossOriginWhiteList>* entries) const {
|
||||
absl::optional<CrossOriginWhiteList>* entries) const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
if (!origin_list_.empty()) {
|
||||
@ -226,9 +226,9 @@ bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin,
|
||||
} else {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(base::IgnoreResult(&CefAddCrossOriginWhitelistEntry),
|
||||
source_origin, target_protocol, target_domain,
|
||||
allow_target_subdomains));
|
||||
base::BindOnce(base::IgnoreResult(&CefAddCrossOriginWhitelistEntry),
|
||||
source_origin, target_protocol, target_domain,
|
||||
allow_target_subdomains));
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -257,9 +257,9 @@ bool CefRemoveCrossOriginWhitelistEntry(const CefString& source_origin,
|
||||
} else {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(base::IgnoreResult(&CefRemoveCrossOriginWhitelistEntry),
|
||||
source_origin, target_protocol, target_domain,
|
||||
allow_target_subdomains));
|
||||
base::BindOnce(base::IgnoreResult(&CefRemoveCrossOriginWhitelistEntry),
|
||||
source_origin, target_protocol, target_domain,
|
||||
allow_target_subdomains));
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -276,14 +276,15 @@ bool CefClearCrossOriginWhitelist() {
|
||||
CefOriginWhitelistManager::GetInstance()->ClearOrigins();
|
||||
} else {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::Bind(base::IgnoreResult(&CefClearCrossOriginWhitelist)));
|
||||
CEF_UIT,
|
||||
base::BindOnce(base::IgnoreResult(&CefClearCrossOriginWhitelist)));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GetCrossOriginWhitelistEntries(
|
||||
base::Optional<CrossOriginWhiteList>* entries) {
|
||||
absl::optional<CrossOriginWhiteList>* entries) {
|
||||
CefOriginWhitelistManager::GetInstance()->GetCrossOriginWhitelistEntries(
|
||||
entries);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
#include "cef/libcef/common/mojom/cef.mojom-forward.h"
|
||||
|
||||
@ -25,7 +25,7 @@ using CrossOriginWhiteList =
|
||||
// Called to retrieve the current list of cross-origin white list entries. This
|
||||
// method is thread safe.
|
||||
void GetCrossOriginWhitelistEntries(
|
||||
base::Optional<CrossOriginWhiteList>* entries);
|
||||
absl::optional<CrossOriginWhiteList>* entries);
|
||||
|
||||
// Returns true if |source| can access |target| based on the cross-origin white
|
||||
// list settings.
|
||||
|
@ -207,7 +207,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
DCHECK(render_widget_host_);
|
||||
DCHECK(!render_widget_host_->GetView());
|
||||
|
||||
set_current_device_scale_factor(kDefaultScaleFactor);
|
||||
SetCurrentDeviceScaleFactor(kDefaultScaleFactor);
|
||||
|
||||
if (parent_host_view_) {
|
||||
browser_impl_ = parent_host_view_->browser_impl();
|
||||
@ -432,7 +432,7 @@ bool CefRenderWidgetHostViewOSR::IsShowing() {
|
||||
void CefRenderWidgetHostViewOSR::EnsureSurfaceSynchronizedForWebTest() {
|
||||
++latest_capture_sequence_number_;
|
||||
SynchronizeVisualProperties(cc::DeadlinePolicy::UseInfiniteDeadline(),
|
||||
base::nullopt);
|
||||
absl::nullopt);
|
||||
}
|
||||
|
||||
gfx::Rect CefRenderWidgetHostViewOSR::GetViewBounds() {
|
||||
@ -452,15 +452,15 @@ void CefRenderWidgetHostViewOSR::SetBackgroundColor(SkColor color) {
|
||||
content::RenderWidgetHostViewBase::SetBackgroundColor(color);
|
||||
}
|
||||
|
||||
base::Optional<SkColor> CefRenderWidgetHostViewOSR::GetBackgroundColor() {
|
||||
absl::optional<SkColor> CefRenderWidgetHostViewOSR::GetBackgroundColor() {
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UpdateBackgroundColor() {}
|
||||
|
||||
base::Optional<content::DisplayFeature>
|
||||
absl::optional<content::DisplayFeature>
|
||||
CefRenderWidgetHostViewOSR::GetDisplayFeature() {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetDisplayFeatureForTesting(
|
||||
@ -524,7 +524,7 @@ CefRenderWidgetHostViewOSR::GetCurrentLocalSurfaceId() const {
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UpdateLocalSurfaceIdFromEmbeddedClient(
|
||||
const base::Optional<viz::LocalSurfaceId>&
|
||||
const absl::optional<viz::LocalSurfaceId>&
|
||||
embedded_client_local_surface_id) {
|
||||
if (embedded_client_local_surface_id) {
|
||||
parent_local_surface_id_allocator_->UpdateFromChild(
|
||||
@ -652,7 +652,7 @@ void CefRenderWidgetHostViewOSR::Destroy() {
|
||||
delete this;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetTooltipText(
|
||||
void CefRenderWidgetHostViewOSR::UpdateTooltipUnderCursor(
|
||||
const std::u16string& tooltip_text) {
|
||||
if (!browser_impl_.get())
|
||||
return;
|
||||
@ -667,7 +667,7 @@ void CefRenderWidgetHostViewOSR::SetTooltipText(
|
||||
|
||||
gfx::Size CefRenderWidgetHostViewOSR::GetCompositorViewportPixelSize() {
|
||||
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
|
||||
current_device_scale_factor());
|
||||
GetCurrentDeviceScaleFactor());
|
||||
}
|
||||
|
||||
uint32_t CefRenderWidgetHostViewOSR::GetCaptureSequenceNumber() const {
|
||||
@ -890,7 +890,7 @@ void CefRenderWidgetHostViewOSR::DidNavigate() {
|
||||
GetLocalSurfaceId());
|
||||
} else {
|
||||
SynchronizeVisualProperties(cc::DeadlinePolicy::UseExistingDeadline(),
|
||||
base::nullopt);
|
||||
absl::nullopt);
|
||||
}
|
||||
}
|
||||
if (delegated_frame_host_)
|
||||
@ -927,8 +927,8 @@ void CefRenderWidgetHostViewOSR::OnRenderFrameMetadataChangedAfterActivation(
|
||||
// Send the notification asynchronously.
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefRenderWidgetHostViewOSR::OnScrollOffsetChanged,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
base::BindOnce(&CefRenderWidgetHostViewOSR::OnScrollOffsetChanged,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -961,12 +961,12 @@ void CefRenderWidgetHostViewOSR::WasResized() {
|
||||
}
|
||||
|
||||
SynchronizeVisualProperties(cc::DeadlinePolicy::UseExistingDeadline(),
|
||||
base::nullopt);
|
||||
absl::nullopt);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SynchronizeVisualProperties(
|
||||
const cc::DeadlinePolicy& deadline_policy,
|
||||
const base::Optional<viz::LocalSurfaceId>& child_local_surface_id) {
|
||||
const absl::optional<viz::LocalSurfaceId>& child_local_surface_id) {
|
||||
SetFrameRate();
|
||||
|
||||
const bool resized = ResizeRootLayer();
|
||||
@ -1005,7 +1005,7 @@ void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() {
|
||||
return;
|
||||
|
||||
SynchronizeVisualProperties(cc::DeadlinePolicy::UseDefaultDeadline(),
|
||||
base::nullopt);
|
||||
absl::nullopt);
|
||||
|
||||
if (render_widget_host_->delegate())
|
||||
render_widget_host_->delegate()->SendScreenRects();
|
||||
@ -1180,8 +1180,8 @@ void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
|
||||
// some other callback.
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefRenderWidgetHostViewOSR::CancelWidget,
|
||||
popup_host_view_->weak_ptr_factory_.GetWeakPtr()));
|
||||
base::BindOnce(&CefRenderWidgetHostViewOSR::CancelWidget,
|
||||
popup_host_view_->weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
} else if (!guest_host_views_.empty()) {
|
||||
for (auto guest_host_view : guest_host_views_) {
|
||||
@ -1394,7 +1394,7 @@ void CefRenderWidgetHostViewOSR::UpdateFrameRate() {
|
||||
|
||||
gfx::Size CefRenderWidgetHostViewOSR::SizeInPixels() {
|
||||
return gfx::ScaleToCeiledSize(GetViewBounds().size(),
|
||||
current_device_scale_factor());
|
||||
GetCurrentDeviceScaleFactor());
|
||||
}
|
||||
|
||||
#if defined(OS_MAC)
|
||||
@ -1490,10 +1490,10 @@ bool CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
|
||||
DCHECK(!hold_resize_);
|
||||
|
||||
const float new_scale_factor = ::GetDeviceScaleFactor(browser_impl_.get());
|
||||
if (new_scale_factor == current_device_scale_factor())
|
||||
if (new_scale_factor == GetCurrentDeviceScaleFactor())
|
||||
return false;
|
||||
|
||||
set_current_device_scale_factor(new_scale_factor);
|
||||
SetCurrentDeviceScaleFactor(new_scale_factor);
|
||||
|
||||
// Notify the guest hosts if any.
|
||||
for (auto guest_host_view : guest_host_views_) {
|
||||
@ -1503,13 +1503,25 @@ bool CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
|
||||
auto guest_view_osr =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(rwhi->GetView());
|
||||
if (guest_view_osr) {
|
||||
guest_view_osr->set_current_device_scale_factor(new_scale_factor);
|
||||
guest_view_osr->SetCurrentDeviceScaleFactor(new_scale_factor);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetCurrentDeviceScaleFactor(float scale) {
|
||||
// Initialize a display struct as needed, to cache the scale factor.
|
||||
if (display_list_.displays().empty()) {
|
||||
display_list_ = display::DisplayList(
|
||||
{display::Display(display::kDefaultDisplayId)},
|
||||
display::kDefaultDisplayId, display::kDefaultDisplayId);
|
||||
}
|
||||
display::Display current_display = display_list_.GetCurrentDisplay();
|
||||
current_display.set_device_scale_factor(scale);
|
||||
display_list_.UpdateDisplay(current_display);
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::SetViewBounds() {
|
||||
// This method should not be called while the resize hold is active.
|
||||
DCHECK(!hold_resize_);
|
||||
@ -1537,7 +1549,7 @@ bool CefRenderWidgetHostViewOSR::SetRootLayerSize(bool force) {
|
||||
if (compositor_) {
|
||||
compositor_local_surface_id_allocator_.GenerateId();
|
||||
compositor_->SetScaleAndSize(
|
||||
current_device_scale_factor(), SizeInPixels(),
|
||||
GetCurrentDeviceScaleFactor(), SizeInPixels(),
|
||||
compositor_local_surface_id_allocator_.GetCurrentLocalSurfaceId());
|
||||
}
|
||||
|
||||
@ -1566,8 +1578,9 @@ void CefRenderWidgetHostViewOSR::ReleaseResizeHold() {
|
||||
hold_resize_ = false;
|
||||
if (pending_resize_) {
|
||||
pending_resize_ = false;
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefRenderWidgetHostViewOSR::WasResized,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefRenderWidgetHostViewOSR::WasResized,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "libcef/browser/osr/motion_event_osr.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "build/build_config.h"
|
||||
#include "cc/layers/deadline_policy.h"
|
||||
#include "components/viz/common/frame_sinks/begin_frame_source.h"
|
||||
@ -29,6 +28,7 @@
|
||||
#include "content/browser/renderer_host/text_input_manager.h"
|
||||
#include "content/public/browser/render_frame_metadata_provider.h"
|
||||
#include "content/public/common/widget_type.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/base/cursor/cursor.h"
|
||||
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
@ -117,9 +117,9 @@ class CefRenderWidgetHostViewOSR
|
||||
void EnsureSurfaceSynchronizedForWebTest() override;
|
||||
gfx::Rect GetViewBounds() override;
|
||||
void SetBackgroundColor(SkColor color) override;
|
||||
base::Optional<SkColor> GetBackgroundColor() override;
|
||||
absl::optional<SkColor> GetBackgroundColor() override;
|
||||
void UpdateBackgroundColor() override;
|
||||
base::Optional<content::DisplayFeature> GetDisplayFeature() override;
|
||||
absl::optional<content::DisplayFeature> GetDisplayFeature() override;
|
||||
void SetDisplayFeatureForTesting(
|
||||
const content::DisplayFeature* display_feature) override;
|
||||
blink::mojom::PointerLockResult LockMouse(
|
||||
@ -150,7 +150,7 @@ class CefRenderWidgetHostViewOSR
|
||||
void SetIsLoading(bool is_loading) override;
|
||||
void RenderProcessGone() override;
|
||||
void Destroy() override;
|
||||
void SetTooltipText(const std::u16string& tooltip_text) override;
|
||||
void UpdateTooltipUnderCursor(const std::u16string& tooltip_text) override;
|
||||
content::CursorManager* GetCursorManager() override;
|
||||
gfx::Size GetCompositorViewportPixelSize() override;
|
||||
void CopyFromSurface(
|
||||
@ -215,7 +215,7 @@ class CefRenderWidgetHostViewOSR
|
||||
void WasResized();
|
||||
void SynchronizeVisualProperties(
|
||||
const cc::DeadlinePolicy& deadline_policy,
|
||||
const base::Optional<viz::LocalSurfaceId>& child_local_surface_id);
|
||||
const absl::optional<viz::LocalSurfaceId>& child_local_surface_id);
|
||||
void OnScreenInfoChanged();
|
||||
void Invalidate(CefBrowserHost::PaintElementType type);
|
||||
void SendExternalBeginFrame();
|
||||
@ -277,6 +277,7 @@ class CefRenderWidgetHostViewOSR
|
||||
private:
|
||||
void SetFrameRate();
|
||||
bool SetDeviceScaleFactor();
|
||||
void SetCurrentDeviceScaleFactor(float scale);
|
||||
bool SetViewBounds();
|
||||
bool SetRootLayerSize(bool force);
|
||||
|
||||
@ -315,7 +316,7 @@ class CefRenderWidgetHostViewOSR
|
||||
// has allocated one. Also sets child sequence number component of the
|
||||
// viz::LocalSurfaceId allocator.
|
||||
void UpdateLocalSurfaceIdFromEmbeddedClient(
|
||||
const base::Optional<viz::LocalSurfaceId>& local_surface_id);
|
||||
const absl::optional<viz::LocalSurfaceId>& local_surface_id);
|
||||
|
||||
// Returns the current viz::LocalSurfaceIdAllocation.
|
||||
const viz::LocalSurfaceId& GetOrCreateLocalSurfaceId();
|
||||
|
@ -66,7 +66,7 @@ void CefVideoConsumerOSR::SizeChanged(const gfx::Size& size_in_pixels) {
|
||||
}
|
||||
|
||||
void CefVideoConsumerOSR::RequestRefreshFrame(
|
||||
const base::Optional<gfx::Rect>& bounds_in_pixels) {
|
||||
const absl::optional<gfx::Rect>& bounds_in_pixels) {
|
||||
bounds_in_pixels_ = bounds_in_pixels;
|
||||
video_capturer_->RequestRefreshFrame();
|
||||
}
|
||||
@ -112,7 +112,7 @@ void CefVideoConsumerOSR::OnFrameCaptured(
|
||||
// Use the bounds passed to RequestRefreshFrame().
|
||||
damage_rect = gfx::Rect(info->coded_size);
|
||||
damage_rect.Intersect(*bounds_in_pixels_);
|
||||
bounds_in_pixels_ = base::nullopt;
|
||||
bounds_in_pixels_ = absl::nullopt;
|
||||
} else {
|
||||
// Retrieve the rectangular region of the frame that has changed since the
|
||||
// frame with the directly preceding CAPTURE_COUNTER. If that frame was not
|
||||
|
@ -2,9 +2,9 @@
|
||||
#define LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/optional.h"
|
||||
#include "components/viz/host/client_frame_sink_video_capturer.h"
|
||||
#include "media/capture/mojom/video_capture_types.mojom.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
class CefRenderWidgetHostViewOSR;
|
||||
|
||||
@ -16,7 +16,7 @@ class CefVideoConsumerOSR : public viz::mojom::FrameSinkVideoConsumer {
|
||||
void SetActive(bool active);
|
||||
void SetFrameRate(base::TimeDelta frame_rate);
|
||||
void SizeChanged(const gfx::Size& size_in_pixels);
|
||||
void RequestRefreshFrame(const base::Optional<gfx::Rect>& bounds_in_pixels);
|
||||
void RequestRefreshFrame(const absl::optional<gfx::Rect>& bounds_in_pixels);
|
||||
|
||||
private:
|
||||
// viz::mojom::FrameSinkVideoConsumer implementation.
|
||||
@ -33,7 +33,7 @@ class CefVideoConsumerOSR : public viz::mojom::FrameSinkVideoConsumer {
|
||||
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
|
||||
|
||||
gfx::Size size_in_pixels_;
|
||||
base::Optional<gfx::Rect> bounds_in_pixels_;
|
||||
absl::optional<gfx::Rect> bounds_in_pixels_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefVideoConsumerOSR);
|
||||
};
|
||||
|
@ -249,6 +249,10 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
false);
|
||||
registry->RegisterBooleanPref(prefs::kWebRTCAllowLegacyTLSProtocols, false);
|
||||
|
||||
// Profile preferences.
|
||||
// Based on chrome/browser/profiles/profiles_state.cc RegisterPrefs.
|
||||
registry->RegisterStringPref(prefs::kProfileLastUsed, std::string());
|
||||
|
||||
if (profile) {
|
||||
// Call RegisterProfilePrefs() for all services listed by
|
||||
// EnsureBrowserContextKeyedServiceFactoriesBuilt().
|
||||
@ -310,10 +314,6 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
registry->SetDefaultPrefValue(spellcheck::prefs::kSpellCheckEnable,
|
||||
base::Value(!enable_spelling_service_));
|
||||
|
||||
// Pepper flash preferences.
|
||||
// Modify defaults from DeviceIDFetcher::RegisterProfilePrefs.
|
||||
registry->SetDefaultPrefValue(prefs::kEnableDRM, base::Value(false));
|
||||
|
||||
// DevTools preferences.
|
||||
// Based on DevToolsWindow::RegisterProfilePrefs.
|
||||
registry->RegisterDictionaryPref(prefs::kDevToolsPreferences);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/notreached.h"
|
||||
#include "chrome/browser/platform_util.h"
|
||||
#include "chrome/browser/ui/browser_finder.h"
|
||||
#include "components/web_modal/web_contents_modal_dialog_host.h"
|
||||
|
@ -39,8 +39,9 @@ class CefPrintDialogCallbackImpl : public CefPrintDialogCallback {
|
||||
dialog_ = nullptr;
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefPrintDialogCallbackImpl::Continue,
|
||||
this, settings));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefPrintDialogCallbackImpl::Continue, this,
|
||||
settings));
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +53,7 @@ class CefPrintDialogCallbackImpl : public CefPrintDialogCallback {
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefPrintDialogCallbackImpl::Cancel, this));
|
||||
base::BindOnce(&CefPrintDialogCallbackImpl::Cancel, this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +79,7 @@ class CefPrintJobCallbackImpl : public CefPrintJobCallback {
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefPrintJobCallbackImpl::Continue, this));
|
||||
base::BindOnce(&CefPrintJobCallbackImpl::Continue, this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,8 +215,9 @@ void CefPrintDialogLinux::PrintDocument(
|
||||
}
|
||||
|
||||
// No errors, continue printing.
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefPrintDialogLinux::SendDocumentToPrinter,
|
||||
this, document_name));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(&CefPrintDialogLinux::SendDocumentToPrinter, this,
|
||||
document_name));
|
||||
}
|
||||
|
||||
void CefPrintDialogLinux::AddRefToDialog() {
|
||||
|
@ -149,7 +149,7 @@ void StopWorker(int document_cookie) {
|
||||
// Write the PDF file to disk.
|
||||
void SavePdfFile(scoped_refptr<base::RefCountedSharedMemoryMapping> data,
|
||||
const base::FilePath& path,
|
||||
const CefPrintViewManager::PdfPrintCallback& callback) {
|
||||
CefPrintViewManager::PdfPrintCallback callback) {
|
||||
CEF_REQUIRE_BLOCKING();
|
||||
DCHECK_GT(data->size(), 0U);
|
||||
|
||||
@ -161,8 +161,8 @@ void SavePdfFile(scoped_refptr<base::RefCountedSharedMemoryMapping> data,
|
||||
bool ok = file.IsValid() && metafile.SaveTo(&file);
|
||||
|
||||
if (!callback.is_null()) {
|
||||
content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE,
|
||||
base::Bind(callback, ok));
|
||||
content::GetUIThreadTaskRunner({})->PostTask(
|
||||
FROM_HERE, base::BindOnce(std::move(callback), ok));
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ CefPrintViewManager::~CefPrintViewManager() {
|
||||
bool CefPrintViewManager::PrintToPDF(content::RenderFrameHost* rfh,
|
||||
const base::FilePath& path,
|
||||
const CefPdfPrintSettings& settings,
|
||||
const PdfPrintCallback& callback) {
|
||||
PdfPrintCallback callback) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
|
||||
// Don't start print again while printing is currently in progress.
|
||||
@ -200,7 +200,7 @@ bool CefPrintViewManager::PrintToPDF(content::RenderFrameHost* rfh,
|
||||
pdf_print_state_.reset(new PdfPrintState);
|
||||
pdf_print_state_->printing_rfh_ = rfh;
|
||||
pdf_print_state_->output_path_ = path;
|
||||
pdf_print_state_->callback_ = callback;
|
||||
pdf_print_state_->callback_ = std::move(callback);
|
||||
|
||||
FillInDictionaryFromPdfPrintSettings(settings, ++next_pdf_request_id_,
|
||||
pdf_print_state_->settings_);
|
||||
@ -276,15 +276,15 @@ void CefPrintViewManager::MetafileReadyForPrinting(
|
||||
}
|
||||
|
||||
const base::FilePath output_path = pdf_print_state_->output_path_;
|
||||
const PdfPrintCallback print_callback = pdf_print_state_->callback_;
|
||||
PdfPrintCallback print_callback = std::move(pdf_print_state_->callback_);
|
||||
|
||||
// Reset state information.
|
||||
pdf_print_state_.reset();
|
||||
pdf_print_receiver_.reset();
|
||||
|
||||
// Save the PDF file to disk and then execute the callback.
|
||||
CEF_POST_USER_VISIBLE_TASK(
|
||||
base::Bind(&SavePdfFile, shared_buf, output_path, print_callback));
|
||||
CEF_POST_USER_VISIBLE_TASK(base::BindOnce(
|
||||
&SavePdfFile, shared_buf, output_path, std::move(print_callback)));
|
||||
}
|
||||
|
||||
void CefPrintViewManager::PrintPreviewFailed(int32_t document_cookie,
|
||||
@ -350,7 +350,8 @@ void CefPrintViewManager::TerminatePdfPrintJob() {
|
||||
if (!pdf_print_state_->callback_.is_null()) {
|
||||
// Execute the callback.
|
||||
content::GetUIThreadTaskRunner({})->PostTask(
|
||||
FROM_HERE, base::Bind(pdf_print_state_->callback_, false));
|
||||
FROM_HERE,
|
||||
base::BindOnce(std::move(pdf_print_state_->callback_), false));
|
||||
}
|
||||
|
||||
// Reset state information.
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
|
||||
#include "base/callback_forward.h"
|
||||
#include "base/macros.h"
|
||||
#include "chrome/browser/printing/print_view_manager.h"
|
||||
#include "components/printing/common/print.mojom-forward.h"
|
||||
@ -30,13 +31,13 @@ class CefPrintViewManager : public PrintViewManager,
|
||||
~CefPrintViewManager() override;
|
||||
|
||||
// Callback executed on PDF printing completion.
|
||||
typedef base::Callback<void(bool /*ok*/)> PdfPrintCallback;
|
||||
typedef base::OnceCallback<void(bool /*ok*/)> PdfPrintCallback;
|
||||
|
||||
// Print the current document to a PDF file. Execute |callback| on completion.
|
||||
bool PrintToPDF(content::RenderFrameHost* rfh,
|
||||
const base::FilePath& path,
|
||||
const CefPdfPrintSettings& settings,
|
||||
const PdfPrintCallback& callback);
|
||||
PdfPrintCallback callback);
|
||||
|
||||
// mojom::PrintManagerHost methods:
|
||||
void GetDefaultPrintSettings(
|
||||
|
@ -47,8 +47,6 @@ const char* GetTypeString(base::Value::Type type) {
|
||||
return "DICTIONARY";
|
||||
case base::Value::Type::LIST:
|
||||
return "LIST";
|
||||
case base::Value::Type::DEAD:
|
||||
return "DEAD";
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
@ -62,7 +60,7 @@ struct ResolveHostHelperOld {
|
||||
|
||||
void OnResolveCompleted(int result) {
|
||||
std::vector<CefString> resolved_ips;
|
||||
base::Optional<net::AddressList> maybe_address_list =
|
||||
absl::optional<net::AddressList> maybe_address_list =
|
||||
request_->GetAddressResults();
|
||||
if (maybe_address_list) {
|
||||
net::AddressList::const_iterator iter = maybe_address_list->begin();
|
||||
@ -71,8 +69,8 @@ struct ResolveHostHelperOld {
|
||||
}
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefResolveCallback::OnResolveCompleted, callback_,
|
||||
static_cast<cef_errorcode_t>(result), resolved_ips));
|
||||
base::BindOnce(&CefResolveCallback::OnResolveCompleted, callback_,
|
||||
static_cast<cef_errorcode_t>(result), resolved_ips));
|
||||
|
||||
delete this;
|
||||
}
|
||||
@ -90,11 +88,11 @@ class ResolveHostHelper : public network::ResolveHostClientBase {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
browser_context->GetNetworkContext()->CreateHostResolver(
|
||||
base::nullopt, host_resolver_.BindNewPipeAndPassReceiver());
|
||||
absl::nullopt, host_resolver_.BindNewPipeAndPassReceiver());
|
||||
|
||||
host_resolver_.set_disconnect_handler(base::BindOnce(
|
||||
&ResolveHostHelper::OnComplete, base::Unretained(this), net::ERR_FAILED,
|
||||
net::ResolveErrorInfo(net::ERR_FAILED), base::nullopt));
|
||||
net::ResolveErrorInfo(net::ERR_FAILED), absl::nullopt));
|
||||
|
||||
host_resolver_->ResolveHost(
|
||||
net::HostPortPair::FromURL(GURL(origin.ToString())),
|
||||
@ -106,7 +104,7 @@ class ResolveHostHelper : public network::ResolveHostClientBase {
|
||||
void OnComplete(
|
||||
int32_t result,
|
||||
const ::net::ResolveErrorInfo& resolve_error_info,
|
||||
const base::Optional<net::AddressList>& resolved_addresses) override {
|
||||
const absl::optional<net::AddressList>& resolved_addresses) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
host_resolver_.reset();
|
||||
@ -731,11 +729,11 @@ void CefRequestContextImpl::ClearCertificateExceptionsInternal(
|
||||
content::SSLHostStateDelegate* ssl_delegate =
|
||||
browser_context->AsBrowserContext()->GetSSLHostStateDelegate();
|
||||
if (ssl_delegate)
|
||||
ssl_delegate->Clear(base::Callback<bool(const std::string&)>());
|
||||
ssl_delegate->Clear(base::NullCallback());
|
||||
|
||||
if (callback) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefCompletionCallback::OnComplete, callback));
|
||||
base::BindOnce(&CefCompletionCallback::OnComplete, callback));
|
||||
}
|
||||
}
|
||||
|
||||
@ -748,7 +746,7 @@ void CefRequestContextImpl::ClearHttpAuthCredentialsInternal(
|
||||
|
||||
browser_context->GetNetworkContext()->ClearHttpAuthCache(
|
||||
/*start_time=*/base::Time(), /*end_time=*/base::Time::Max(),
|
||||
base::Bind(&CefCompletionCallback::OnComplete, callback));
|
||||
base::BindOnce(&CefCompletionCallback::OnComplete, callback));
|
||||
}
|
||||
|
||||
void CefRequestContextImpl::CloseAllConnectionsInternal(
|
||||
@ -759,7 +757,7 @@ void CefRequestContextImpl::CloseAllConnectionsInternal(
|
||||
return;
|
||||
|
||||
browser_context->GetNetworkContext()->CloseAllConnections(
|
||||
base::Bind(&CefCompletionCallback::OnComplete, callback));
|
||||
base::BindOnce(&CefCompletionCallback::OnComplete, callback));
|
||||
}
|
||||
|
||||
void CefRequestContextImpl::ResolveHostInternal(
|
||||
|
@ -421,7 +421,7 @@ bool CefSimpleMenuModelImpl::SetAcceleratorAt(int index,
|
||||
bool CefSimpleMenuModelImpl::RemoveAccelerator(int command_id) {
|
||||
if (!VerifyContext() || command_id == kInvalidIndex)
|
||||
return false;
|
||||
state_delegate_->SetAccelerator(command_id, base::nullopt);
|
||||
state_delegate_->SetAccelerator(command_id, absl::nullopt);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ class CefSimpleMenuModelImpl : public CefMenuModel {
|
||||
public:
|
||||
virtual void SetChecked(int command_id, bool checked) = 0;
|
||||
virtual void SetAccelerator(int command_id,
|
||||
base::Optional<ui::Accelerator> accel) = 0;
|
||||
absl::optional<ui::Accelerator> accel) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~StateDelegate() {}
|
||||
|
@ -17,12 +17,13 @@ namespace {
|
||||
// represented by |message_loop_proxy|.
|
||||
void CreateTemporaryFileOnBackgroundThread(
|
||||
scoped_refptr<base::SequencedTaskRunner> message_loop_proxy,
|
||||
base::Callback<void(const base::FilePath&)> callback) {
|
||||
base::OnceCallback<void(const base::FilePath&)> callback) {
|
||||
CEF_REQUIRE_BLOCKING();
|
||||
base::FilePath file_path;
|
||||
if (!base::CreateTemporaryFile(&file_path))
|
||||
LOG(ERROR) << "Failed to create temporary file.";
|
||||
message_loop_proxy->PostTask(FROM_HERE, base::Bind(callback, file_path));
|
||||
message_loop_proxy->PostTask(FROM_HERE,
|
||||
base::BindOnce(std::move(callback), file_path));
|
||||
}
|
||||
|
||||
// Release the wrapped callback object after completion.
|
||||
@ -102,19 +103,20 @@ bool CefTraceSubscriber::EndTracing(const base::FilePath& tracing_file,
|
||||
if (tracing_file.empty()) {
|
||||
// Create a new temporary file path on the FILE thread, then continue.
|
||||
CEF_POST_USER_VISIBLE_TASK(
|
||||
base::Bind(CreateTemporaryFileOnBackgroundThread,
|
||||
base::ThreadTaskRunnerHandle::Get(),
|
||||
base::Bind(&CefTraceSubscriber::ContinueEndTracing,
|
||||
weak_factory_.GetWeakPtr(), callback)));
|
||||
base::BindOnce(CreateTemporaryFileOnBackgroundThread,
|
||||
base::ThreadTaskRunnerHandle::Get(),
|
||||
base::BindOnce(&CefTraceSubscriber::ContinueEndTracing,
|
||||
weak_factory_.GetWeakPtr(), callback)));
|
||||
return true;
|
||||
}
|
||||
|
||||
base::Closure result_callback =
|
||||
base::Bind(&CefTraceSubscriber::OnTracingFileResult,
|
||||
weak_factory_.GetWeakPtr(), callback, tracing_file);
|
||||
auto result_callback =
|
||||
base::BindOnce(&CefTraceSubscriber::OnTracingFileResult,
|
||||
weak_factory_.GetWeakPtr(), callback, tracing_file);
|
||||
|
||||
TracingController::GetInstance()->StopTracing(
|
||||
TracingController::CreateFileEndpoint(tracing_file, result_callback));
|
||||
TracingController::CreateFileEndpoint(tracing_file,
|
||||
std::move(result_callback)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -53,8 +53,8 @@ CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetState(cef_button_state_t state) {
|
||||
views::Button::ButtonState new_state =
|
||||
static_cast<views::Button::ButtonState>(state);
|
||||
|
||||
if (ParentClass::root_view()->ink_drop_mode() !=
|
||||
views::Button::InkDropMode::OFF &&
|
||||
if (ParentClass::root_view()->ink_drop()->ink_drop_mode() !=
|
||||
views::InkDropHost::InkDropMode::OFF &&
|
||||
!ParentClass::root_view()->IsFocusable()) {
|
||||
// Ink drop state does not get set properly on state change when the button
|
||||
// is non-focusable.
|
||||
@ -64,7 +64,7 @@ CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetState(cef_button_state_t state) {
|
||||
} else if (old_state == views::Button::STATE_PRESSED) {
|
||||
ink_state = views::InkDropState::DEACTIVATED;
|
||||
}
|
||||
ParentClass::root_view()->AnimateInkDrop(ink_state, nullptr);
|
||||
ParentClass::root_view()->ink_drop()->AnimateToState(ink_state, nullptr);
|
||||
}
|
||||
|
||||
ParentClass::root_view()->SetState(new_state);
|
||||
@ -77,11 +77,11 @@ CEF_BUTTON_IMPL_T cef_button_state_t CEF_BUTTON_IMPL_D::GetState() {
|
||||
|
||||
CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetInkDropEnabled(bool enabled) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
ParentClass::root_view()->SetInkDropMode(
|
||||
enabled ? views::InkDropHostView::InkDropMode::ON
|
||||
: views::InkDropHostView::InkDropMode::OFF);
|
||||
ParentClass::root_view()->ink_drop()->SetMode(
|
||||
enabled ? views::InkDropHost::InkDropMode::ON
|
||||
: views::InkDropHost::InkDropMode::OFF);
|
||||
if (enabled) {
|
||||
ParentClass::root_view()->SetInkDropBaseColor(
|
||||
ParentClass::root_view()->ink_drop()->SetBaseColor(
|
||||
color_utils::BlendTowardMaxContrast(
|
||||
ParentClass::root_view()->background()->get_color(), 0x61));
|
||||
}
|
||||
|
@ -59,15 +59,16 @@ CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::ButtonPressed(
|
||||
// Callback may trigger new animation state.
|
||||
if (ParentClass::cef_delegate())
|
||||
ParentClass::cef_delegate()->OnButtonPressed(GetCefButton());
|
||||
if (ParentClass::ink_drop_mode() != views::Button::InkDropMode::OFF &&
|
||||
if (ParentClass::ink_drop()->ink_drop_mode() !=
|
||||
views::InkDropHost::InkDropMode::OFF &&
|
||||
!ParentClass::IsFocusable() &&
|
||||
ParentClass::GetState() != views::Button::STATE_PRESSED) {
|
||||
// Ink drop state does not get reset properly on click when the button is
|
||||
// non-focusable. Reset the ink drop state here if the state has not been
|
||||
// explicitly set to pressed by the OnButtonPressed callback calling
|
||||
// SetState (which also sets the ink drop state).
|
||||
ParentClass::AnimateInkDrop(views::InkDropState::HIDDEN,
|
||||
ui::LocatedEvent::FromIfValid(&event));
|
||||
ParentClass::ink_drop()->AnimateToState(
|
||||
views::InkDropState::HIDDEN, ui::LocatedEvent::FromIfValid(&event));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "libcef/browser/views/window_view.h"
|
||||
|
||||
#include "ui/base/test/ui_controls.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/views/controls/button/menu_button.h"
|
||||
#include "ui/views/controls/menu/menu_runner.h"
|
||||
@ -434,11 +435,11 @@ void CefWindowImpl::ShowMenu(views::MenuButton* menu_button,
|
||||
// We'll send the MenuClosed notification manually for better accuracy.
|
||||
menu_model_->set_auto_notify_menu_closed(false);
|
||||
|
||||
menu_runner_.reset(
|
||||
new views::MenuRunner(menu_model_impl->model(),
|
||||
menu_button ? views::MenuRunner::HAS_MNEMONICS
|
||||
: views::MenuRunner::CONTEXT_MENU,
|
||||
base::Bind(&CefWindowImpl::MenuClosed, this)));
|
||||
menu_runner_.reset(new views::MenuRunner(
|
||||
menu_model_impl->model(),
|
||||
menu_button ? views::MenuRunner::HAS_MNEMONICS
|
||||
: views::MenuRunner::CONTEXT_MENU,
|
||||
base::BindRepeating(&CefWindowImpl::MenuClosed, this)));
|
||||
|
||||
menu_runner_->RunMenuAt(
|
||||
widget_, menu_button ? menu_button->button_controller() : nullptr,
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "libcef/browser/views/window_impl.h"
|
||||
#include "libcef/features/runtime.h"
|
||||
|
||||
#include "third_party/skia/include/core/SkRegion.h"
|
||||
#include "ui/base/hit_test.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
#include "ui/views/window/native_frame_view.h"
|
||||
@ -285,7 +284,7 @@ void CefWindowView::CreateWidget() {
|
||||
|
||||
can_activate = can_activate_menu;
|
||||
if (can_activate_menu)
|
||||
params.activatable = views::Widget::InitParams::ACTIVATABLE_YES;
|
||||
params.activatable = views::Widget::InitParams::Activatable::kYes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user