| 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/webrtc/desktop_capture_access_handler.h" | 5 #include "chrome/browser/media/webrtc/desktop_capture_access_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // probably a new one. | 268 // probably a new one. |
| 269 content::MediaStreamRequestResult result = | 269 content::MediaStreamRequestResult result = |
| 270 content::MEDIA_DEVICE_INVALID_STATE; | 270 content::MEDIA_DEVICE_INVALID_STATE; |
| 271 | 271 |
| 272 // Approve request only when the following conditions are met: | 272 // Approve request only when the following conditions are met: |
| 273 // 1. Screen capturing is enabled via command line switch or white-listed for | 273 // 1. Screen capturing is enabled via command line switch or white-listed for |
| 274 // the given origin. | 274 // the given origin. |
| 275 // 2. Request comes from a page with a secure origin or from an extension. | 275 // 2. Request comes from a page with a secure origin or from an extension. |
| 276 if (screen_capture_enabled && origin_is_secure) { | 276 if (screen_capture_enabled && origin_is_secure) { |
| 277 // Get title of the calling application prior to showing the message box. | 277 // Get title of the calling application prior to showing the message box. |
| 278 // chrome::ShowQuestionMessageBox() starts a nested message loop which may | 278 // chrome::ShowQuestionMessageBox() starts a nested run loop which may |
| 279 // allow |web_contents| to be destroyed on the UI thread before the messag | 279 // allow |web_contents| to be destroyed on the UI thread before the messag |
| 280 // box is closed. See http://crbug.com/326690. | 280 // box is closed. See http://crbug.com/326690. |
| 281 base::string16 application_title = | 281 base::string16 application_title = |
| 282 GetApplicationTitle(web_contents, extension); | 282 GetApplicationTitle(web_contents, extension); |
| 283 #if !defined(OS_ANDROID) | 283 #if !defined(OS_ANDROID) |
| 284 gfx::NativeWindow parent_window = | 284 gfx::NativeWindow parent_window = |
| 285 FindParentWindowForWebContents(web_contents); | 285 FindParentWindowForWebContents(web_contents); |
| 286 #else | 286 #else |
| 287 gfx::NativeWindow parent_window = NULL; | 287 gfx::NativeWindow parent_window = NULL; |
| 288 #endif | 288 #endif |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 const bool display_notification = ShouldDisplayNotification(extension); | 449 const bool display_notification = ShouldDisplayNotification(extension); |
| 450 | 450 |
| 451 ui = GetDevicesForDesktopCapture(&devices, media_id, capture_audio, | 451 ui = GetDevicesForDesktopCapture(&devices, media_id, capture_audio, |
| 452 request.disable_local_echo, | 452 request.disable_local_echo, |
| 453 display_notification, | 453 display_notification, |
| 454 GetApplicationTitle(web_contents, extension), | 454 GetApplicationTitle(web_contents, extension), |
| 455 base::UTF8ToUTF16(original_extension_name)); | 455 base::UTF8ToUTF16(original_extension_name)); |
| 456 UpdateExtensionTrusted(request, extension); | 456 UpdateExtensionTrusted(request, extension); |
| 457 callback.Run(devices, content::MEDIA_DEVICE_OK, std::move(ui)); | 457 callback.Run(devices, content::MEDIA_DEVICE_OK, std::move(ui)); |
| 458 } | 458 } |
| OLD | NEW |