Browse Source

Better field names for details object

Cheng Zhao 7 years ago
parent
commit
4fd8b04329

+ 3 - 4
atom/browser/web_contents_permission_helper.cc

@@ -69,8 +69,8 @@ void WebContentsPermissionHelper::RequestPermissionWithDetails(
       web_contents_->GetBrowserContext()->GetPermissionManager());
   auto origin = web_contents_->GetLastCommittedURL();
   permission_manager->RequestPermissionWithDetails(
-    permission, rfh, origin, false, details,
-    base::Bind(&OnPermissionResponse, callback));
+      permission, rfh, origin, false, details,
+      base::Bind(&OnPermissionResponse, callback));
 }
 
 void WebContentsPermissionHelper::RequestFullscreenPermission(
@@ -106,8 +106,7 @@ void WebContentsPermissionHelper::RequestOpenExternalPermission(
     bool user_gesture,
     const GURL& url) {
   base::DictionaryValue details;
-  details.SetString("scheme", url.scheme());
-  details.SetString("url", url.spec());
+  details.SetString("externalURL", url.spec());
   RequestPermissionWithDetails(
       static_cast<content::PermissionType>(PermissionType::OPEN_EXTERNAL),
       callback, user_gesture, &details);

+ 4 - 4
atom/browser/web_contents_permission_helper.h

@@ -45,10 +45,10 @@ class WebContentsPermissionHelper
       const base::Callback<void(bool)>& callback,
       bool user_gesture = false);
   void RequestPermissionWithDetails(
-    content::PermissionType permission,
-    const base::Callback<void(bool)>& callback,
-    bool user_gesture,
-    const base::DictionaryValue* details);
+      content::PermissionType permission,
+      const base::Callback<void(bool)>& callback,
+      bool user_gesture,
+      const base::DictionaryValue* details);
 
   content::WebContents* web_contents_;
 

+ 1 - 2
docs/api/session.md

@@ -294,8 +294,7 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
   * `callback` Function
     * `permissionGranted` Boolean - Allow or deny the permission.
   * `details` Object - Some properties are only available on certain permission types.
-    * `url` String - The url of the `openExternal` request.
-    * `scheme` String - The protocol scheme of the `openExternal` request.
+    * `externalURL` String - The url of the `openExternal` request.
 
 Sets the handler which can be used to respond to permission requests for the `session`.
 Calling `callback(true)` will allow the permission and `callback(false)` will reject it.