Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Unified Diff: remoting/host/it2me_host_user_interface.cc

Issue 13461029: The continue window is owned by the desktop environment now. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/host/it2me_host_user_interface.cc
diff --git a/remoting/host/it2me_host_user_interface.cc b/remoting/host/it2me_host_user_interface.cc
deleted file mode 100644
index 1cc4b5a8a9c3ef6283ebb8aeda5830d444afd7da..0000000000000000000000000000000000000000
--- a/remoting/host/it2me_host_user_interface.cc
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "remoting/host/it2me_host_user_interface.h"
-
-#include "base/bind.h"
-#include "remoting/host/chromoting_host.h"
-#include "remoting/host/continue_window.h"
-#include "remoting/host/local_input_monitor.h"
-
-namespace {
-
-// Milliseconds before the continue window is shown.
-static const int kContinueWindowShowTimeoutMs = 10 * 60 * 1000;
-
-// Milliseconds before the continue window is automatically dismissed and
-// the connection is closed.
-static const int kContinueWindowHideTimeoutMs = 60 * 1000;
-
-} // namespace
-
-namespace remoting {
-
-It2MeHostUserInterface::It2MeHostUserInterface(
- scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
- const UiStrings& ui_strings)
- : HostUserInterface(network_task_runner, ui_task_runner, ui_strings),
- ALLOW_THIS_IN_INITIALIZER_LIST(timer_weak_factory_(this)) {
- DCHECK(ui_task_runner->BelongsToCurrentThread());
-}
-
-It2MeHostUserInterface::~It2MeHostUserInterface() {
- DCHECK(ui_task_runner()->BelongsToCurrentThread());
-
- ShowContinueWindow(false);
-}
-
-void It2MeHostUserInterface::Init() {
- DCHECK(ui_task_runner()->BelongsToCurrentThread());
-
- HostUserInterface::Init();
- continue_window_ = ContinueWindow::Create(&ui_strings());
-}
-
-void It2MeHostUserInterface::ProcessOnClientAuthenticated(
- const std::string& username) {
- DCHECK(ui_task_runner()->BelongsToCurrentThread());
-
- HostUserInterface::ProcessOnClientAuthenticated(username);
- StartContinueWindowTimer(true);
-}
-
-void It2MeHostUserInterface::ProcessOnClientDisconnected() {
- DCHECK(ui_task_runner()->BelongsToCurrentThread());
-
- HostUserInterface::ProcessOnClientDisconnected();
- ShowContinueWindow(false);
- StartContinueWindowTimer(false);
-}
-
-void It2MeHostUserInterface::ContinueSession(bool continue_session) {
- DCHECK(ui_task_runner()->BelongsToCurrentThread());
-
- if (continue_session) {
- get_host()->PauseSession(false);
- StartContinueWindowTimer(true);
- } else {
- DisconnectSession();
- }
-}
-
-void It2MeHostUserInterface::OnContinueWindowTimer() {
- DCHECK(ui_task_runner()->BelongsToCurrentThread());
-
- get_host()->PauseSession(true);
- ShowContinueWindow(true);
-
- // Cancel any pending timer and post one to hide the continue window.
- timer_weak_factory_.InvalidateWeakPtrs();
- ui_task_runner()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&It2MeHostUserInterface::OnShutdownHostTimer,
- timer_weak_factory_.GetWeakPtr()),
- base::TimeDelta::FromMilliseconds(kContinueWindowHideTimeoutMs));
-}
-
-void It2MeHostUserInterface::OnShutdownHostTimer() {
- DCHECK(ui_task_runner()->BelongsToCurrentThread());
-
- ShowContinueWindow(false);
- DisconnectSession();
-}
-
-void It2MeHostUserInterface::ShowContinueWindow(bool show) {
- DCHECK(ui_task_runner()->BelongsToCurrentThread());
-
- if (show) {
- continue_window_->Show(base::Bind(
- &It2MeHostUserInterface::ContinueSession, base::Unretained(this)));
- } else {
- continue_window_->Hide();
- }
-}
-
-void It2MeHostUserInterface::StartContinueWindowTimer(bool start) {
- DCHECK(ui_task_runner()->BelongsToCurrentThread());
-
- // Abandon previous timer events by invalidating their weak pointer to us.
- timer_weak_factory_.InvalidateWeakPtrs();
- if (start) {
- ui_task_runner()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&It2MeHostUserInterface::OnContinueWindowTimer,
- timer_weak_factory_.GetWeakPtr()),
- base::TimeDelta::FromMilliseconds(kContinueWindowShowTimeoutMs));
- }
-}
-
-} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698