OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_session_proxy.h" | 5 #include "remoting/host/desktop_session_proxy.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 27 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
28 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 28 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
29 #include "third_party/webrtc/modules/desktop_capture/shared_memory.h" | 29 #include "third_party/webrtc/modules/desktop_capture/shared_memory.h" |
30 | 30 |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 #include "base/win/scoped_handle.h" | 32 #include "base/win/scoped_handle.h" |
33 #endif // defined(OS_WIN) | 33 #endif // defined(OS_WIN) |
34 | 34 |
35 const bool kReadOnly = true; | 35 const bool kReadOnly = true; |
36 const char kSendInitialResolution[] = "sendInitialResolution"; | 36 const char kSendInitialResolution[] = "sendInitialResolution"; |
| 37 const char kRateLimitResizeRequests[] = "rateLimitResizeRequests"; |
37 | 38 |
38 namespace remoting { | 39 namespace remoting { |
39 | 40 |
40 class DesktopSessionProxy::IpcSharedBufferCore | 41 class DesktopSessionProxy::IpcSharedBufferCore |
41 : public base::RefCountedThreadSafe<IpcSharedBufferCore> { | 42 : public base::RefCountedThreadSafe<IpcSharedBufferCore> { |
42 public: | 43 public: |
43 IpcSharedBufferCore(int id, | 44 IpcSharedBufferCore(int id, |
44 base::SharedMemoryHandle handle, | 45 base::SharedMemoryHandle handle, |
45 base::ProcessHandle process, | 46 base::ProcessHandle process, |
46 size_t size) | 47 size_t size) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 return scoped_ptr<ScreenControls>(new IpcScreenControls(this)); | 138 return scoped_ptr<ScreenControls>(new IpcScreenControls(this)); |
138 } | 139 } |
139 | 140 |
140 scoped_ptr<webrtc::ScreenCapturer> DesktopSessionProxy::CreateVideoCapturer() { | 141 scoped_ptr<webrtc::ScreenCapturer> DesktopSessionProxy::CreateVideoCapturer() { |
141 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 142 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
142 | 143 |
143 return scoped_ptr<webrtc::ScreenCapturer>(new IpcVideoFrameCapturer(this)); | 144 return scoped_ptr<webrtc::ScreenCapturer>(new IpcVideoFrameCapturer(this)); |
144 } | 145 } |
145 | 146 |
146 std::string DesktopSessionProxy::GetCapabilities() const { | 147 std::string DesktopSessionProxy::GetCapabilities() const { |
147 // Ask the client to send it's resolution unconditionally. | 148 std::string result = kRateLimitResizeRequests; |
148 return virtual_terminal_ ? kSendInitialResolution : std::string(); | 149 // Ask the client to send its resolution unconditionally. |
| 150 if (virtual_terminal_) |
| 151 result = result + " " + kSendInitialResolution; |
| 152 return result; |
149 } | 153 } |
150 | 154 |
151 void DesktopSessionProxy::SetCapabilities(const std::string& capabilities) { | 155 void DesktopSessionProxy::SetCapabilities(const std::string& capabilities) { |
152 // Delay creation of the desktop session until the client screen resolution is | 156 // Delay creation of the desktop session until the client screen resolution is |
153 // received if the desktop session requires the initial screen resolution | 157 // received if the desktop session requires the initial screen resolution |
154 // (when |virtual_terminal_| is true) and the client is expected to | 158 // (when |virtual_terminal_| is true) and the client is expected to |
155 // sent its screen resolution (the 'sendInitialResolution' capability is | 159 // sent its screen resolution (the 'sendInitialResolution' capability is |
156 // supported). | 160 // supported). |
157 if (virtual_terminal_ && | 161 if (virtual_terminal_ && |
158 HasCapability(capabilities, kSendInitialResolution)) { | 162 HasCapability(capabilities, kSendInitialResolution)) { |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 } | 543 } |
540 | 544 |
541 // static | 545 // static |
542 void DesktopSessionProxyTraits::Destruct( | 546 void DesktopSessionProxyTraits::Destruct( |
543 const DesktopSessionProxy* desktop_session_proxy) { | 547 const DesktopSessionProxy* desktop_session_proxy) { |
544 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 548 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, |
545 desktop_session_proxy); | 549 desktop_session_proxy); |
546 } | 550 } |
547 | 551 |
548 } // namespace remoting | 552 } // namespace remoting |
OLD | NEW |