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

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

Issue 282693002: Add a null check for PermissionBubbleManager::FromWebcontents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 (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_capture_devices_dispatcher.h" 5 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
6 6
7 #include "apps/app_window.h" 7 #include "apps/app_window.h"
8 #include "apps/app_window_registry.h" 8 #include "apps/app_window_registry.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const content::MediaStreamDevice* FindDeviceWithId( 68 const content::MediaStreamDevice* FindDeviceWithId(
69 const content::MediaStreamDevices& devices, 69 const content::MediaStreamDevices& devices,
70 const std::string& device_id) { 70 const std::string& device_id) {
71 content::MediaStreamDevices::const_iterator iter = devices.begin(); 71 content::MediaStreamDevices::const_iterator iter = devices.begin();
72 for (; iter != devices.end(); ++iter) { 72 for (; iter != devices.end(); ++iter) {
73 if (iter->id == device_id) { 73 if (iter->id == device_id) {
74 return &(*iter); 74 return &(*iter);
75 } 75 }
76 } 76 }
77 return NULL; 77 return NULL;
78 }; 78 }
79 79
80 // This is a short-term solution to grant camera and/or microphone access to 80 // This is a short-term solution to grant camera and/or microphone access to
81 // extensions: 81 // extensions:
82 // 1. Virtual keyboard extension. 82 // 1. Virtual keyboard extension.
83 // 2. Google Voice Search Hotword extension. 83 // 2. Google Voice Search Hotword extension.
84 // 3. Flutter gesture recognition extension. 84 // 3. Flutter gesture recognition extension.
85 // 4. TODO(smus): Airbender experiment 1. 85 // 4. TODO(smus): Airbender experiment 1.
86 // 5. TODO(smus): Airbender experiment 2. 86 // 5. TODO(smus): Airbender experiment 2.
87 // Once http://crbug.com/292856 is fixed, remove this whitelist. 87 // Once http://crbug.com/292856 is fixed, remove this whitelist.
88 bool IsMediaRequestWhitelistedForExtension( 88 bool IsMediaRequestWhitelistedForExtension(
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 DCHECK(!it->second.empty()); 624 DCHECK(!it->second.empty());
625 625
626 if (PermissionBubbleManager::Enabled()) { 626 if (PermissionBubbleManager::Enabled()) {
627 scoped_ptr<MediaStreamDevicesController> controller( 627 scoped_ptr<MediaStreamDevicesController> controller(
628 new MediaStreamDevicesController(web_contents, 628 new MediaStreamDevicesController(web_contents,
629 it->second.front().request, 629 it->second.front().request,
630 base::Bind(&MediaCaptureDevicesDispatcher::OnAccessRequestResponse, 630 base::Bind(&MediaCaptureDevicesDispatcher::OnAccessRequestResponse,
631 base::Unretained(this), web_contents))); 631 base::Unretained(this), web_contents)));
632 if (controller->DismissInfoBarAndTakeActionOnSettings()) 632 if (controller->DismissInfoBarAndTakeActionOnSettings())
633 return; 633 return;
634 PermissionBubbleManager::FromWebContents(web_contents)-> 634 PermissionBubbleManager* bubble_manager =
635 AddRequest(controller.release()); 635 PermissionBubbleManager::FromWebContents(web_contents);
636 if (bubble_manager)
637 bubble_manager->AddRequest(controller.release());
636 return; 638 return;
637 } 639 }
638 640
639 // TODO(gbillock): delete this block and the MediaStreamInfoBarDelegate 641 // TODO(gbillock): delete this block and the MediaStreamInfoBarDelegate
640 // when we've transitioned to bubbles. (crbug/337458) 642 // when we've transitioned to bubbles. (crbug/337458)
641 MediaStreamInfoBarDelegate::Create( 643 MediaStreamInfoBarDelegate::Create(
642 web_contents, it->second.front().request, 644 web_contents, it->second.front().request,
643 base::Bind(&MediaCaptureDevicesDispatcher::OnAccessRequestResponse, 645 base::Bind(&MediaCaptureDevicesDispatcher::OnAccessRequestResponse,
644 base::Unretained(this), web_contents)); 646 base::Unretained(this), web_contents));
645 } 647 }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 951
950 void MediaCaptureDevicesDispatcher::SetTestAudioCaptureDevices( 952 void MediaCaptureDevicesDispatcher::SetTestAudioCaptureDevices(
951 const MediaStreamDevices& devices) { 953 const MediaStreamDevices& devices) {
952 test_audio_devices_ = devices; 954 test_audio_devices_ = devices;
953 } 955 }
954 956
955 void MediaCaptureDevicesDispatcher::SetTestVideoCaptureDevices( 957 void MediaCaptureDevicesDispatcher::SetTestVideoCaptureDevices(
956 const MediaStreamDevices& devices) { 958 const MediaStreamDevices& devices) {
957 test_video_devices_ = devices; 959 test_video_devices_ = devices;
958 } 960 }
OLDNEW
« no previous file with comments | « chrome/browser/media/chrome_midi_permission_context.cc ('k') | chrome/browser/notifications/desktop_notification_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698