| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/permission_bubble_media_access_handler.h" | 5 #include "chrome/browser/media/permission_bubble_media_access_handler.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 8 #include "chrome/browser/media/media_permission.h" | 10 #include "chrome/browser/media/media_permission.h" |
| 9 #include "chrome/browser/media/media_stream_device_permissions.h" | 11 #include "chrome/browser/media/media_stream_device_permissions.h" |
| 10 #include "chrome/browser/media/media_stream_devices_controller.h" | 12 #include "chrome/browser/media/media_stream_devices_controller.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/common/features.h" | 14 #include "chrome/common/features.h" |
| 13 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 14 #include "components/content_settings/core/browser/host_content_settings_map.h" | 16 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 15 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // Post a task to process next queued request. It has to be done | 231 // Post a task to process next queued request. It has to be done |
| 230 // asynchronously to make sure that calling infobar is not destroyed until | 232 // asynchronously to make sure that calling infobar is not destroyed until |
| 231 // after this function returns. | 233 // after this function returns. |
| 232 BrowserThread::PostTask( | 234 BrowserThread::PostTask( |
| 233 BrowserThread::UI, FROM_HERE, | 235 BrowserThread::UI, FROM_HERE, |
| 234 base::Bind( | 236 base::Bind( |
| 235 &PermissionBubbleMediaAccessHandler::ProcessQueuedAccessRequest, | 237 &PermissionBubbleMediaAccessHandler::ProcessQueuedAccessRequest, |
| 236 base::Unretained(this), web_contents)); | 238 base::Unretained(this), web_contents)); |
| 237 } | 239 } |
| 238 | 240 |
| 239 callback.Run(devices, result, ui.Pass()); | 241 callback.Run(devices, result, std::move(ui)); |
| 240 } | 242 } |
| 241 | 243 |
| 242 void PermissionBubbleMediaAccessHandler::Observe( | 244 void PermissionBubbleMediaAccessHandler::Observe( |
| 243 int type, | 245 int type, |
| 244 const content::NotificationSource& source, | 246 const content::NotificationSource& source, |
| 245 const content::NotificationDetails& details) { | 247 const content::NotificationDetails& details) { |
| 246 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 248 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 247 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 249 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
| 248 content::WebContents* web_contents = | 250 content::WebContents* web_contents = |
| 249 content::Source<content::WebContents>(source).ptr(); | 251 content::Source<content::WebContents>(source).ptr(); |
| 250 pending_requests_.erase(web_contents); | 252 pending_requests_.erase(web_contents); |
| 251 } | 253 } |
| 252 } | 254 } |
| OLD | NEW |