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

Unified Diff: content/renderer/media/media_stream_impl.cc

Issue 10534004: Implement CancelUserMediaRequest for the browser part (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_impl.cc
diff --git a/content/renderer/media/media_stream_impl.cc b/content/renderer/media/media_stream_impl.cc
index 4c6751de82527e116e3fe84dae0cbfc1430f4d11..102de2003bf6b7ff91382925e15af885f7691ab7 100644
--- a/content/renderer/media/media_stream_impl.cc
+++ b/content/renderer/media/media_stream_impl.cc
@@ -25,8 +25,10 @@
#include "content/renderer/p2p/ipc_socket_factory.h"
#include "jingle/glue/thread_wrapper.h"
#include "media/base/message_loop_factory.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaStreamRegistry.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationType.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h"
@@ -354,6 +356,18 @@ void MediaStreamImpl::OnDeviceOpenFailed(int request_id) {
}
void MediaStreamImpl::FrameWillClose(WebKit::WebFrame* frame) {
+ if (frame->provisionalDataSource()->navigationType() ==
+ WebKit::WebNavigationTypeReload) {
wjia(left Chromium) 2012/06/06 06:18:21 Should this be done for all navigation types?
+ MediaRequestMap::iterator it = user_media_requests_.begin();
+ while (it != user_media_requests_.end()) {
+ if (it->second.frame_ == frame) {
+ cancelUserMediaRequest(it->second.request_);
+ it = user_media_requests_.begin();
+ } else {
+ ++it;
+ }
+ }
+ }
LocalNativeStreamMap::iterator it = local_media_streams_.begin();
while (it != local_media_streams_.end()) {
if (it->second == frame) {

Powered by Google App Engine
This is Rietveld 408576698