Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: android_webview/browser/aw_permission_manager.cc

Issue 2458453002: [sensors] Add Permission guard to the generic sensor apis.
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "android_webview/browser/aw_permission_manager.h" 5 #include "android_webview/browser/aw_permission_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "android_webview/browser/aw_browser_permission_request_delegate.h" 9 #include "android_webview/browser/aw_browser_permission_request_delegate.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 pending_request->requesting_origin, 304 pending_request->requesting_origin,
305 base::Bind(&OnRequestResponse, weak_ptr_factory_.GetWeakPtr(), 305 base::Bind(&OnRequestResponse, weak_ptr_factory_.GetWeakPtr(),
306 request_id, permissions[i])); 306 request_id, permissions[i]));
307 break; 307 break;
308 case PermissionType::MIDI_SYSEX: 308 case PermissionType::MIDI_SYSEX:
309 delegate->RequestMIDISysexPermission( 309 delegate->RequestMIDISysexPermission(
310 pending_request->requesting_origin, 310 pending_request->requesting_origin,
311 base::Bind(&OnRequestResponse, weak_ptr_factory_.GetWeakPtr(), 311 base::Bind(&OnRequestResponse, weak_ptr_factory_.GetWeakPtr(),
312 request_id, permissions[i])); 312 request_id, permissions[i]));
313 break; 313 break;
314 case PermissionType::SENSORS:
315 delegate->RequestSensorPermission(
316 pending_request->requesting_origin,
317 base::Bind(&OnRequestResponse, weak_ptr_factory_.GetWeakPtr(),
318 request_id, permissions[i]));
319 break;
314 case PermissionType::AUDIO_CAPTURE: 320 case PermissionType::AUDIO_CAPTURE:
315 case PermissionType::VIDEO_CAPTURE: 321 case PermissionType::VIDEO_CAPTURE:
316 case PermissionType::NOTIFICATIONS: 322 case PermissionType::NOTIFICATIONS:
317 case PermissionType::PUSH_MESSAGING: 323 case PermissionType::PUSH_MESSAGING:
318 case PermissionType::DURABLE_STORAGE: 324 case PermissionType::DURABLE_STORAGE:
319 case PermissionType::BACKGROUND_SYNC: 325 case PermissionType::BACKGROUND_SYNC:
320 case PermissionType::FLASH: 326 case PermissionType::FLASH:
321 NOTIMPLEMENTED() << "RequestPermissions is not implemented for " 327 NOTIMPLEMENTED() << "RequestPermissions is not implemented for "
322 << static_cast<int>(permissions[i]); 328 << static_cast<int>(permissions[i]);
323 pending_request->SetPermissionStatus(permissions[i], 329 pending_request->SetPermissionStatus(permissions[i],
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 break; 448 break;
443 case PermissionType::PROTECTED_MEDIA_IDENTIFIER: 449 case PermissionType::PROTECTED_MEDIA_IDENTIFIER:
444 if (delegate) 450 if (delegate)
445 delegate->CancelProtectedMediaIdentifierPermissionRequests( 451 delegate->CancelProtectedMediaIdentifierPermissionRequests(
446 requesting_origin); 452 requesting_origin);
447 break; 453 break;
448 case PermissionType::MIDI_SYSEX: 454 case PermissionType::MIDI_SYSEX:
449 if (delegate) 455 if (delegate)
450 delegate->CancelMIDISysexPermissionRequests(requesting_origin); 456 delegate->CancelMIDISysexPermissionRequests(requesting_origin);
451 break; 457 break;
458 case PermissionType::SENSORS:
459 if (delegate)
460 delegate->CancelSensorPermissionRequests(requesting_origin);
461 break;
452 case PermissionType::NOTIFICATIONS: 462 case PermissionType::NOTIFICATIONS:
453 case PermissionType::PUSH_MESSAGING: 463 case PermissionType::PUSH_MESSAGING:
454 case PermissionType::DURABLE_STORAGE: 464 case PermissionType::DURABLE_STORAGE:
455 case PermissionType::AUDIO_CAPTURE: 465 case PermissionType::AUDIO_CAPTURE:
456 case PermissionType::VIDEO_CAPTURE: 466 case PermissionType::VIDEO_CAPTURE:
457 case PermissionType::BACKGROUND_SYNC: 467 case PermissionType::BACKGROUND_SYNC:
458 case PermissionType::FLASH: 468 case PermissionType::FLASH:
459 NOTIMPLEMENTED() << "CancelPermission not implemented for " 469 NOTIMPLEMENTED() << "CancelPermission not implemented for "
460 << static_cast<int>(permission); 470 << static_cast<int>(permission);
461 break; 471 break;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 ->GetLastCommittedURL().GetOrigin(); 552 ->GetLastCommittedURL().GetOrigin();
543 } 553 }
544 554
545 AwBrowserPermissionRequestDelegate* AwPermissionManager::GetDelegate( 555 AwBrowserPermissionRequestDelegate* AwPermissionManager::GetDelegate(
546 int render_process_id, int render_frame_id) { 556 int render_process_id, int render_frame_id) {
547 return AwBrowserPermissionRequestDelegate::FromID(render_process_id, 557 return AwBrowserPermissionRequestDelegate::FromID(render_process_id,
548 render_frame_id); 558 render_frame_id);
549 } 559 }
550 560
551 } // namespace android_webview 561 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698