@Override public void onPermissionRequestCanceled(AwPermissionRequest permissionRequest) { TraceEvent.begin(); if (mWebChromeClient != null && mOngoingPermissionRequests != null) { if (TRACE) Log.d(TAG, "onPermissionRequestCanceled"); WeakReference<PermissionRequestAdapter> weakRef = mOngoingPermissionRequests.get(permissionRequest); // We don't hold strong reference to PermissionRequestAdpater and don't expect the // user only holds weak reference to it either, if so, user has no way to call // grant()/deny(), and no need to be notified the cancellation of request. if (weakRef != null) { PermissionRequestAdapter adapter = weakRef.get(); if (adapter != null) mWebChromeClient.onPermissionRequestCanceled(adapter); } } TraceEvent.end(); }