| 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 "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "chrome/browser/media/media_permission.h" | 8 #include "chrome/browser/media/media_permission.h" |
| 9 #include "chrome/browser/media/media_stream_device_permissions.h" | 9 #include "chrome/browser/media/media_stream_device_permissions.h" |
| 10 #include "chrome/browser/media/media_stream_devices_controller.h" | 10 #include "chrome/browser/media/media_stream_devices_controller.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 13 #include "components/content_settings/core/browser/host_content_settings_map.h" | 13 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/browser/notification_types.h" | 16 #include "content/public/browser/notification_types.h" |
| 17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 | 18 |
| 19 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
| 20 #include <vector> | 20 #include <vector> |
| 21 | 21 |
| 22 #include "base/bind.h" | 22 #include "base/bind.h" |
| 23 #include "base/bind_helpers.h" | 23 #include "base/bind_helpers.h" |
| 24 #include "chrome/browser/media/media_stream_infobar_delegate.h" | 24 #include "chrome/browser/media/media_stream_infobar_delegate_android.h" |
| 25 #include "chrome/browser/permissions/permission_update_infobar_delegate_android.
h" | 25 #include "chrome/browser/permissions/permission_update_infobar_delegate_android.
h" |
| 26 #else | 26 #else |
| 27 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 27 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
| 28 #endif // OS_ANDROID | 28 #endif // OS_ANDROID |
| 29 | 29 |
| 30 #if defined(OS_ANDROID) | 30 #if defined(OS_ANDROID) |
| 31 namespace { | 31 namespace { |
| 32 // Callback for the permission update infobar when the site and Chrome | 32 // Callback for the permission update infobar when the site and Chrome |
| 33 // permissions are mismatched on Android. | 33 // permissions are mismatched on Android. |
| 34 void OnPermissionConflictResolved( | 34 void OnPermissionConflictResolved( |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 PermissionUpdateInfoBarDelegate::Create( | 152 PermissionUpdateInfoBarDelegate::Create( |
| 153 web_contents, content_settings_types, | 153 web_contents, content_settings_types, |
| 154 base::Bind( | 154 base::Bind( |
| 155 &OnPermissionConflictResolved, base::Passed(&controller))); | 155 &OnPermissionConflictResolved, base::Passed(&controller))); |
| 156 } | 156 } |
| 157 #endif | 157 #endif |
| 158 return; | 158 return; |
| 159 } | 159 } |
| 160 | 160 |
| 161 #if defined(OS_ANDROID) | 161 #if defined(OS_ANDROID) |
| 162 MediaStreamInfoBarDelegate::Create(web_contents, controller.Pass()); | 162 MediaStreamInfoBarDelegateAndroid::Create(web_contents, controller.Pass()); |
| 163 #else | 163 #else |
| 164 PermissionBubbleManager* bubble_manager = | 164 PermissionBubbleManager* bubble_manager = |
| 165 PermissionBubbleManager::FromWebContents(web_contents); | 165 PermissionBubbleManager::FromWebContents(web_contents); |
| 166 if (bubble_manager) | 166 if (bubble_manager) |
| 167 bubble_manager->AddRequest(controller.release()); | 167 bubble_manager->AddRequest(controller.release()); |
| 168 #endif | 168 #endif |
| 169 } | 169 } |
| 170 | 170 |
| 171 void PermissionBubbleMediaAccessHandler::UpdateMediaRequestState( | 171 void PermissionBubbleMediaAccessHandler::UpdateMediaRequestState( |
| 172 int render_process_id, | 172 int render_process_id, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 int type, | 235 int type, |
| 236 const content::NotificationSource& source, | 236 const content::NotificationSource& source, |
| 237 const content::NotificationDetails& details) { | 237 const content::NotificationDetails& details) { |
| 238 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 238 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 239 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 239 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
| 240 content::WebContents* web_contents = | 240 content::WebContents* web_contents = |
| 241 content::Source<content::WebContents>(source).ptr(); | 241 content::Source<content::WebContents>(source).ptr(); |
| 242 pending_requests_.erase(web_contents); | 242 pending_requests_.erase(web_contents); |
| 243 } | 243 } |
| 244 } | 244 } |
| OLD | NEW |