diff options
author | harrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-13 02:32:10 +0000 |
---|---|---|
committer | harrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-13 02:32:10 +0000 |
commit | 265fd7bdd37aa225e2e02396b5effc106a35fb7f (patch) | |
tree | e934e2d27a889718c7955d1869f1c7167de4db08 /ash | |
parent | 6344972668c412de8d25e4ae9100995e104788b4 (diff) | |
download | chromium_src-265fd7bdd37aa225e2e02396b5effc106a35fb7f.zip chromium_src-265fd7bdd37aa225e2e02396b5effc106a35fb7f.tar.gz chromium_src-265fd7bdd37aa225e2e02396b5effc106a35fb7f.tar.bz2 |
Ash Shelf:Disable alignment for guest/managed mode
Disables the shelf alignment menu (if enabled) for guest, and managed user (supervised user) modes.
Change Shelf alignment flag from Disabled/Enabled to Default/Enabled/Disabled with (for now) default == disabled, re-used old enabled string so old settings should be maintained with previously disabled users now set to default.
BUG=242361
Review URL: https://chromiumcodereview.appspot.com/22722003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217169 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash_switches.cc | 13 | ||||
-rw-r--r-- | ash/ash_switches.h | 6 | ||||
-rw-r--r-- | ash/shelf/shelf_widget.cc | 27 | ||||
-rw-r--r-- | ash/shelf/shelf_widget.h | 5 |
4 files changed, 49 insertions, 2 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index b47ba50..c328b59 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -159,6 +159,10 @@ const char kAshTouchHud[] = "ash-touch-hud"; // crbug's [244983, 244990, 244994, 245005, 245012] const char kAshUseAlternateShelfLayout[] = "ash-use-alternate-shelf"; +// Flags explicitly show or hide the shelf alignment menu. +const char kShowShelfAlignmentMenu[] = "show-launcher-alignment-menu"; +const char kHideShelfAlignmentMenu[] = "hide-launcher-alignment-menu"; + // Uses the 1st display in --ash-host-window-bounds as internal display. // This is for debugging on linux desktop. const char kAshUseFirstDisplayAsInternal[] = @@ -187,7 +191,12 @@ const char kForcedMaximizeMode[] = "forced-maximize-mode"; bool UseAlternateShelfLayout() { return CommandLine::ForCurrentProcess()-> - HasSwitch(ash::switches::kAshUseAlternateShelfLayout); + HasSwitch(ash::switches::kAshUseAlternateShelfLayout); +} + +bool ShowShelfAlignmentMenu() { + return CommandLine::ForCurrentProcess()-> + HasSwitch(switches::kShowShelfAlignmentMenu); } #if defined(OS_CHROMEOS) @@ -198,7 +207,7 @@ bool ShowAudioDeviceMenu() { bool UseUsbChargerNotification() { return !CommandLine::ForCurrentProcess()-> - HasSwitch(ash::switches::kAshDisableUsbChargerNotification); + HasSwitch(ash::switches::kAshDisableUsbChargerNotification); } #endif diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 7e5d471..df615b8 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -68,9 +68,15 @@ ASH_EXPORT extern const char kForceAshToDesktop[]; #endif ASH_EXPORT extern const char kForcedMaximizeMode[]; +ASH_EXPORT extern const char kShowShelfAlignmentMenu[]; +ASH_EXPORT extern const char kHideShelfAlignmentMenu[]; + // Returns true if the alternate shelf layout should be used. ASH_EXPORT bool UseAlternateShelfLayout(); +// Returns true if side shelf alignment is enabled. +ASH_EXPORT bool ShowShelfAlignmentMenu(); + #if defined(OS_CHROMEOS) // Returns true if new audio handler should be used. ASH_EXPORT bool UseNewAudioHandler(); diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc index d16f876..1c9e6b2 100644 --- a/ash/shelf/shelf_widget.cc +++ b/ash/shelf/shelf_widget.cc @@ -4,6 +4,7 @@ #include "ash/shelf/shelf_widget.h" +#include "ash/ash_switches.h" #include "ash/focus_cycler.h" #include "ash/launcher/launcher_delegate.h" #include "ash/launcher/launcher_model.h" @@ -15,6 +16,7 @@ #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" +#include "ash/system/tray/test_system_tray_delegate.h" #include "ash/wm/property_util.h" #include "ash/wm/status_area_layout_manager.h" #include "ash/wm/window_properties.h" @@ -528,6 +530,31 @@ ShelfBackgroundType ShelfWidget::GetBackgroundType() const { return SHELF_BACKGROUND_DEFAULT; } +// static +bool ShelfWidget::ShelfAlignmentAllowed() { + if (!ash::switches::ShowShelfAlignmentMenu()) + return false; + user::LoginStatus login_status = + Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus(); + + switch (login_status) { + case user::LOGGED_IN_USER: + case user::LOGGED_IN_OWNER: + return true; + case user::LOGGED_IN_LOCKED: + case user::LOGGED_IN_PUBLIC: + case user::LOGGED_IN_LOCALLY_MANAGED: + case user::LOGGED_IN_GUEST: + case user::LOGGED_IN_RETAIL_MODE: + case user::LOGGED_IN_KIOSK_APP: + case user::LOGGED_IN_NONE: + return false; + } + + DCHECK(false); + return false; +} + ShelfAlignment ShelfWidget::GetAlignment() const { return shelf_layout_manager_->GetAlignment(); } diff --git a/ash/shelf/shelf_widget.h b/ash/shelf/shelf_widget.h index 392264a..2192611 100644 --- a/ash/shelf/shelf_widget.h +++ b/ash/shelf/shelf_widget.h @@ -34,6 +34,11 @@ class ASH_EXPORT ShelfWidget : public views::Widget, internal::WorkspaceController* workspace_controller); virtual ~ShelfWidget(); + // Returns if shelf alignment option is enabled, and the user is able + // to adjust the alignment (guest and supervised mode users cannot for + // example). + static bool ShelfAlignmentAllowed(); + void SetAlignment(ShelfAlignment alignmnet); ShelfAlignment GetAlignment() const; |