Chromium Code Reviews| 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 #include "ash/shell.h" | |
| 6 #include "chrome/browser/chromeos/dbus/console_service_provider.h" | |
| 7 #include "third_party/cros_system_api/dbus/service_constants.h" | |
| 8 #include "ui/display/chromeos/display_configurator.h" | |
| 9 | |
| 10 namespace chromeos { | |
| 11 | |
| 12 ConsoleServiceProvider::ConsoleServiceProvider() : weak_ptr_factory_(this) { | |
| 13 } | |
| 14 | |
| 15 ConsoleServiceProvider::~ConsoleServiceProvider() { | |
| 16 } | |
| 17 | |
| 18 void ConsoleServiceProvider::Start( | |
| 19 scoped_refptr<dbus::ExportedObject> exported_object) { | |
| 20 exported_object->ExportMethod( | |
| 21 kLibCrosServiceInterface, kActivateConsole, | |
| 22 base::Bind(&ConsoleServiceProvider::ActivateConsole, | |
| 23 weak_ptr_factory_.GetWeakPtr()), | |
| 24 base::Bind(&ConsoleServiceProvider::OnExported, | |
| 25 weak_ptr_factory_.GetWeakPtr())); | |
| 26 } | |
| 27 | |
| 28 void ConsoleServiceProvider::ActivateConsole( | |
| 29 dbus::MethodCall* method_call, | |
| 30 dbus::ExportedObject::ResponseSender response_sender) { | |
| 31 dbus::MessageReader reader(method_call); | |
| 32 bool release_display; | |
| 33 if (reader.PopBool(&release_display)) { | |
| 34 ui::DisplayConfigurator* display_configurator = | |
| 35 ash::Shell::GetInstance()->display_configurator(); | |
| 36 if (release_display) | |
| 37 display_configurator->RelinquishControl(); | |
| 38 else | |
|
Daniel Erat
2014/11/02 13:48:34
nit: you need curly brackets for the if/else now t
dsodman
2014/11/04 05:19:40
Done.
| |
| 39 display_configurator->SetDisplayMode( | |
| 40 display_configurator->display_state()); | |
|
Daniel Erat
2014/11/02 13:48:34
asking it to set the display to the already-curren
dsodman
2014/11/04 05:19:40
Done.
| |
| 41 } else { | |
| 42 LOG(ERROR) << "Unable to parse " << kActivateConsole << " request"; | |
| 43 } | |
| 44 | |
| 45 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | |
| 46 } | |
| 47 | |
| 48 void ConsoleServiceProvider::OnExported(const std::string& interface_name, | |
| 49 const std::string& method_name, | |
| 50 bool success) { | |
| 51 if (!success) | |
| 52 LOG(ERROR) << "failed to export " << interface_name << "." << method_name; | |
| 53 } | |
| 54 | |
| 55 } // namespace chromeos | |
| OLD | NEW |