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

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

Issue 879423003: Move Location to DOMWindow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 NavigatorMediaStream::~NavigatorMediaStream() 49 NavigatorMediaStream::~NavigatorMediaStream()
50 { 50 {
51 } 51 }
52 52
53 void NavigatorMediaStream::webkitGetUserMedia(Navigator& navigator, const Dictio nary& options, NavigatorUserMediaSuccessCallback* successCallback, NavigatorUser MediaErrorCallback* errorCallback, ExceptionState& exceptionState) 53 void NavigatorMediaStream::webkitGetUserMedia(Navigator& navigator, const Dictio nary& options, NavigatorUserMediaSuccessCallback* successCallback, NavigatorUser MediaErrorCallback* errorCallback, ExceptionState& exceptionState)
54 { 54 {
55 if (!successCallback) 55 if (!successCallback)
56 return; 56 return;
57 57
58 UserMediaController* userMedia = UserMediaController::from(navigator.frame() ); 58 UserMediaController* userMedia = UserMediaController::from(navigator.localFr ame());
59 if (!userMedia) { 59 if (!userMedia) {
60 exceptionState.throwDOMException(NotSupportedError, "No user media contr oller available; is this a detached window?"); 60 exceptionState.throwDOMException(NotSupportedError, "No user media contr oller available; is this a detached window?");
61 return; 61 return;
62 } 62 }
63 63
64 String errorMessage; 64 String errorMessage;
65 if (navigator.frame()->document()->securityOrigin()->canAccessFeatureRequiri ngSecureOrigin(errorMessage)) { 65 if (navigator.localFrame()->document()->securityOrigin()->canAccessFeatureRe quiringSecureOrigin(errorMessage)) {
66 UseCounter::count(navigator.frame(), UseCounter::GetUserMediaSecureOrigi n); 66 UseCounter::count(navigator.localFrame(), UseCounter::GetUserMediaSecure Origin);
67 } else { 67 } else {
68 UseCounter::count(navigator.frame(), UseCounter::GetUserMediaInsecureOri gin); 68 UseCounter::count(navigator.localFrame(), UseCounter::GetUserMediaInsecu reOrigin);
69 if (navigator.frame()->settings()->strictPowerfulFeatureRestrictions()) { 69 if (navigator.frame()->settings()->strictPowerfulFeatureRestrictions()) {
70 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute ("webkitGetUserMedia", "Navigator", errorMessage)); 70 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute ("webkitGetUserMedia", "Navigator", errorMessage));
71 return; 71 return;
72 } 72 }
73 } 73 }
74 74
75 UserMediaRequest* request = UserMediaRequest::create(navigator.frame()->docu ment(), userMedia, options, successCallback, errorCallback, exceptionState); 75 UserMediaRequest* request = UserMediaRequest::create(navigator.localFrame()- >document(), userMedia, options, successCallback, errorCallback, exceptionState) ;
76 if (!request) { 76 if (!request) {
77 ASSERT(exceptionState.hadException()); 77 ASSERT(exceptionState.hadException());
78 return; 78 return;
79 } 79 }
80 80
81 request->start(); 81 request->start();
82 } 82 }
83 83
84 void NavigatorMediaStream::getMediaDevices(Navigator& navigator, MediaDeviceInfo Callback* callback, ExceptionState& exceptionState) 84 void NavigatorMediaStream::getMediaDevices(Navigator& navigator, MediaDeviceInfo Callback* callback, ExceptionState& exceptionState)
85 { 85 {
86 UserMediaController* userMedia = UserMediaController::from(navigator.frame() ); 86 UserMediaController* userMedia = UserMediaController::from(navigator.localFr ame());
87 if (!userMedia) { 87 if (!userMedia) {
88 exceptionState.throwDOMException(NotSupportedError, "No media device con troller available; is this a detached window?"); 88 exceptionState.throwDOMException(NotSupportedError, "No media device con troller available; is this a detached window?");
89 return; 89 return;
90 } 90 }
91 91
92 MediaDevicesRequest* request = MediaDevicesRequest::create(navigator.frame() ->document(), userMedia, callback, exceptionState); 92 MediaDevicesRequest* request = MediaDevicesRequest::create(navigator.localFr ame()->document(), userMedia, callback, exceptionState);
93 if (!request) { 93 if (!request) {
94 if (!exceptionState.hadException()) 94 if (!exceptionState.hadException())
95 exceptionState.throwDOMException(NotSupportedError, "Failed to reque st media devices."); 95 exceptionState.throwDOMException(NotSupportedError, "Failed to reque st media devices.");
96 return; 96 return;
97 } 97 }
98 98
99 request->start(); 99 request->start();
100 } 100 }
101 101
102 } // namespace blink 102 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698