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

Side by Side Diff: remoting/host/remoting_me2me_host.cc

Issue 2080723008: [Chromoting] Use device::PowerSaveBlocker to block screen saver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve review comments Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « remoting/host/host_power_save_blocker_unittest.cc ('k') | remoting/remoting_host.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file implements a standalone host process for Me2Me. 5 // This file implements a standalone host process for Me2Me.
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "remoting/host/desktop_session_connector.h" 54 #include "remoting/host/desktop_session_connector.h"
55 #include "remoting/host/dns_blackhole_checker.h" 55 #include "remoting/host/dns_blackhole_checker.h"
56 #include "remoting/host/gcd_rest_client.h" 56 #include "remoting/host/gcd_rest_client.h"
57 #include "remoting/host/gcd_state_updater.h" 57 #include "remoting/host/gcd_state_updater.h"
58 #include "remoting/host/heartbeat_sender.h" 58 #include "remoting/host/heartbeat_sender.h"
59 #include "remoting/host/host_change_notification_listener.h" 59 #include "remoting/host/host_change_notification_listener.h"
60 #include "remoting/host/host_config.h" 60 #include "remoting/host/host_config.h"
61 #include "remoting/host/host_event_logger.h" 61 #include "remoting/host/host_event_logger.h"
62 #include "remoting/host/host_exit_codes.h" 62 #include "remoting/host/host_exit_codes.h"
63 #include "remoting/host/host_main.h" 63 #include "remoting/host/host_main.h"
64 #include "remoting/host/host_power_save_blocker.h"
64 #include "remoting/host/host_status_logger.h" 65 #include "remoting/host/host_status_logger.h"
65 #include "remoting/host/input_injector.h" 66 #include "remoting/host/input_injector.h"
66 #include "remoting/host/ipc_desktop_environment.h" 67 #include "remoting/host/ipc_desktop_environment.h"
67 #include "remoting/host/ipc_host_event_logger.h" 68 #include "remoting/host/ipc_host_event_logger.h"
68 #include "remoting/host/logging.h" 69 #include "remoting/host/logging.h"
69 #include "remoting/host/me2me_desktop_environment.h" 70 #include "remoting/host/me2me_desktop_environment.h"
70 #include "remoting/host/oauth_token_getter_impl.h" 71 #include "remoting/host/oauth_token_getter_impl.h"
71 #include "remoting/host/pairing_registry_delegate.h" 72 #include "remoting/host/pairing_registry_delegate.h"
72 #include "remoting/host/pin_hash.h" 73 #include "remoting/host/pin_hash.h"
73 #include "remoting/host/policy_watcher.h" 74 #include "remoting/host/policy_watcher.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 std::unique_ptr<HeartbeatSender> heartbeat_sender_; 395 std::unique_ptr<HeartbeatSender> heartbeat_sender_;
395 #if defined(USE_GCD) 396 #if defined(USE_GCD)
396 std::unique_ptr<GcdStateUpdater> gcd_state_updater_; 397 std::unique_ptr<GcdStateUpdater> gcd_state_updater_;
397 std::unique_ptr<PushNotificationSubscriber> gcd_subscriber_; 398 std::unique_ptr<PushNotificationSubscriber> gcd_subscriber_;
398 #endif // defined(USE_GCD) 399 #endif // defined(USE_GCD)
399 400
400 std::unique_ptr<HostChangeNotificationListener> 401 std::unique_ptr<HostChangeNotificationListener>
401 host_change_notification_listener_; 402 host_change_notification_listener_;
402 std::unique_ptr<HostStatusLogger> host_status_logger_; 403 std::unique_ptr<HostStatusLogger> host_status_logger_;
403 std::unique_ptr<HostEventLogger> host_event_logger_; 404 std::unique_ptr<HostEventLogger> host_event_logger_;
405 std::unique_ptr<HostPowerSaveBlocker> power_save_blocker_;
404 406
405 std::unique_ptr<ChromotingHost> host_; 407 std::unique_ptr<ChromotingHost> host_;
406 408
407 // Used to keep this HostProcess alive until it is shutdown. 409 // Used to keep this HostProcess alive until it is shutdown.
408 scoped_refptr<HostProcess> self_; 410 scoped_refptr<HostProcess> self_;
409 411
410 #if defined(REMOTING_MULTI_PROCESS) 412 #if defined(REMOTING_MULTI_PROCESS)
411 // Accessed on the UI thread. 413 // Accessed on the UI thread.
412 std::unique_ptr<IPC::ChannelProxy> daemon_channel_; 414 std::unique_ptr<IPC::ChannelProxy> daemon_channel_;
413 415
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); 1467 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20));
1466 #endif 1468 #endif
1467 1469
1468 host_change_notification_listener_.reset(new HostChangeNotificationListener( 1470 host_change_notification_listener_.reset(new HostChangeNotificationListener(
1469 this, host_id_, signal_strategy_.get(), directory_bot_jid_)); 1471 this, host_id_, signal_strategy_.get(), directory_bot_jid_));
1470 1472
1471 host_status_logger_.reset(new HostStatusLogger( 1473 host_status_logger_.reset(new HostStatusLogger(
1472 host_->AsWeakPtr(), ServerLogEntry::ME2ME, 1474 host_->AsWeakPtr(), ServerLogEntry::ME2ME,
1473 signal_strategy_.get(), directory_bot_jid_)); 1475 signal_strategy_.get(), directory_bot_jid_));
1474 1476
1477 power_save_blocker_.reset(new HostPowerSaveBlocker(
1478 host_->AsWeakPtr(),
1479 context_->ui_task_runner(),
1480 context_->file_task_runner()));
1481
1475 // Set up reporting the host status notifications. 1482 // Set up reporting the host status notifications.
1476 #if defined(REMOTING_MULTI_PROCESS) 1483 #if defined(REMOTING_MULTI_PROCESS)
1477 host_event_logger_.reset( 1484 host_event_logger_.reset(
1478 new IpcHostEventLogger(host_->AsWeakPtr(), daemon_channel_.get())); 1485 new IpcHostEventLogger(host_->AsWeakPtr(), daemon_channel_.get()));
1479 #else // !defined(REMOTING_MULTI_PROCESS) 1486 #else // !defined(REMOTING_MULTI_PROCESS)
1480 host_event_logger_ = 1487 host_event_logger_ =
1481 HostEventLogger::Create(host_->AsWeakPtr(), kApplicationName); 1488 HostEventLogger::Create(host_->AsWeakPtr(), kApplicationName);
1482 #endif // !defined(REMOTING_MULTI_PROCESS) 1489 #endif // !defined(REMOTING_MULTI_PROCESS)
1483 1490
1484 host_->SetEnableCurtaining(curtain_required_); 1491 host_->SetEnableCurtaining(curtain_required_);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 void HostProcess::GoOffline(const std::string& host_offline_reason) { 1535 void HostProcess::GoOffline(const std::string& host_offline_reason) {
1529 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 1536 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
1530 DCHECK(!host_offline_reason.empty()); 1537 DCHECK(!host_offline_reason.empty());
1531 DCHECK((state_ == HOST_GOING_OFFLINE_TO_STOP) || 1538 DCHECK((state_ == HOST_GOING_OFFLINE_TO_STOP) ||
1532 (state_ == HOST_GOING_OFFLINE_TO_RESTART)); 1539 (state_ == HOST_GOING_OFFLINE_TO_RESTART));
1533 1540
1534 // Shut down everything except the HostSignalingManager. 1541 // Shut down everything except the HostSignalingManager.
1535 host_.reset(); 1542 host_.reset();
1536 host_event_logger_.reset(); 1543 host_event_logger_.reset();
1537 host_status_logger_.reset(); 1544 host_status_logger_.reset();
1545 power_save_blocker_.reset();
1538 host_change_notification_listener_.reset(); 1546 host_change_notification_listener_.reset();
1539 1547
1540 // Before shutting down HostSignalingManager, send the |host_offline_reason| 1548 // Before shutting down HostSignalingManager, send the |host_offline_reason|
1541 // if possible (i.e. if we have the config). 1549 // if possible (i.e. if we have the config).
1542 if (!serialized_config_.empty()) { 1550 if (!serialized_config_.empty()) {
1543 if (!signal_strategy_) 1551 if (!signal_strategy_)
1544 InitializeSignaling(); 1552 InitializeSignaling();
1545 1553
1546 HOST_LOG << "SendHostOfflineReason: sending " << host_offline_reason << "."; 1554 HOST_LOG << "SendHostOfflineReason: sending " << host_offline_reason << ".";
1547 if (heartbeat_sender_) { 1555 if (heartbeat_sender_) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); 1663 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds));
1656 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); 1664 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog);
1657 1665
1658 // Run the main (also UI) message loop until the host no longer needs it. 1666 // Run the main (also UI) message loop until the host no longer needs it.
1659 message_loop.Run(); 1667 message_loop.Run();
1660 1668
1661 return exit_code; 1669 return exit_code;
1662 } 1670 }
1663 1671
1664 } // namespace remoting 1672 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/host_power_save_blocker_unittest.cc ('k') | remoting/remoting_host.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698