Give user access to the URL that is attempting to be openExternal'ed
This commit is contained in:
parent
39ec40b901
commit
98e9311669
6 changed files with 83 additions and 11 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "atom/browser/atom_permission_manager.h"
|
||||
#include "atom/common/native_mate_converters/gurl_converter.h"
|
||||
#include "brightray/browser/media/media_stream_devices_controller.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
|
@ -55,13 +56,21 @@ void WebContentsPermissionHelper::RequestPermission(
|
|||
content::PermissionType permission,
|
||||
const base::Callback<void(bool)>& callback,
|
||||
bool user_gesture) {
|
||||
RequestPermissionWithDetails(permission, callback, user_gesture, nullptr);
|
||||
}
|
||||
|
||||
void WebContentsPermissionHelper::RequestPermissionWithDetails(
|
||||
content::PermissionType permission,
|
||||
const base::Callback<void(bool)>& callback,
|
||||
bool user_gesture,
|
||||
const base::DictionaryValue* details) {
|
||||
auto rfh = web_contents_->GetMainFrame();
|
||||
auto permission_manager = static_cast<AtomPermissionManager*>(
|
||||
web_contents_->GetBrowserContext()->GetPermissionManager());
|
||||
auto origin = web_contents_->GetLastCommittedURL();
|
||||
permission_manager->RequestPermission(
|
||||
permission, rfh, origin, false,
|
||||
base::Bind(&OnPermissionResponse, callback));
|
||||
permission_manager->RequestPermissionWithDetails(
|
||||
permission, rfh, origin, false, details,
|
||||
base::Bind(&OnPermissionResponse, callback));
|
||||
}
|
||||
|
||||
void WebContentsPermissionHelper::RequestFullscreenPermission(
|
||||
|
@ -94,10 +103,14 @@ void WebContentsPermissionHelper::RequestPointerLockPermission(
|
|||
|
||||
void WebContentsPermissionHelper::RequestOpenExternalPermission(
|
||||
const base::Callback<void(bool)>& callback,
|
||||
bool user_gesture) {
|
||||
RequestPermission(
|
||||
bool user_gesture,
|
||||
const GURL& url) {
|
||||
base::DictionaryValue details;
|
||||
details.SetString("scheme", url.scheme());
|
||||
details.SetString("url", url.spec());
|
||||
RequestPermissionWithDetails(
|
||||
static_cast<content::PermissionType>(PermissionType::OPEN_EXTERNAL),
|
||||
callback, user_gesture);
|
||||
callback, user_gesture, &details);
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue