OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package com.android.webview.chromium; | 5 package com.android.webview.chromium; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 /** | 1245 /** |
1246 * Type adaptation class for PermissionRequest. | 1246 * Type adaptation class for PermissionRequest. |
1247 * TODO: Move to the upstream once the PermissionRequest is part of SDK. | 1247 * TODO: Move to the upstream once the PermissionRequest is part of SDK. |
1248 */ | 1248 */ |
1249 public static class PermissionRequestAdapter extends PermissionRequest { | 1249 public static class PermissionRequestAdapter extends PermissionRequest { |
1250 | 1250 |
1251 private static long toAwPermissionResources(String[] resources) { | 1251 private static long toAwPermissionResources(String[] resources) { |
1252 long result = 0; | 1252 long result = 0; |
1253 for (String resource : resources) { | 1253 for (String resource : resources) { |
1254 if (resource.equals(PermissionRequest.RESOURCE_VIDEO_CAPTURE)) { | 1254 if (resource.equals(PermissionRequest.RESOURCE_VIDEO_CAPTURE)) { |
1255 result |= Resource.VideoCapture; | 1255 result |= Resource.VIDEO_CAPTURE; |
1256 } else if (resource.equals(PermissionRequest.RESOURCE_AUDIO_CAPT
URE)) { | 1256 } else if (resource.equals(PermissionRequest.RESOURCE_AUDIO_CAPT
URE)) { |
1257 result |= Resource.AudioCapture; | 1257 result |= Resource.AUDIO_CAPTURE; |
1258 } else if (resource.equals(PermissionRequest.RESOURCE_PROTECTED_
MEDIA_ID)) { | 1258 } else if (resource.equals(PermissionRequest.RESOURCE_PROTECTED_
MEDIA_ID)) { |
1259 result |= Resource.ProtectedMediaId; | 1259 result |= Resource.PROTECTED_MEDIA_ID; |
1260 } else if (resource.equals(AwPermissionRequest.RESOURCE_MIDI_SYS
EX)) { | 1260 } else if (resource.equals(AwPermissionRequest.RESOURCE_MIDI_SYS
EX)) { |
1261 result |= Resource.MIDISysex; | 1261 result |= Resource.MIDI_SYSEX; |
1262 } | 1262 } |
1263 } | 1263 } |
1264 return result; | 1264 return result; |
1265 } | 1265 } |
1266 | 1266 |
1267 private static String[] toPermissionResources(long resources) { | 1267 private static String[] toPermissionResources(long resources) { |
1268 ArrayList<String> result = new ArrayList<String>(); | 1268 ArrayList<String> result = new ArrayList<String>(); |
1269 if ((resources & Resource.VideoCapture) != 0) { | 1269 if ((resources & Resource.VIDEO_CAPTURE) != 0) { |
1270 result.add(PermissionRequest.RESOURCE_VIDEO_CAPTURE); | 1270 result.add(PermissionRequest.RESOURCE_VIDEO_CAPTURE); |
1271 } | 1271 } |
1272 if ((resources & Resource.AudioCapture) != 0) { | 1272 if ((resources & Resource.AUDIO_CAPTURE) != 0) { |
1273 result.add(PermissionRequest.RESOURCE_AUDIO_CAPTURE); | 1273 result.add(PermissionRequest.RESOURCE_AUDIO_CAPTURE); |
1274 } | 1274 } |
1275 if ((resources & Resource.ProtectedMediaId) != 0) { | 1275 if ((resources & Resource.PROTECTED_MEDIA_ID) != 0) { |
1276 result.add(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID); | 1276 result.add(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID); |
1277 } | 1277 } |
1278 if ((resources & Resource.MIDISysex) != 0) { | 1278 if ((resources & Resource.MIDI_SYSEX) != 0) { |
1279 result.add(AwPermissionRequest.RESOURCE_MIDI_SYSEX); | 1279 result.add(AwPermissionRequest.RESOURCE_MIDI_SYSEX); |
1280 } | 1280 } |
1281 String[] resource_array = new String[result.size()]; | 1281 String[] resource_array = new String[result.size()]; |
1282 return result.toArray(resource_array); | 1282 return result.toArray(resource_array); |
1283 } | 1283 } |
1284 | 1284 |
1285 private AwPermissionRequest mAwPermissionRequest; | 1285 private AwPermissionRequest mAwPermissionRequest; |
1286 private final String[] mResources; | 1286 private final String[] mResources; |
1287 | 1287 |
1288 public PermissionRequestAdapter(AwPermissionRequest awPermissionRequest)
{ | 1288 public PermissionRequestAdapter(AwPermissionRequest awPermissionRequest)
{ |
(...skipping 21 matching lines...) Expand all Loading... |
1310 mAwPermissionRequest.deny(); | 1310 mAwPermissionRequest.deny(); |
1311 } | 1311 } |
1312 } | 1312 } |
1313 | 1313 |
1314 @Override | 1314 @Override |
1315 public void deny() { | 1315 public void deny() { |
1316 mAwPermissionRequest.deny(); | 1316 mAwPermissionRequest.deny(); |
1317 } | 1317 } |
1318 } | 1318 } |
1319 } | 1319 } |
OLD | NEW |