Skip to content

Commit

Permalink
chore: remove last instances of base::Bind (#18178)
Browse files Browse the repository at this point in the history
* chore: remove last instances of base::Bind

* MessageBoxCallback is a OnceCallback

* convert permission helepr cbs to Once

* convert ResponseCallback to Once
  • Loading branch information
codebytere committed May 29, 2019
1 parent 96371b6 commit 9af5072
Show file tree
Hide file tree
Showing 23 changed files with 122 additions and 109 deletions.
17 changes: 9 additions & 8 deletions atom/browser/api/atom_api_menu.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -100,16 +100,17 @@ class Menu : public mate::TrackableObject<Menu>,
bool WorksWhenHiddenAt(int index) const; bool WorksWhenHiddenAt(int index) const;


// Stored delegate methods. // Stored delegate methods.
base::Callback<bool(v8::Local<v8::Value>, int)> is_checked_; base::RepeatingCallback<bool(v8::Local<v8::Value>, int)> is_checked_;
base::Callback<bool(v8::Local<v8::Value>, int)> is_enabled_; base::RepeatingCallback<bool(v8::Local<v8::Value>, int)> is_enabled_;
base::Callback<bool(v8::Local<v8::Value>, int)> is_visible_; base::RepeatingCallback<bool(v8::Local<v8::Value>, int)> is_visible_;
base::Callback<bool(v8::Local<v8::Value>, int)> works_when_hidden_; base::RepeatingCallback<bool(v8::Local<v8::Value>, int)> works_when_hidden_;
base::Callback<v8::Local<v8::Value>(v8::Local<v8::Value>, int, bool)> base::RepeatingCallback<v8::Local<v8::Value>(v8::Local<v8::Value>, int, bool)>
get_accelerator_; get_accelerator_;
base::Callback<bool(v8::Local<v8::Value>, int)> should_register_accelerator_; base::RepeatingCallback<bool(v8::Local<v8::Value>, int)>
base::Callback<void(v8::Local<v8::Value>, v8::Local<v8::Value>, int)> should_register_accelerator_;
base::RepeatingCallback<void(v8::Local<v8::Value>, v8::Local<v8::Value>, int)>
execute_command_; execute_command_;
base::Callback<void(v8::Local<v8::Value>)> menu_will_show_; base::RepeatingCallback<void(v8::Local<v8::Value>)> menu_will_show_;


DISALLOW_COPY_AND_ASSIGN(Menu); DISALLOW_COPY_AND_ASSIGN(Menu);
}; };
Expand Down
7 changes: 4 additions & 3 deletions atom/browser/api/atom_api_protocol.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ void RegisterSchemesAsPrivileged(v8::Local<v8::Value> val,


class Protocol : public mate::TrackableObject<Protocol> { class Protocol : public mate::TrackableObject<Protocol> {
public: public:
using Handler = using Handler = base::RepeatingCallback<void(const base::DictionaryValue&,
base::Callback<void(const base::DictionaryValue&, v8::Local<v8::Value>)>; v8::Local<v8::Value>)>;
using CompletionCallback = base::Callback<void(v8::Local<v8::Value>)>; using CompletionCallback =
base::RepeatingCallback<void(v8::Local<v8::Value>)>;


static mate::Handle<Protocol> Create(v8::Isolate* isolate, static mate::Handle<Protocol> Create(v8::Isolate* isolate,
AtomBrowserContext* browser_context); AtomBrowserContext* browser_context);
Expand Down
3 changes: 2 additions & 1 deletion atom/browser/api/atom_api_protocol_ns.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class ProtocolNS : public mate::TrackableObject<ProtocolNS> {
~ProtocolNS() override; ~ProtocolNS() override;


// Callback types. // Callback types.
using CompletionCallback = base::Callback<void(v8::Local<v8::Value>)>; using CompletionCallback =
base::RepeatingCallback<void(v8::Local<v8::Value>)>;


// JS APIs. // JS APIs.
ProtocolError RegisterProtocol(ProtocolType type, ProtocolError RegisterProtocol(ProtocolType type,
Expand Down
3 changes: 2 additions & 1 deletion atom/browser/api/atom_api_system_preferences.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences>


#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
using NotificationCallback = using NotificationCallback =
base::Callback<void(const std::string&, const base::DictionaryValue&)>; base::RepeatingCallback<void(const std::string&,
const base::DictionaryValue&)>;


void PostNotification(const std::string& name, void PostNotification(const std::string& name,
const base::DictionaryValue& user_info, const base::DictionaryValue& user_info,
Expand Down
3 changes: 2 additions & 1 deletion atom/browser/api/atom_api_top_level_window.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ class TopLevelWindow : public mate::TrackableObject<TopLevelWindow>,
void SetIcon(mate::Handle<NativeImage> icon); void SetIcon(mate::Handle<NativeImage> icon);
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN)
typedef base::Callback<void(v8::Local<v8::Value>, v8::Local<v8::Value>)> typedef base::RepeatingCallback<void(v8::Local<v8::Value>,
v8::Local<v8::Value>)>
MessageCallback; MessageCallback;
bool HookWindowMessage(UINT message, const MessageCallback& callback); bool HookWindowMessage(UINT message, const MessageCallback& callback);
bool IsWindowMessageHooked(UINT message); bool IsWindowMessageHooked(UINT message);
Expand Down
2 changes: 1 addition & 1 deletion atom/browser/api/atom_api_web_request.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@


#include "atom/browser/atom_browser_context.h" #include "atom/browser/atom_browser_context.h"
#include "atom/browser/net/atom_network_delegate.h" #include "atom/browser/net/atom_network_delegate.h"
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/net_converter.h" #include "atom/common/native_mate_converters/net_converter.h"
#include "atom/common/native_mate_converters/once_callback.h"
#include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/native_mate_converters/value_converter.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_task_traits.h"
Expand Down
2 changes: 1 addition & 1 deletion atom/browser/api/frame_subscriber.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class FrameSubscriber : public content::WebContentsObserver,
public viz::mojom::FrameSinkVideoConsumer { public viz::mojom::FrameSinkVideoConsumer {
public: public:
using FrameCaptureCallback = using FrameCaptureCallback =
base::Callback<void(const gfx::Image&, const gfx::Rect&)>; base::RepeatingCallback<void(const gfx::Image&, const gfx::Rect&)>;


FrameSubscriber(content::WebContents* web_contents, FrameSubscriber(content::WebContents* web_contents,
const FrameCaptureCallback& callback, const FrameCaptureCallback& callback,
Expand Down
16 changes: 8 additions & 8 deletions atom/browser/atom_browser_client.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ void AtomBrowserClient::AllowCertificateError(
bool is_main_frame_request, bool is_main_frame_request,
bool strict_enforcement, bool strict_enforcement,
bool expired_previous_decision, bool expired_previous_decision,
const base::Callback<void(content::CertificateRequestResultType)>& const base::RepeatingCallback<void(content::CertificateRequestResultType)>&
callback) { callback) {
if (delegate_) { if (delegate_) {
delegate_->AllowCertificateError( delegate_->AllowCertificateError(
Expand Down Expand Up @@ -743,21 +743,21 @@ content::BrowserMainParts* AtomBrowserClient::CreateBrowserMainParts(


void AtomBrowserClient::WebNotificationAllowed( void AtomBrowserClient::WebNotificationAllowed(
int render_process_id, int render_process_id,
const base::RepeatingCallback<void(bool, bool)>& callback) { base::OnceCallback<void(bool, bool)> callback) {
content::WebContents* web_contents = content::WebContents* web_contents =
WebContentsPreferences::GetWebContentsFromProcessID(render_process_id); WebContentsPreferences::GetWebContentsFromProcessID(render_process_id);
if (!web_contents) { if (!web_contents) {
callback.Run(false, false); std::move(callback).Run(false, false);
return; return;
} }
auto* permission_helper = auto* permission_helper =
WebContentsPermissionHelper::FromWebContents(web_contents); WebContentsPermissionHelper::FromWebContents(web_contents);
if (!permission_helper) { if (!permission_helper) {
callback.Run(false, false); std::move(callback).Run(false, false);
return; return;
} }
permission_helper->RequestWebNotificationPermission( permission_helper->RequestWebNotificationPermission(
base::Bind(callback, web_contents->IsAudioMuted())); base::BindOnce(std::move(callback), web_contents->IsAudioMuted()));
} }


void AtomBrowserClient::RenderProcessHostDestroyed( void AtomBrowserClient::RenderProcessHostDestroyed(
Expand Down Expand Up @@ -809,9 +809,9 @@ void HandleExternalProtocolInUI(
return; return;


GURL escaped_url(net::EscapeExternalHandlerValue(url.spec())); GURL escaped_url(net::EscapeExternalHandlerValue(url.spec()));
auto callback = base::Bind(&OnOpenExternal, escaped_url); auto callback = base::BindOnce(&OnOpenExternal, escaped_url);
permission_helper->RequestOpenExternalPermission(callback, has_user_gesture, permission_helper->RequestOpenExternalPermission(std::move(callback),
url); has_user_gesture, url);
} }


bool AtomBrowserClient::HandleExternalProtocol( bool AtomBrowserClient::HandleExternalProtocol(
Expand Down
2 changes: 1 addition & 1 deletion atom/browser/atom_browser_client.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AtomBrowserClient : public content::ContentBrowserClient,
NotificationPresenter* GetNotificationPresenter(); NotificationPresenter* GetNotificationPresenter();


void WebNotificationAllowed(int render_process_id, void WebNotificationAllowed(int render_process_id,
const base::Callback<void(bool, bool)>& callback); base::OnceCallback<void(bool, bool)> callback);


// content::NavigatorDelegate // content::NavigatorDelegate
std::vector<std::unique_ptr<content::NavigationThrottle>> std::vector<std::unique_ptr<content::NavigationThrottle>>
Expand Down
6 changes: 3 additions & 3 deletions atom/browser/atom_javascript_dialog_manager.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog(
window, atom::MessageBoxType::kNone, buttons, default_id, cancel_id, window, atom::MessageBoxType::kNone, buttons, default_id, cancel_id,
atom::MessageBoxOptions::MESSAGE_BOX_NONE, "", atom::MessageBoxOptions::MESSAGE_BOX_NONE, "",
base::UTF16ToUTF8(message_text), "", checkbox, false, gfx::ImageSkia(), base::UTF16ToUTF8(message_text), "", checkbox, false, gfx::ImageSkia(),
base::Bind(&AtomJavaScriptDialogManager::OnMessageBoxCallback, base::BindOnce(&AtomJavaScriptDialogManager::OnMessageBoxCallback,
base::Unretained(this), base::Passed(std::move(callback)), base::Unretained(this), base::Passed(std::move(callback)),
origin)); origin));
} }


void AtomJavaScriptDialogManager::RunBeforeUnloadDialog( void AtomJavaScriptDialogManager::RunBeforeUnloadDialog(
Expand Down
19 changes: 10 additions & 9 deletions atom/browser/common_web_contents_delegate.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -523,15 +523,15 @@ void CommonWebContentsDelegate::DevToolsIndexPath(
scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob>( scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob>(
devtools_file_system_indexer_->IndexPath( devtools_file_system_indexer_->IndexPath(
file_system_path, excluded_folders, file_system_path, excluded_folders,
base::Bind( base::BindRepeating(
&CommonWebContentsDelegate::OnDevToolsIndexingWorkCalculated, &CommonWebContentsDelegate::OnDevToolsIndexingWorkCalculated,
weak_factory_.GetWeakPtr(), request_id, file_system_path), weak_factory_.GetWeakPtr(), request_id, file_system_path),
base::Bind(&CommonWebContentsDelegate::OnDevToolsIndexingWorked, base::BindRepeating(
weak_factory_.GetWeakPtr(), request_id, &CommonWebContentsDelegate::OnDevToolsIndexingWorked,
file_system_path), weak_factory_.GetWeakPtr(), request_id, file_system_path),
base::Bind(&CommonWebContentsDelegate::OnDevToolsIndexingDone, base::BindRepeating(
weak_factory_.GetWeakPtr(), request_id, &CommonWebContentsDelegate::OnDevToolsIndexingDone,
file_system_path))); weak_factory_.GetWeakPtr(), request_id, file_system_path)));
} }


void CommonWebContentsDelegate::DevToolsStopIndexing(int request_id) { void CommonWebContentsDelegate::DevToolsStopIndexing(int request_id) {
Expand All @@ -553,8 +553,9 @@ void CommonWebContentsDelegate::DevToolsSearchInPath(
} }
devtools_file_system_indexer_->SearchInPath( devtools_file_system_indexer_->SearchInPath(
file_system_path, query, file_system_path, query,
base::Bind(&CommonWebContentsDelegate::OnDevToolsSearchCompleted, base::BindRepeating(&CommonWebContentsDelegate::OnDevToolsSearchCompleted,
weak_factory_.GetWeakPtr(), request_id, file_system_path)); weak_factory_.GetWeakPtr(), request_id,
file_system_path));
} }


void CommonWebContentsDelegate::OnDevToolsIndexingWorkCalculated( void CommonWebContentsDelegate::OnDevToolsIndexingWorkCalculated(
Expand Down
19 changes: 9 additions & 10 deletions atom/browser/net/atom_network_delegate.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -70,17 +70,16 @@ void RunSimpleListener(const AtomNetworkDelegate::SimpleListener& listener,
return listener.Run(*(details.get())); return listener.Run(*(details.get()));
} }


void RunResponseListener( void RunResponseListener(const AtomNetworkDelegate::ResponseListener& listener,
const AtomNetworkDelegate::ResponseListener& listener, std::unique_ptr<base::DictionaryValue> details,
std::unique_ptr<base::DictionaryValue> details, int render_process_id,
int render_process_id, int render_frame_id,
int render_frame_id, AtomNetworkDelegate::ResponseCallback callback) {
const AtomNetworkDelegate::ResponseCallback& callback) {
int32_t id = GetWebContentsID(render_process_id, render_frame_id); int32_t id = GetWebContentsID(render_process_id, render_frame_id);
// id must be greater than zero // id must be greater than zero
if (id) if (id)
details->SetInteger("webContentsId", id); details->SetInteger("webContentsId", id);
return listener.Run(*(details.get()), callback); return listener.Run(*(details.get()), std::move(callback));
} }


// Test whether the URL of |request| matches |patterns|. // Test whether the URL of |request| matches |patterns|.
Expand Down Expand Up @@ -484,12 +483,12 @@ int AtomNetworkDelegate::HandleResponseEvent(
callbacks_[request->identifier()] = std::move(callback); callbacks_[request->identifier()] = std::move(callback);


ResponseCallback response = ResponseCallback response =
base::Bind(&AtomNetworkDelegate::OnListenerResultInUI<Out>, base::BindOnce(&AtomNetworkDelegate::OnListenerResultInUI<Out>,
base::Unretained(this), request->identifier(), out); base::Unretained(this), request->identifier(), out);
base::PostTaskWithTraits( base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::UI}, FROM_HERE, {BrowserThread::UI},
base::BindOnce(RunResponseListener, info.listener, std::move(details), base::BindOnce(RunResponseListener, info.listener, std::move(details),
render_process_id, render_frame_id, response)); render_process_id, render_frame_id, std::move(response)));
return net::ERR_IO_PENDING; return net::ERR_IO_PENDING;
} }


Expand Down
11 changes: 7 additions & 4 deletions atom/browser/net/atom_network_delegate.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ class LoginHandler;


class AtomNetworkDelegate : public net::NetworkDelegate { class AtomNetworkDelegate : public net::NetworkDelegate {
public: public:
using ResponseCallback = base::Callback<void(const base::DictionaryValue&)>; using ResponseCallback =
using SimpleListener = base::Callback<void(const base::DictionaryValue&)>; base::OnceCallback<void(const base::DictionaryValue&)>;
using ResponseListener = base::Callback<void(const base::DictionaryValue&, using SimpleListener =
const ResponseCallback&)>; base::RepeatingCallback<void(const base::DictionaryValue&)>;
using ResponseListener =
base::RepeatingCallback<void(const base::DictionaryValue&,
ResponseCallback)>;


enum SimpleEvent { enum SimpleEvent {
kOnSendHeaders, kOnSendHeaders,
Expand Down
17 changes: 9 additions & 8 deletions atom/browser/osr/osr_render_widget_host_view.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(


if (content::GpuDataManager::GetInstance()->HardwareAccelerationEnabled()) { if (content::GpuDataManager::GetInstance()->HardwareAccelerationEnabled()) {
video_consumer_.reset(new OffScreenVideoConsumer( video_consumer_.reset(new OffScreenVideoConsumer(
this, base::Bind(&OffScreenRenderWidgetHostView::OnPaint, this, base::BindRepeating(&OffScreenRenderWidgetHostView::OnPaint,
weak_ptr_factory_.GetWeakPtr()))); weak_ptr_factory_.GetWeakPtr())));
video_consumer_->SetActive(IsPainting()); video_consumer_->SetActive(IsPainting());
video_consumer_->SetFrameRate(GetFrameRate()); video_consumer_->SetFrameRate(GetFrameRate());
} }
Expand Down Expand Up @@ -503,8 +503,8 @@ void OffScreenRenderWidgetHostView::InitAsPopup(


parent_host_view_->set_popup_host_view(this); parent_host_view_->set_popup_host_view(this);
parent_callback_ = parent_callback_ =
base::Bind(&OffScreenRenderWidgetHostView::OnPopupPaint, base::BindRepeating(&OffScreenRenderWidgetHostView::OnPopupPaint,
parent_host_view_->weak_ptr_factory_.GetWeakPtr()); parent_host_view_->weak_ptr_factory_.GetWeakPtr());


popup_position_ = pos; popup_position_ = pos;


Expand Down Expand Up @@ -741,8 +741,8 @@ OffScreenRenderWidgetHostView::CreateHostDisplayClient(
ui::Compositor* compositor) { ui::Compositor* compositor) {
host_display_client_ = new OffScreenHostDisplayClient( host_display_client_ = new OffScreenHostDisplayClient(
gfx::kNullAcceleratedWidget, gfx::kNullAcceleratedWidget,
base::Bind(&OffScreenRenderWidgetHostView::OnPaint, base::BindRepeating(&OffScreenRenderWidgetHostView::OnPaint,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
host_display_client_->SetActive(IsPainting()); host_display_client_->SetActive(IsPainting());
return base::WrapUnique(host_display_client_); return base::WrapUnique(host_display_client_);
} }
Expand Down Expand Up @@ -1084,8 +1084,9 @@ void OffScreenRenderWidgetHostView::SetupFrameRate(bool force) {
} else { } else {
begin_frame_timer_.reset(new AtomBeginFrameTimer( begin_frame_timer_.reset(new AtomBeginFrameTimer(
frame_rate_threshold_us_, frame_rate_threshold_us_,
base::Bind(&OffScreenRenderWidgetHostView::OnBeginFrameTimerTick, base::BindRepeating(
weak_ptr_factory_.GetWeakPtr()))); &OffScreenRenderWidgetHostView::OnBeginFrameTimerTick,
weak_ptr_factory_.GetWeakPtr())));
} }
} }


Expand Down
25 changes: 13 additions & 12 deletions atom/browser/web_contents_permission_helper.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ void OnPointerLockResponse(content::WebContents* web_contents, bool allowed) {
web_contents->GotResponseToLockMouseRequest(allowed); web_contents->GotResponseToLockMouseRequest(allowed);
} }


void OnPermissionResponse(base::Callback<void(bool)> callback, void OnPermissionResponse(base::OnceCallback<void(bool)> callback,
blink::mojom::PermissionStatus status) { blink::mojom::PermissionStatus status) {
if (status == blink::mojom::PermissionStatus::GRANTED) if (status == blink::mojom::PermissionStatus::GRANTED)
callback.Run(true); std::move(callback).Run(true);
else else
callback.Run(false); std::move(callback).Run(false);
} }


} // namespace } // namespace
Expand All @@ -66,7 +66,7 @@ WebContentsPermissionHelper::~WebContentsPermissionHelper() {}


void WebContentsPermissionHelper::RequestPermission( void WebContentsPermissionHelper::RequestPermission(
content::PermissionType permission, content::PermissionType permission,
const base::RepeatingCallback<void(bool)>& callback, base::OnceCallback<void(bool)> callback,
bool user_gesture, bool user_gesture,
const base::DictionaryValue* details) { const base::DictionaryValue* details) {
auto* rfh = web_contents_->GetMainFrame(); auto* rfh = web_contents_->GetMainFrame();
Expand All @@ -75,7 +75,7 @@ void WebContentsPermissionHelper::RequestPermission(
auto origin = web_contents_->GetLastCommittedURL(); auto origin = web_contents_->GetLastCommittedURL();
permission_manager->RequestPermissionWithDetails( permission_manager->RequestPermissionWithDetails(
permission, rfh, origin, false, details, permission, rfh, origin, false, details,
base::BindRepeating(&OnPermissionResponse, callback)); base::BindOnce(&OnPermissionResponse, std::move(callback)));
} }


bool WebContentsPermissionHelper::CheckPermission( bool WebContentsPermissionHelper::CheckPermission(
Expand All @@ -90,10 +90,10 @@ bool WebContentsPermissionHelper::CheckPermission(
} }


void WebContentsPermissionHelper::RequestFullscreenPermission( void WebContentsPermissionHelper::RequestFullscreenPermission(
const base::Callback<void(bool)>& callback) { base::OnceCallback<void(bool)> callback) {
RequestPermission( RequestPermission(
static_cast<content::PermissionType>(PermissionType::FULLSCREEN), static_cast<content::PermissionType>(PermissionType::FULLSCREEN),
callback); std::move(callback));
} }


void WebContentsPermissionHelper::RequestMediaAccessPermission( void WebContentsPermissionHelper::RequestMediaAccessPermission(
Expand Down Expand Up @@ -121,26 +121,27 @@ void WebContentsPermissionHelper::RequestMediaAccessPermission(
} }


void WebContentsPermissionHelper::RequestWebNotificationPermission( void WebContentsPermissionHelper::RequestWebNotificationPermission(
const base::RepeatingCallback<void(bool)>& callback) { base::OnceCallback<void(bool)> callback) {
RequestPermission(content::PermissionType::NOTIFICATIONS, callback); RequestPermission(content::PermissionType::NOTIFICATIONS,
std::move(callback));
} }


void WebContentsPermissionHelper::RequestPointerLockPermission( void WebContentsPermissionHelper::RequestPointerLockPermission(
bool user_gesture) { bool user_gesture) {
RequestPermission( RequestPermission(
static_cast<content::PermissionType>(PermissionType::POINTER_LOCK), static_cast<content::PermissionType>(PermissionType::POINTER_LOCK),
base::BindRepeating(&OnPointerLockResponse, web_contents_), user_gesture); base::BindOnce(&OnPointerLockResponse, web_contents_), user_gesture);
} }


void WebContentsPermissionHelper::RequestOpenExternalPermission( void WebContentsPermissionHelper::RequestOpenExternalPermission(
const base::RepeatingCallback<void(bool)>& callback, base::OnceCallback<void(bool)> callback,
bool user_gesture, bool user_gesture,
const GURL& url) { const GURL& url) {
base::DictionaryValue details; base::DictionaryValue details;
details.SetString("externalURL", url.spec()); details.SetString("externalURL", url.spec());
RequestPermission( RequestPermission(
static_cast<content::PermissionType>(PermissionType::OPEN_EXTERNAL), static_cast<content::PermissionType>(PermissionType::OPEN_EXTERNAL),
callback, user_gesture, &details); std::move(callback), user_gesture, &details);
} }


bool WebContentsPermissionHelper::CheckMediaAccessPermission( bool WebContentsPermissionHelper::CheckMediaAccessPermission(
Expand Down
Loading

0 comments on commit 9af5072

Please sign in to comment.