| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "chrome/browser/media/media_permission.h" | 10 #include "chrome/browser/media/media_permission.h" |
| 11 #include "chrome/browser/media/media_stream_device_permissions.h" | 11 #include "chrome/browser/media/media_stream_device_permissions.h" |
| 12 #include "chrome/browser/media/media_stream_devices_controller.h" | 12 #include "chrome/browser/media/media_stream_devices_controller.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/common/features.h" | 14 #include "chrome/common/features.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "components/content_settings/core/browser/host_content_settings_map.h" | 16 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 19 #include "content/public/browser/notification_types.h" | 19 #include "content/public/browser/notification_types.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 | 21 |
| 22 #if BUILDFLAG(ANDROID_JAVA_UI) | 22 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 23 #include <vector> | 23 #include <vector> |
| 24 | 24 |
| 25 #include "base/bind.h" | 25 #include "base/bind.h" |
| 26 #include "base/bind_helpers.h" | 26 #include "base/bind_helpers.h" |
| 27 #include "chrome/browser/media/media_stream_infobar_delegate_android.h" | 27 #include "chrome/browser/media/media_stream_infobar_delegate_android.h" |
| 28 #include "chrome/browser/permissions/permission_update_infobar_delegate_android.
h" | 28 #include "chrome/browser/permissions/permission_update_infobar_delegate_android.
h" |
| 29 #else | 29 #else |
| 30 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 30 #include "chrome/browser/permissions/permission_request_manager.h" |
| 31 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 31 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| 32 | 32 |
| 33 #if BUILDFLAG(ANDROID_JAVA_UI) | 33 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 34 namespace { | 34 namespace { |
| 35 // Callback for the permission update infobar when the site and Chrome | 35 // Callback for the permission update infobar when the site and Chrome |
| 36 // permissions are mismatched on Android. | 36 // permissions are mismatched on Android. |
| 37 void OnPermissionConflictResolved( | 37 void OnPermissionConflictResolved( |
| 38 std::unique_ptr<MediaStreamDevicesController> controller, | 38 std::unique_ptr<MediaStreamDevicesController> controller, |
| 39 bool allowed) { | 39 bool allowed) { |
| 40 if (allowed) | 40 if (allowed) |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 &OnPermissionConflictResolved, base::Passed(&controller))); | 166 &OnPermissionConflictResolved, base::Passed(&controller))); |
| 167 } | 167 } |
| 168 #endif | 168 #endif |
| 169 return; | 169 return; |
| 170 } | 170 } |
| 171 | 171 |
| 172 #if BUILDFLAG(ANDROID_JAVA_UI) | 172 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 173 MediaStreamInfoBarDelegateAndroid::Create(web_contents, | 173 MediaStreamInfoBarDelegateAndroid::Create(web_contents, |
| 174 std::move(controller)); | 174 std::move(controller)); |
| 175 #else | 175 #else |
| 176 PermissionBubbleManager* bubble_manager = | 176 PermissionRequestManager* permission_request_manager = |
| 177 PermissionBubbleManager::FromWebContents(web_contents); | 177 PermissionRequestManager::FromWebContents(web_contents); |
| 178 if (bubble_manager) | 178 if (permission_request_manager) |
| 179 bubble_manager->AddRequest(controller.release()); | 179 permission_request_manager->AddRequest(controller.release()); |
| 180 #endif | 180 #endif |
| 181 } | 181 } |
| 182 | 182 |
| 183 void PermissionBubbleMediaAccessHandler::UpdateMediaRequestState( | 183 void PermissionBubbleMediaAccessHandler::UpdateMediaRequestState( |
| 184 int render_process_id, | 184 int render_process_id, |
| 185 int render_frame_id, | 185 int render_frame_id, |
| 186 int page_request_id, | 186 int page_request_id, |
| 187 content::MediaStreamType stream_type, | 187 content::MediaStreamType stream_type, |
| 188 content::MediaRequestState state) { | 188 content::MediaRequestState state) { |
| 189 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 189 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 int type, | 247 int type, |
| 248 const content::NotificationSource& source, | 248 const content::NotificationSource& source, |
| 249 const content::NotificationDetails& details) { | 249 const content::NotificationDetails& details) { |
| 250 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 250 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 251 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 251 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
| 252 content::WebContents* web_contents = | 252 content::WebContents* web_contents = |
| 253 content::Source<content::WebContents>(source).ptr(); | 253 content::Source<content::WebContents>(source).ptr(); |
| 254 pending_requests_.erase(web_contents); | 254 pending_requests_.erase(web_contents); |
| 255 } | 255 } |
| 256 } | 256 } |
| OLD | NEW |