Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "remoting/host/desktop_environment.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "remoting/host/capturer.h" | 9 #include "remoting/host/capturer.h" |
| 10 #include "remoting/host/chromoting_host.h" | 10 #include "remoting/host/chromoting_host.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 if (show) { | 181 if (show) { |
| 182 continue_window_->Show(host_); | 182 continue_window_->Show(host_); |
| 183 } else { | 183 } else { |
| 184 continue_window_->Hide(); | 184 continue_window_->Hide(); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 void DesktopEnvironment::StartContinueWindowTimer(bool start) { | 188 void DesktopEnvironment::StartContinueWindowTimer(bool start) { |
| 189 DCHECK(context_->IsUIThread()); | 189 DCHECK(context_->IsUIThread()); |
| 190 | 190 |
| 191 if (start && ! continue_timer_started_) { | 191 if (start && !continue_timer_started_) { |
| 192 continue_timer_target_time_ = base::Time::Now() + | 192 continue_timer_target_time_ = base::Time::Now() + |
| 193 base::TimeDelta::FromMilliseconds(kContinueWindowTimeoutMs); | 193 base::TimeDelta::FromMilliseconds(kContinueWindowTimeoutMs); |
| 194 proxy_->CallOnUIThreadDelayed( | 194 proxy_->CallOnUIThreadDelayed( |
| 195 FROM_HERE, base::Bind(&DesktopEnvironment::ContinueWindowTimerFunc, | 195 FROM_HERE, base::Bind(&DesktopEnvironment::ContinueWindowTimerFunc, |
| 196 base::Unretained(this)), | 196 base::Unretained(this)), |
| 197 kContinueWindowTimeoutMs); | 197 kContinueWindowTimeoutMs); |
| 198 } | 198 } |
| 199 | 199 |
| 200 continue_timer_started_ = start; | 200 continue_timer_started_ = start; |
| 201 } | 201 } |
| 202 | 202 |
| 203 void DesktopEnvironment::ContinueWindowTimerFunc() { | 203 void DesktopEnvironment::ContinueWindowTimerFunc() { |
| 204 DCHECK(context_->IsUIThread()); | 204 DCHECK(context_->IsUIThread()); |
| 205 | 205 |
| 206 // This function may be called prematurely if timer was stopped and | 206 // This function may be called prematurely if timer was stopped and |
| 207 // then started again. In that case we just ignore this call. | 207 // then started again. In that case we just ignore this call. |
| 208 if (continue_timer_target_time_ > base::Time::Now()) | 208 if (continue_timer_target_time_ > base::Time::Now()) |
| 209 return; | 209 return; |
| 210 | 210 |
| 211 continue_timer_started_ = false; | |
|
Jamie
2011/08/12 23:11:30
D'oh!
| |
| 211 host_->PauseSession(true); | 212 host_->PauseSession(true); |
| 212 ShowContinueWindow(true); | 213 ShowContinueWindow(true); |
| 213 } | 214 } |
| 214 | 215 |
| 215 | 216 |
| 216 } // namespace remoting | 217 } // namespace remoting |
| OLD | NEW |