| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "remoting/host/desktop_environment_options.h" | 5 #include "remoting/host/desktop_environment_options.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/optional.h" | 10 #include "base/optional.h" |
| 11 #include "remoting/host/safe_mode.h" |
| 11 | 12 |
| 12 namespace remoting { | 13 namespace remoting { |
| 13 | 14 |
| 14 using DesktopCaptureOptions = webrtc::DesktopCaptureOptions; | 15 using DesktopCaptureOptions = webrtc::DesktopCaptureOptions; |
| 15 | 16 |
| 16 // static | 17 // static |
| 17 DesktopEnvironmentOptions DesktopEnvironmentOptions::CreateDefault() { | 18 DesktopEnvironmentOptions DesktopEnvironmentOptions::CreateDefault() { |
| 18 DesktopEnvironmentOptions options; | 19 DesktopEnvironmentOptions options; |
| 19 options.desktop_capture_options_ = DesktopCaptureOptions::CreateDefault(); | 20 options.desktop_capture_options_ = DesktopCaptureOptions::CreateDefault(); |
| 20 options.Initialize(); | 21 options.Initialize(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 DesktopEnvironmentOptions& | 34 DesktopEnvironmentOptions& |
| 34 DesktopEnvironmentOptions::operator=( | 35 DesktopEnvironmentOptions::operator=( |
| 35 DesktopEnvironmentOptions&& other) = default; | 36 DesktopEnvironmentOptions&& other) = default; |
| 36 DesktopEnvironmentOptions& | 37 DesktopEnvironmentOptions& |
| 37 DesktopEnvironmentOptions::operator=( | 38 DesktopEnvironmentOptions::operator=( |
| 38 const DesktopEnvironmentOptions& other) = default; | 39 const DesktopEnvironmentOptions& other) = default; |
| 39 | 40 |
| 40 void DesktopEnvironmentOptions::Initialize() { | 41 void DesktopEnvironmentOptions::Initialize() { |
| 41 desktop_capture_options_.set_detect_updated_region(true); | 42 desktop_capture_options_.set_detect_updated_region(true); |
| 42 #if defined (OS_WIN) | 43 #if defined (OS_WIN) |
| 43 desktop_capture_options_.set_allow_directx_capturer(true); | 44 if (ExecuteHostInSafeMode()) { |
| 45 desktop_capture_options_.set_allow_directx_capturer(false); |
| 46 } else { |
| 47 desktop_capture_options_.set_allow_directx_capturer(true); |
| 48 } |
| 44 #endif | 49 #endif |
| 45 } | 50 } |
| 46 | 51 |
| 47 const DesktopCaptureOptions* | 52 const DesktopCaptureOptions* |
| 48 DesktopEnvironmentOptions::desktop_capture_options() const { | 53 DesktopEnvironmentOptions::desktop_capture_options() const { |
| 49 return &desktop_capture_options_; | 54 return &desktop_capture_options_; |
| 50 } | 55 } |
| 51 | 56 |
| 52 DesktopCaptureOptions* | 57 DesktopCaptureOptions* |
| 53 DesktopEnvironmentOptions::desktop_capture_options() { | 58 DesktopEnvironmentOptions::desktop_capture_options() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 81 #endif | 86 #endif |
| 82 // This field is for test purpose. Usually it should not be set to false. | 87 // This field is for test purpose. Usually it should not be set to false. |
| 83 base::Optional<bool> detect_updated_region = | 88 base::Optional<bool> detect_updated_region = |
| 84 options.GetBool("Detect-Updated-Region"); | 89 options.GetBool("Detect-Updated-Region"); |
| 85 if (detect_updated_region) { | 90 if (detect_updated_region) { |
| 86 desktop_capture_options_.set_detect_updated_region(*detect_updated_region); | 91 desktop_capture_options_.set_detect_updated_region(*detect_updated_region); |
| 87 } | 92 } |
| 88 } | 93 } |
| 89 | 94 |
| 90 } // namespace remoting | 95 } // namespace remoting |
| OLD | NEW |