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; |
| 29 | void LoginPromptVisible() override; |
Xiaohui Chen | 13184ee | 2015-03-17 14:21:41 -0700 | [diff] [blame^] | 30 | void SessionStateChanged(const std::string &state) override {}; |
Xiaohui Chen | a8bced8 | 2015-02-27 10:35:26 -0800 | [diff] [blame] | 31 | void ScreenIsLocked() override {}; |
| 32 | void ScreenIsUnlocked() override {}; |
| 33 | |
| 34 | // Sets up the proxy for Chrome remote debugging and tries to enable it. |
| 35 | void EnableChromeRemoteDebugging(); |
| 36 | |
| 37 | private: |
| 38 | // Tries to enable Chrome remote debugging. |
| 39 | void EnableChromeRemoteDebuggingInternal(); |
| 40 | |
| 41 | // Should the proxy try to enable Chrome remote debugging. |
| 42 | bool should_enable_chrome_remote_debugging_ = false; |
| 43 | // Whether Chrome remote debugging is already successfully enabled. |
| 44 | bool is_chrome_remote_debugging_enabled_ = false; |
| 45 | |
| 46 | DISALLOW_COPY_AND_ASSIGN(SessionManagerProxy); |
| 47 | }; |
| 48 | |
| 49 | } // namespace debugd |
| 50 | |
| 51 | #endif // DEBUGD_SRC_SESSION_MANAGER_PROXY_H_ |