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

Side by Side Diff: chrome/browser/media/media_stream_devices_controller.cc

Issue 304183006: Only store per-navigation permissions for http requests and not https. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/media/media_stream_devices_controller.h" 5 #include "chrome/browser/media/media_stream_devices_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 // If either or both audio and video devices were requested but not 403 // If either or both audio and video devices were requested but not
404 // specified by id, get the default devices. 404 // specified by id, get the default devices.
405 if (get_default_audio_device || get_default_video_device) { 405 if (get_default_audio_device || get_default_video_device) {
406 MediaCaptureDevicesDispatcher::GetInstance()-> 406 MediaCaptureDevicesDispatcher::GetInstance()->
407 GetDefaultDevicesForProfile(profile_, 407 GetDefaultDevicesForProfile(profile_,
408 get_default_audio_device, 408 get_default_audio_device,
409 get_default_video_device, 409 get_default_video_device,
410 &devices); 410 &devices);
411 } 411 }
412 412
413 // Tag this navigation entry with the granted permissions. 413 // For pages accessed via http (not https), tag this navigation entry
414 // This avoids repeated prompts for requests accessed via http. 414 // with the granted permissions. This avoids repeated prompts for
415 content::NavigationEntry* navigation_entry = 415 // device access.
416 web_contents_->GetController().GetVisibleEntry(); 416 if (!IsSchemeSecure()) {
417 if (navigation_entry) { 417 content::NavigationEntry* navigation_entry =
418 SetMediaPermissionsForNavigationEntry( 418 web_contents_->GetController().GetVisibleEntry();
419 navigation_entry, request_, audio_allowed, video_allowed); 419 if (navigation_entry) {
420 SetMediaPermissionsForNavigationEntry(
421 navigation_entry, request_, audio_allowed, video_allowed);
422 }
420 } 423 }
421 break; 424 break;
422 } 425 }
423 case content::MEDIA_DEVICE_ACCESS: { 426 case content::MEDIA_DEVICE_ACCESS: {
424 // Get the default devices for the request. 427 // Get the default devices for the request.
425 MediaCaptureDevicesDispatcher::GetInstance()-> 428 MediaCaptureDevicesDispatcher::GetInstance()->
426 GetDefaultDevicesForProfile(profile_, 429 GetDefaultDevicesForProfile(profile_,
427 audio_allowed, 430 audio_allowed,
428 video_allowed, 431 video_allowed,
429 &devices); 432 &devices);
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 it->second.permission == MEDIA_ALLOWED); 766 it->second.permission == MEDIA_ALLOWED);
764 } 767 }
765 768
766 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed() 769 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed()
767 const { 770 const {
768 MediaStreamTypeSettingsMap::const_iterator it = 771 MediaStreamTypeSettingsMap::const_iterator it =
769 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); 772 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE);
770 return (it != request_permissions_.end() && 773 return (it != request_permissions_.end() &&
771 it->second.permission == MEDIA_ALLOWED); 774 it->second.permission == MEDIA_ALLOWED);
772 } 775 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698