Closed Bug 1322586 Opened 8 years ago Closed 7 years ago

[geckoview] Add PermissionsDelegate

Categories

(GeckoView :: General, defect)

defect
Not set
normal

Tracking

(firefox56 fixed)

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: snorp, Assigned: jchen)

References

Details

Attachments

(5 files)

This will allow consumers of GeckoView to respond to web permissions requests. Needs more thorough thought as to how that interacts with Android permissions, but in generaly the App would requests those simultaneously or beforehand.
Assignee: nobody → nchen
Status: NEW → ASSIGNED
Component: Embedding: APIs → GeckoView
Product: Core → Firefox for Android
Version: unspecified → Trunk
Comment on attachment 8887628 [details]
Bug 1322586 - 1. Add "always listen" option for GeckoViewHandler;

https://reviewboard.mozilla.org/r/158512/#review164140

::: mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoViewHandler.java:55
(Diff revision 1)
> +        if (mListener == listener) {
> +            return;
> +        }
>  
> -        if (mListener != null && mListener != listener) {
> +        if (!mAlwaysListen && mListener != null) {
>              final GeckoBundle msg = new GeckoBundle(1);

Although we only use it here, it might be nicer to move out unregister into its own method for symmetry.
Attachment #8887628 - Flags: review?(esawin) → review+
Comment on attachment 8887629 [details]
Bug 1322586 - 2. Support content event forwarding in Messaging.jsm;

https://reviewboard.mozilla.org/r/158514/#review164148

This is very useful, we'll be applying this pattern a lot. Thanks!

We might want to move this out into its own bug.
Attachment #8887629 - Flags: review?(esawin) → review+
Comment on attachment 8887630 [details]
Bug 1322586 - 3. Add GeckoViewPermission.js for handling permissions;

https://reviewboard.mozilla.org/r/158516/#review164170

There is some more complexity here compared to other GeckoView components, function comments would help with understanding.
We should also think about adding specific tests for this.
Attachment #8887630 - Flags: review?(esawin) → review+
Comment on attachment 8887631 [details]
Bug 1322586 - 4. Add and implement PermissionDelegate support;

https://reviewboard.mozilla.org/r/158518/#review164176

::: mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoView.java:194
(Diff revision 1)
>          };
>  
> +    private final GeckoViewHandler<PermissionDelegate> mPermissionHandler =
> +        new GeckoViewHandler<PermissionDelegate>(
> +            "GeckoViewPermission", this,
> +            new String[] { "GeckoView:AndroidPermission",

Put this on a new line for consistency.
Attachment #8887631 - Flags: review?(esawin) → review+
Attachment #8887630 - Flags: review?(snorp)
Comment on attachment 8887630 [details]
Bug 1322586 - 3. Add GeckoViewPermission.js for handling permissions;

https://reviewboard.mozilla.org/r/158516/#review164196

::: mobile/android/components/geckoview/GeckoViewPermission.js:153
(Diff revision 1)
> +      denyRequest();
> +    });
> +  },
> +
> +  handlePeerConnectionRequest: function(aRequest) {
> +    Services.obs.notifyObservers(null, "PeerConnection:response:deny", aRequest.callID);

In Fennec we always allow here. Why do we deny in this instance?
Attachment #8887630 - Flags: review?(snorp)
Comment on attachment 8887630 [details]
Bug 1322586 - 3. Add GeckoViewPermission.js for handling permissions;

https://reviewboard.mozilla.org/r/158516/#review164198

Also, do we really need JS for this? It seems like we could handle these observer events in native code pretty easily.
I think the handlers themselves are easier to write in JS, especially when doing EventDispatcher/async stuff.

(In reply to James Willcox (:snorp) (jwillcox@mozilla.com) from comment #10)
> Comment on attachment 8887630 [details]
> Bug 1322586 - 3. Add GeckoViewPermission.js for handling permissions;
> 
> https://reviewboard.mozilla.org/r/158516/#review164196
> 
> > +  handlePeerConnectionRequest: function(aRequest) {
> > +    Services.obs.notifyObservers(null, "PeerConnection:response:deny", aRequest.callID);
> 
> In Fennec we always allow here. Why do we deny in this instance?

Nice catch. Should be allow.
Comment on attachment 8887632 [details]
Bug 1322586 - 5. Implement PermissionDelegate for geckoview_example;

https://reviewboard.mozilla.org/r/158520/#review164682

Looks good to me.

::: mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/BasicGeckoViewPrompt.java:174
(Diff revision 1)
>      private LinearLayout addStandardLayout(final AlertDialog.Builder builder,
>                                             final String title, final String msg,
>                                             final AlertCallback callback) {
>          final ScrollView scrollView = new ScrollView(builder.getContext());
>          final LinearLayout container = new LinearLayout(builder.getContext());
>          final int padding = getViewPadding(builder);

Nit: Rename to horizontalPadding for consistency.
Attachment #8887632 - Flags: review?(droeh) → review+
Pushed by nchen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/446be06fd42e
1. Add "always listen" option for GeckoViewHandler; r=esawin
https://hg.mozilla.org/integration/autoland/rev/1ca88db9fe80
2. Support content event forwarding in Messaging.jsm; r=esawin
https://hg.mozilla.org/integration/autoland/rev/f93c592a2810
3. Add GeckoViewPermission.js for handling permissions; r=esawin
https://hg.mozilla.org/integration/autoland/rev/44b8d2f6c838
4. Add and implement PermissionDelegate support; r=esawin
https://hg.mozilla.org/integration/autoland/rev/942cdcab7f79
5. Implement PermissionDelegate for geckoview_example; r=droeh
Depends on: 1386696
Product: Firefox for Android → GeckoView
Target Milestone: Firefox 56 → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: