summaryrefslogtreecommitdiffstats
path: root/mash/example
diff options
context:
space:
mode:
authorben <ben@chromium.org>2016-03-14 19:30:52 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-15 02:32:59 +0000
commit8093571a59d57932c594e8294af93086c1106ef1 (patch)
tree23ad92944ea307897ba9b43e96b18e1bb41550e4 /mash/example
parent8e4dc68fcf8ab6f808e2b819e334098fcfd2f59f (diff)
downloadchromium_src-8093571a59d57932c594e8294af93086c1106ef1.zip
chromium_src-8093571a59d57932c594e8294af93086c1106ef1.tar.gz
chromium_src-8093571a59d57932c594e8294af93086c1106ef1.tar.bz2
Provide some buttons in WindowTypeLauncher that allow the user to logout/bring up the user switch screen
R=sky@chromium.org Review URL: https://codereview.chromium.org/1802803003 Cr-Commit-Position: refs/heads/master@{#381157}
Diffstat (limited to 'mash/example')
-rw-r--r--mash/example/window_type_launcher/BUILD.gn1
-rw-r--r--mash/example/window_type_launcher/window_type_launcher.cc31
2 files changed, 24 insertions, 8 deletions
diff --git a/mash/example/window_type_launcher/BUILD.gn b/mash/example/window_type_launcher/BUILD.gn
index 7018487..5b0b2f4 100644
--- a/mash/example/window_type_launcher/BUILD.gn
+++ b/mash/example/window_type_launcher/BUILD.gn
@@ -24,6 +24,7 @@ executable("window_type_launcher") {
"//base:base_static",
"//build/config/sanitizers:deps",
"//components/mus/public/interfaces",
+ "//mash/init/public/interfaces",
"//mash/shell/public/interfaces",
"//mojo/common:common_base",
"//mojo/converters/geometry",
diff --git a/mash/example/window_type_launcher/window_type_launcher.cc b/mash/example/window_type_launcher/window_type_launcher.cc
index 106dfc1..8286b22 100644
--- a/mash/example/window_type_launcher/window_type_launcher.cc
+++ b/mash/example/window_type_launcher/window_type_launcher.cc
@@ -6,6 +6,7 @@
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
+#include "mash/init/public/interfaces/login.mojom.h"
#include "mash/shell/public/interfaces/shell.mojom.h"
#include "mojo/converters/geometry/geometry_type_converters.h"
#include "mojo/shell/public/cpp/connection.h"
@@ -176,6 +177,10 @@ class WindowTypeLauncherView : public views::WidgetDelegateView,
this, base::ASCIIToUTF16("Create Pointy Bubble"))),
lock_button_(new views::LabelButton(
this, base::ASCIIToUTF16("Lock Screen"))),
+ logout_button_(new views::LabelButton(
+ this, base::ASCIIToUTF16("Log Out"))),
+ switch_user_button_(new views::LabelButton(
+ this, base::ASCIIToUTF16("Switch User"))),
widgets_button_(new views::LabelButton(
this, base::ASCIIToUTF16("Show Example Widgets"))),
system_modal_button_(new views::LabelButton(
@@ -197,6 +202,8 @@ class WindowTypeLauncherView : public views::WidgetDelegateView,
create_nonresizable_button_->SetStyle(views::Button::STYLE_BUTTON);
bubble_button_->SetStyle(views::Button::STYLE_BUTTON);
lock_button_->SetStyle(views::Button::STYLE_BUTTON);
+ logout_button_->SetStyle(views::Button::STYLE_BUTTON);
+ switch_user_button_->SetStyle(views::Button::STYLE_BUTTON);
widgets_button_->SetStyle(views::Button::STYLE_BUTTON);
system_modal_button_->SetStyle(views::Button::STYLE_BUTTON);
window_modal_button_->SetStyle(views::Button::STYLE_BUTTON);
@@ -221,6 +228,8 @@ class WindowTypeLauncherView : public views::WidgetDelegateView,
AddViewToLayout(layout, create_nonresizable_button_);
AddViewToLayout(layout, bubble_button_);
AddViewToLayout(layout, lock_button_);
+ AddViewToLayout(layout, logout_button_);
+ AddViewToLayout(layout, switch_user_button_);
AddViewToLayout(layout, widgets_button_);
AddViewToLayout(layout, system_modal_button_);
AddViewToLayout(layout, window_modal_button_);
@@ -265,19 +274,23 @@ class WindowTypeLauncherView : public views::WidgetDelegateView,
NOTIMPLEMENTED();
} else if (sender == panel_button_) {
NOTIMPLEMENTED();
- }
- else if (sender == create_nonresizable_button_) {
+ } else if (sender == create_nonresizable_button_) {
NOTIMPLEMENTED();
- }
- else if (sender == bubble_button_) {
+ } else if (sender == bubble_button_) {
NOTIMPLEMENTED();
- }
- else if (sender == lock_button_) {
+ } else if (sender == lock_button_) {
mash::shell::mojom::ShellPtr shell;
connector_->ConnectToInterface("mojo:mash_shell", &shell);
shell->LockScreen();
- }
- else if (sender == widgets_button_) {
+ } else if (sender == logout_button_) {
+ mash::init::mojom::LoginPtr login;
+ connector_->ConnectToInterface("mojo:mash_init", &login);
+ login->Logout();
+ } else if (sender == switch_user_button_) {
+ mash::init::mojom::LoginPtr login;
+ connector_->ConnectToInterface("mojo:mash_init", &login);
+ login->SwitchUser();
+ } else if (sender == widgets_button_) {
NOTIMPLEMENTED();
}
else if (sender == system_modal_button_) {
@@ -337,6 +350,8 @@ class WindowTypeLauncherView : public views::WidgetDelegateView,
views::LabelButton* create_nonresizable_button_;
views::LabelButton* bubble_button_;
views::LabelButton* lock_button_;
+ views::LabelButton* logout_button_;
+ views::LabelButton* switch_user_button_;
views::LabelButton* widgets_button_;
views::LabelButton* system_modal_button_;
views::LabelButton* window_modal_button_;