Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3177)

Unified Diff: chrome/browser/chromeos/dbus/console_service_provider.cc

Issue 697493002: Support transition between chrome and user mode console (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: upload again Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/dbus/console_service_provider.cc
diff --git a/chrome/browser/chromeos/dbus/console_service_provider.cc b/chrome/browser/chromeos/dbus/console_service_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2428967547e5cbcfa6d68fe69622b97ac915f69e
--- /dev/null
+++ b/chrome/browser/chromeos/dbus/console_service_provider.cc
@@ -0,0 +1,55 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/shell.h"
+#include "chrome/browser/chromeos/dbus/console_service_provider.h"
+#include "third_party/cros_system_api/dbus/service_constants.h"
+#include "ui/display/chromeos/display_configurator.h"
+
+namespace chromeos {
+
+ConsoleServiceProvider::ConsoleServiceProvider() : weak_ptr_factory_(this) {
+}
+
+ConsoleServiceProvider::~ConsoleServiceProvider() {
+}
+
+void ConsoleServiceProvider::Start(
+ scoped_refptr<dbus::ExportedObject> exported_object) {
+ exported_object->ExportMethod(
+ kLibCrosServiceInterface, kActivateConsole,
+ base::Bind(&ConsoleServiceProvider::ActivateConsole,
+ weak_ptr_factory_.GetWeakPtr()),
+ base::Bind(&ConsoleServiceProvider::OnExported,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void ConsoleServiceProvider::ActivateConsole(
+ dbus::MethodCall* method_call,
+ dbus::ExportedObject::ResponseSender response_sender) {
+ dbus::MessageReader reader(method_call);
+ bool release_display;
+ if (reader.PopBool(&release_display)) {
+ ui::DisplayConfigurator* display_configurator =
+ ash::Shell::GetInstance()->display_configurator();
+ if (release_display)
+ display_configurator->RelinquishControl();
+ 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.
+ display_configurator->SetDisplayMode(
+ 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.
+ } else {
+ LOG(ERROR) << "Unable to parse " << kActivateConsole << " request";
+ }
+
+ response_sender.Run(dbus::Response::FromMethodCall(method_call));
+}
+
+void ConsoleServiceProvider::OnExported(const std::string& interface_name,
+ const std::string& method_name,
+ bool success) {
+ if (!success)
+ LOG(ERROR) << "failed to export " << interface_name << "." << method_name;
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698