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

Side by Side Diff: Source/modules/mediastream/NavigatorMediaStream.cpp

Issue 1184743002: Implement enumerateDevices() according to spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix expected output of global interface listing test Created 5 years, 6 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 /* 1 /*
2 * Copyright (C) 2000 Harri Porten (porten@kde.org) 2 * Copyright (C) 2000 Harri Porten (porten@kde.org)
3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org) 3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org) 4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 14 matching lines...) Expand all
25 25
26 #include "bindings/core/v8/Dictionary.h" 26 #include "bindings/core/v8/Dictionary.h"
27 #include "bindings/core/v8/ExceptionState.h" 27 #include "bindings/core/v8/ExceptionState.h"
28 #include "core/dom/Document.h" 28 #include "core/dom/Document.h"
29 #include "core/dom/ExceptionCode.h" 29 #include "core/dom/ExceptionCode.h"
30 #include "core/frame/LocalFrame.h" 30 #include "core/frame/LocalFrame.h"
31 #include "core/frame/Navigator.h" 31 #include "core/frame/Navigator.h"
32 #include "core/frame/Settings.h" 32 #include "core/frame/Settings.h"
33 #include "core/frame/UseCounter.h" 33 #include "core/frame/UseCounter.h"
34 #include "core/page/Page.h" 34 #include "core/page/Page.h"
35 #include "modules/mediastream/MediaDeviceInfoCallback.h"
36 #include "modules/mediastream/MediaDevicesRequest.h" 35 #include "modules/mediastream/MediaDevicesRequest.h"
37 #include "modules/mediastream/NavigatorUserMediaErrorCallback.h" 36 #include "modules/mediastream/NavigatorUserMediaErrorCallback.h"
38 #include "modules/mediastream/NavigatorUserMediaSuccessCallback.h" 37 #include "modules/mediastream/NavigatorUserMediaSuccessCallback.h"
39 #include "modules/mediastream/UserMediaController.h" 38 #include "modules/mediastream/UserMediaController.h"
40 #include "modules/mediastream/UserMediaRequest.h" 39 #include "modules/mediastream/UserMediaRequest.h"
41 #include "platform/weborigin/SecurityOrigin.h" 40 #include "platform/weborigin/SecurityOrigin.h"
42 41
43 namespace blink { 42 namespace blink {
44 43
45 NavigatorMediaStream::NavigatorMediaStream() 44 NavigatorMediaStream::NavigatorMediaStream()
(...skipping 28 matching lines...) Expand all
74 73
75 UserMediaRequest* request = UserMediaRequest::create(navigator.frame()->docu ment(), userMedia, options, successCallback, errorCallback, exceptionState); 74 UserMediaRequest* request = UserMediaRequest::create(navigator.frame()->docu ment(), userMedia, options, successCallback, errorCallback, exceptionState);
76 if (!request) { 75 if (!request) {
77 ASSERT(exceptionState.hadException()); 76 ASSERT(exceptionState.hadException());
78 return; 77 return;
79 } 78 }
80 79
81 request->start(); 80 request->start();
82 } 81 }
83 82
84 void NavigatorMediaStream::getMediaDevices(Navigator& navigator, MediaDeviceInfo Callback* callback, ExceptionState& exceptionState)
85 {
86 UserMediaController* userMedia = UserMediaController::from(navigator.frame() );
87 if (!userMedia) {
88 exceptionState.throwDOMException(NotSupportedError, "No media device con troller available; is this a detached window?");
89 return;
90 }
91
92 MediaDevicesRequest* request = MediaDevicesRequest::create(navigator.frame() ->document(), userMedia, callback, exceptionState);
93 if (!request) {
94 if (!exceptionState.hadException())
95 exceptionState.throwDOMException(NotSupportedError, "Failed to reque st media devices.");
96 return;
97 }
98
99 request->start();
100 }
101
102 } // namespace blink 83 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698