Xiaohui Chen | a8bced8 | 2015-02-27 10:35:26 -0800 | [diff] [blame] | 1 | // Copyright 2015 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef DEBUGD_SRC_SESSION_MANAGER_PROXY_H_ |
| 6 | #define DEBUGD_SRC_SESSION_MANAGER_PROXY_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include <base/macros.h> |
| 11 | #include <chromeos/dbus/service_constants.h> |
| 12 | #include <dbus-c++/dbus.h> |
| 13 | #include <session_manager/dbus_proxies/org.chromium.SessionManagerInterface.h> |
| 14 | |
| 15 | namespace debugd { |
| 16 | |
| 17 | // Talks to Session Manager DBus interface. It also exposes |
| 18 | // convenience method to enable Chrome remote debugging and listens to Session |
| 19 | // Manager signal to ensure Chrome remote debugging is on when it is supposed |
| 20 | // to be. |
| 21 | class SessionManagerProxy : public org::chromium::SessionManagerInterface_proxy, |
| 22 | public DBus::ObjectProxy { |
| 23 | public: |
| 24 | explicit SessionManagerProxy(DBus::Connection* connection) |
| 25 | : DBus::ObjectProxy(*connection, |
| 26 | login_manager::kSessionManagerServicePath, |
| 27 | login_manager::kSessionManagerServiceName) {} |
| 28 | ~SessionManagerProxy() override = default; |
Jorge Lucangeli Obes | 9d5a1c5 | 2015-03-20 15:43:21 +0000 | [diff] [blame] | 29 | void LoginPromptVisible() override; |
Alex Deymo | 9f890c4 | 2015-07-30 13:30:35 -0700 | [diff] [blame] | 30 | |
| 31 | // Ignored signals. |
| 32 | void SessionStateChanged(const std::string& /* state */) override {} |
| 33 | void SetOwnerKeyComplete(const std::string& /* success */) override {} |
| 34 | void PropertyChangeComplete(const std::string& /* success */) override {} |
| 35 | void ScreenIsLocked() override {} |
| 36 | void ScreenIsUnlocked() override {} |
Xiaohui Chen | a8bced8 | 2015-02-27 10:35:26 -0800 | [diff] [blame] | 37 | |
| 38 | // Sets up the proxy for Chrome remote debugging and tries to enable it. |
| 39 | void EnableChromeRemoteDebugging(); |
| 40 | |
| 41 | private: |
| 42 | // Tries to enable Chrome remote debugging. |
| 43 | void EnableChromeRemoteDebuggingInternal(); |
| 44 | |
| 45 | // Should the proxy try to enable Chrome remote debugging. |
| 46 | bool should_enable_chrome_remote_debugging_ = false; |
| 47 | // Whether Chrome remote debugging is already successfully enabled. |
| 48 | bool is_chrome_remote_debugging_enabled_ = false; |
Xiaohui Chen | a8bced8 | 2015-02-27 10:35:26 -0800 | [diff] [blame] | 49 | |
| 50 | DISALLOW_COPY_AND_ASSIGN(SessionManagerProxy); |
| 51 | }; |
| 52 | |
| 53 | } // namespace debugd |
| 54 | |
| 55 | #endif // DEBUGD_SRC_SESSION_MANAGER_PROXY_H_ |