Chromium Code Reviews| 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 // 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 #include "remoting/host/host_status_logger.h" | 64 #include "remoting/host/host_status_logger.h" |
| 65 #include "remoting/host/input_injector.h" | 65 #include "remoting/host/input_injector.h" |
| 66 #include "remoting/host/ipc_desktop_environment.h" | 66 #include "remoting/host/ipc_desktop_environment.h" |
| 67 #include "remoting/host/ipc_host_event_logger.h" | 67 #include "remoting/host/ipc_host_event_logger.h" |
| 68 #include "remoting/host/logging.h" | 68 #include "remoting/host/logging.h" |
| 69 #include "remoting/host/me2me_desktop_environment.h" | 69 #include "remoting/host/me2me_desktop_environment.h" |
| 70 #include "remoting/host/oauth_token_getter_impl.h" | 70 #include "remoting/host/oauth_token_getter_impl.h" |
| 71 #include "remoting/host/pairing_registry_delegate.h" | 71 #include "remoting/host/pairing_registry_delegate.h" |
| 72 #include "remoting/host/pin_hash.h" | 72 #include "remoting/host/pin_hash.h" |
| 73 #include "remoting/host/policy_watcher.h" | 73 #include "remoting/host/policy_watcher.h" |
| 74 #include "remoting/host/screen_saver_blocker.h" | |
| 74 #include "remoting/host/security_key/gnubby_auth_handler.h" | 75 #include "remoting/host/security_key/gnubby_auth_handler.h" |
| 75 #include "remoting/host/security_key/gnubby_extension.h" | 76 #include "remoting/host/security_key/gnubby_extension.h" |
| 76 #include "remoting/host/service_urls.h" | 77 #include "remoting/host/service_urls.h" |
| 77 #include "remoting/host/shutdown_watchdog.h" | 78 #include "remoting/host/shutdown_watchdog.h" |
| 78 #include "remoting/host/signaling_connector.h" | 79 #include "remoting/host/signaling_connector.h" |
| 79 #include "remoting/host/single_window_desktop_environment.h" | 80 #include "remoting/host/single_window_desktop_environment.h" |
| 80 #include "remoting/host/switches.h" | 81 #include "remoting/host/switches.h" |
| 81 #include "remoting/host/third_party_auth_config.h" | 82 #include "remoting/host/third_party_auth_config.h" |
| 82 #include "remoting/host/token_validator_factory_impl.h" | 83 #include "remoting/host/token_validator_factory_impl.h" |
| 83 #include "remoting/host/usage_stats_consent.h" | 84 #include "remoting/host/usage_stats_consent.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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<ScreenSaverBlocker> screen_saver_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 Loading... | |
| 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 screen_saver_blocker_.reset( | |
| 1478 new ScreenSaverBlocker(host_->AsWeakPtr(), context_->Copy())); | |
|
Sergey Ulanov
2016/07/08 21:31:47
Please don't use ChromotingHostContext::Copy(). Id
Hzj_jie
2016/07/10 22:04:57
Done.
| |
| 1479 | |
| 1475 // Set up reporting the host status notifications. | 1480 // Set up reporting the host status notifications. |
| 1476 #if defined(REMOTING_MULTI_PROCESS) | 1481 #if defined(REMOTING_MULTI_PROCESS) |
| 1477 host_event_logger_.reset( | 1482 host_event_logger_.reset( |
| 1478 new IpcHostEventLogger(host_->AsWeakPtr(), daemon_channel_.get())); | 1483 new IpcHostEventLogger(host_->AsWeakPtr(), daemon_channel_.get())); |
| 1479 #else // !defined(REMOTING_MULTI_PROCESS) | 1484 #else // !defined(REMOTING_MULTI_PROCESS) |
| 1480 host_event_logger_ = | 1485 host_event_logger_ = |
| 1481 HostEventLogger::Create(host_->AsWeakPtr(), kApplicationName); | 1486 HostEventLogger::Create(host_->AsWeakPtr(), kApplicationName); |
| 1482 #endif // !defined(REMOTING_MULTI_PROCESS) | 1487 #endif // !defined(REMOTING_MULTI_PROCESS) |
| 1483 | 1488 |
| 1484 host_->SetEnableCurtaining(curtain_required_); | 1489 host_->SetEnableCurtaining(curtain_required_); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1528 void HostProcess::GoOffline(const std::string& host_offline_reason) { | 1533 void HostProcess::GoOffline(const std::string& host_offline_reason) { |
| 1529 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 1534 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
| 1530 DCHECK(!host_offline_reason.empty()); | 1535 DCHECK(!host_offline_reason.empty()); |
| 1531 DCHECK((state_ == HOST_GOING_OFFLINE_TO_STOP) || | 1536 DCHECK((state_ == HOST_GOING_OFFLINE_TO_STOP) || |
| 1532 (state_ == HOST_GOING_OFFLINE_TO_RESTART)); | 1537 (state_ == HOST_GOING_OFFLINE_TO_RESTART)); |
| 1533 | 1538 |
| 1534 // Shut down everything except the HostSignalingManager. | 1539 // Shut down everything except the HostSignalingManager. |
| 1535 host_.reset(); | 1540 host_.reset(); |
| 1536 host_event_logger_.reset(); | 1541 host_event_logger_.reset(); |
| 1537 host_status_logger_.reset(); | 1542 host_status_logger_.reset(); |
| 1538 host_change_notification_listener_.reset(); | 1543 host_change_notification_listener_.reset(); |
|
Sergey Ulanov
2016/07/08 21:31:47
Reset screen_saver_blocker_ here too.
Hzj_jie
2016/07/10 22:04:57
Done.
| |
| 1539 | 1544 |
| 1540 // Before shutting down HostSignalingManager, send the |host_offline_reason| | 1545 // Before shutting down HostSignalingManager, send the |host_offline_reason| |
| 1541 // if possible (i.e. if we have the config). | 1546 // if possible (i.e. if we have the config). |
| 1542 if (!serialized_config_.empty()) { | 1547 if (!serialized_config_.empty()) { |
| 1543 if (!signal_strategy_) | 1548 if (!signal_strategy_) |
| 1544 InitializeSignaling(); | 1549 InitializeSignaling(); |
| 1545 | 1550 |
| 1546 HOST_LOG << "SendHostOfflineReason: sending " << host_offline_reason << "."; | 1551 HOST_LOG << "SendHostOfflineReason: sending " << host_offline_reason << "."; |
| 1547 if (heartbeat_sender_) { | 1552 if (heartbeat_sender_) { |
| 1548 heartbeat_sender_->SetHostOfflineReason( | 1553 heartbeat_sender_->SetHostOfflineReason( |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1655 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1660 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
| 1656 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); | 1661 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); |
| 1657 | 1662 |
| 1658 // Run the main (also UI) message loop until the host no longer needs it. | 1663 // Run the main (also UI) message loop until the host no longer needs it. |
| 1659 message_loop.Run(); | 1664 message_loop.Run(); |
| 1660 | 1665 |
| 1661 return exit_code; | 1666 return exit_code; |
| 1662 } | 1667 } |
| 1663 | 1668 |
| 1664 } // namespace remoting | 1669 } // namespace remoting |
| OLD | NEW |