OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium 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 CHROME_BROWSER_CHROMEOS_DBUS_CONSOLE_SERVICE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_CONSOLE_SERVICE_PROVIDER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" |
| 12 #include "dbus/exported_object.h" |
| 13 |
| 14 namespace chromeos { |
| 15 |
| 16 // This class provides an API for external apps to notify |
| 17 // chrome that it should release control of the display server. |
| 18 // The main client is the console application. This can |
| 19 // also be used by crouton to take over the display. |
| 20 class ConsoleServiceProvider |
| 21 : public CrosDBusService::ServiceProviderInterface { |
| 22 public: |
| 23 ConsoleServiceProvider(); |
| 24 ~ConsoleServiceProvider() override; |
| 25 |
| 26 // CrosDBusService::ServiceProviderInterface overrides: |
| 27 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; |
| 28 |
| 29 private: |
| 30 // This method will get called when a external process no longer needs |
| 31 // control of the display and Chrome can take ownership. |
| 32 void TakeDisplayOwnership( |
| 33 dbus::MethodCall* method_call, |
| 34 dbus::ExportedObject::ResponseSender response_sender); |
| 35 |
| 36 // This method will get called when a external process needs control of |
| 37 // the display and needs Chrome to release ownership. |
| 38 void ReleaseDisplayOwnership( |
| 39 dbus::MethodCall* method_call, |
| 40 dbus::ExportedObject::ResponseSender response_sender); |
| 41 |
| 42 // This method is called when a dbus method is exported. If the export of the |
| 43 // method is successful, |success| will be true. It will be false |
| 44 // otherwise. |
| 45 void OnExported(const std::string& interface_name, |
| 46 const std::string& method_name, |
| 47 bool success); |
| 48 |
| 49 base::WeakPtrFactory<ConsoleServiceProvider> weak_ptr_factory_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(ConsoleServiceProvider); |
| 52 }; |
| 53 |
| 54 } // namespace chromeos |
| 55 |
| 56 #endif // CHROME_BROWSER_CHROMEOS_DBUS_CONSOLE_SERVICE_PROVIDER_H_ |
OLD | NEW |