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

Side by Side Diff: extensions/shell/browser/media_capture_util.cc

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 months 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 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 #include "extensions/shell/browser/media_capture_util.h" 5 #include "extensions/shell/browser/media_capture_util.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 if (request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE) { 57 if (request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE) {
58 VerifyMediaAccessPermission(request.video_type, extension); 58 VerifyMediaAccessPermission(request.video_type, extension);
59 const MediaStreamDevice* device = GetRequestedDeviceOrDefault( 59 const MediaStreamDevice* device = GetRequestedDeviceOrDefault(
60 MediaCaptureDevices::GetInstance()->GetVideoCaptureDevices(), 60 MediaCaptureDevices::GetInstance()->GetVideoCaptureDevices(),
61 request.requested_video_device_id); 61 request.requested_video_device_id);
62 if (device) 62 if (device)
63 devices.push_back(*device); 63 devices.push_back(*device);
64 } 64 }
65 65
66 // TODO(jamescook): Should we show a recording icon somewhere? If so, where? 66 // TODO(jamescook): Should we show a recording icon somewhere? If so, where?
67 scoped_ptr<MediaStreamUI> ui; 67 std::unique_ptr<MediaStreamUI> ui;
68 callback.Run(devices, devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE 68 callback.Run(devices, devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE
69 : content::MEDIA_DEVICE_OK, 69 : content::MEDIA_DEVICE_OK,
70 std::move(ui)); 70 std::move(ui));
71 } 71 }
72 72
73 void VerifyMediaAccessPermission(content::MediaStreamType type, 73 void VerifyMediaAccessPermission(content::MediaStreamType type,
74 const Extension* extension) { 74 const Extension* extension) {
75 const PermissionsData* permissions_data = extension->permissions_data(); 75 const PermissionsData* permissions_data = extension->permissions_data();
76 if (type == content::MEDIA_DEVICE_AUDIO_CAPTURE) { 76 if (type == content::MEDIA_DEVICE_AUDIO_CAPTURE) {
77 // app_shell has no UI surface to show an error, and on an embedded device 77 // app_shell has no UI surface to show an error, and on an embedded device
78 // it's better to crash than to have a feature not work. 78 // it's better to crash than to have a feature not work.
79 CHECK(permissions_data->HasAPIPermission(APIPermission::kAudioCapture)) 79 CHECK(permissions_data->HasAPIPermission(APIPermission::kAudioCapture))
80 << "Audio capture request but no audioCapture permission in manifest."; 80 << "Audio capture request but no audioCapture permission in manifest.";
81 } else { 81 } else {
82 DCHECK(type == content::MEDIA_DEVICE_VIDEO_CAPTURE); 82 DCHECK(type == content::MEDIA_DEVICE_VIDEO_CAPTURE);
83 CHECK(permissions_data->HasAPIPermission(APIPermission::kVideoCapture)) 83 CHECK(permissions_data->HasAPIPermission(APIPermission::kVideoCapture))
84 << "Video capture request but no videoCapture permission in manifest."; 84 << "Video capture request but no videoCapture permission in manifest.";
85 } 85 }
86 } 86 }
87 87
88 } // namespace media_capture_util 88 } // namespace media_capture_util
89 } // namespace extensions 89 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698