diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-24 06:07:08 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-24 06:07:08 +0000 |
commit | 40ad82c45d5683ed162f3d1679b2205d1757cb58 (patch) | |
tree | 5beb4e66c4d16b59a74557d768f0fdb8c7cfcf8f /ash/system | |
parent | 1fa707dd8c416ef590e4fba3f4b9e3d609672af9 (diff) | |
download | chromium_src-40ad82c45d5683ed162f3d1679b2205d1757cb58.zip chromium_src-40ad82c45d5683ed162f3d1679b2205d1757cb58.tar.gz chromium_src-40ad82c45d5683ed162f3d1679b2205d1757cb58.tar.bz2 |
When screen locked (LOGGED_IN_LOCKED):
(1) the shutdown etc. buttons should not show up
(2) the date item should not be 'activatable' (i.e no hover underline, no click)
(3) the settings entry should not show up
(4) the IME 'customize' option should not show up (still possible to change IME)
{5} Cannot add bluethooth devices or enable/disable bluetooth (still possible to toggle bluetooth connection for individual devices)
(5) clicking the network entries should not do anything (can't change network being used)
(6) Cannot enable/disable wifi/cellular network
When user is signed out (LOGGED_IN_NONE):
(1) Hide IME settings
(2) Hide Bluetooth settings (can still enable and disable bluetooth)
BUG=119503
TEST=Manual
Review URL: http://codereview.chromium.org/9839074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128703 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system')
-rw-r--r-- | ash/system/bluetooth/tray_bluetooth.cc | 29 | ||||
-rw-r--r-- | ash/system/ime/tray_ime.cc | 11 | ||||
-rw-r--r-- | ash/system/network/tray_network.cc | 18 | ||||
-rw-r--r-- | ash/system/power/tray_power.cc | 2 | ||||
-rw-r--r-- | ash/system/settings/tray_settings.cc | 2 | ||||
-rw-r--r-- | ash/system/user/login_status.h | 1 | ||||
-rw-r--r-- | ash/system/user/tray_user.cc | 35 |
7 files changed, 69 insertions, 29 deletions
diff --git a/ash/system/bluetooth/tray_bluetooth.cc b/ash/system/bluetooth/tray_bluetooth.cc index 975895f..bacf673 100644 --- a/ash/system/bluetooth/tray_bluetooth.cc +++ b/ash/system/bluetooth/tray_bluetooth.cc @@ -67,8 +67,9 @@ class BluetoothDefaultView : public TrayItemMore { class BluetoothDetailedView : public views::View, public ViewClickListener { public: - BluetoothDetailedView() - : header_(NULL), + explicit BluetoothDetailedView(user::LoginStatus login) + : login_(login), + header_(NULL), add_device_(NULL), toggle_bluetooth_(NULL) { SetLayoutManager(new views::BoxLayout( @@ -126,7 +127,13 @@ class BluetoothDetailedView : public views::View, AddChildView(scroller); } + // Add settings entries. void AppendSettingsEntries() { + // If screen is locked, hide all settings entries as user should not be able + // to modify state. + if (login_ == user::LOGGED_IN_LOCKED) + return; + ash::SystemTrayDelegate* delegate = ash::Shell::GetInstance()->tray_delegate(); HoverHighlightView* container = new HoverHighlightView(this); @@ -138,11 +145,15 @@ class BluetoothDetailedView : public views::View, AddChildView(container); toggle_bluetooth_ = container; - container = new HoverHighlightView(this); - container->AddLabel(rb.GetLocalizedString( - IDS_ASH_STATUS_TRAY_BLUETOOTH_ADD_DEVICE), gfx::Font::NORMAL); - AddChildView(container); - add_device_ = container; + // Add bluetooth device requires a browser window, hide it for non logged in + // user. + if (login_ != user::LOGGED_IN_NONE) { + container = new HoverHighlightView(this); + container->AddLabel(rb.GetLocalizedString( + IDS_ASH_STATUS_TRAY_BLUETOOTH_ADD_DEVICE), gfx::Font::NORMAL); + AddChildView(container); + add_device_ = container; + } } // Overridden from ViewClickListener. @@ -165,6 +176,8 @@ class BluetoothDetailedView : public views::View, } } + user::LoginStatus login_; + std::map<views::View*, std::string> device_map_; views::View* header_; views::View* add_device_; @@ -199,7 +212,7 @@ views::View* TrayBluetooth::CreateDefaultView(user::LoginStatus status) { views::View* TrayBluetooth::CreateDetailedView(user::LoginStatus status) { if (!Shell::GetInstance()->tray_delegate()->GetBluetoothAvailable()) return NULL; - detailed_.reset(new tray::BluetoothDetailedView); + detailed_.reset(new tray::BluetoothDetailedView(status)); return detailed_.get(); } diff --git a/ash/system/ime/tray_ime.cc b/ash/system/ime/tray_ime.cc index 5feb052..be4d889 100644 --- a/ash/system/ime/tray_ime.cc +++ b/ash/system/ime/tray_ime.cc @@ -66,9 +66,9 @@ class IMEDefaultView : public TrayItemMore { class IMEDetailedView : public views::View, public ViewClickListener { public: - IMEDetailedView(SystemTrayItem* owner, user::LoginStatus status) - : header_(NULL), - status_(status) { + IMEDetailedView(SystemTrayItem* owner, user::LoginStatus login) + : login_(login), + header_(NULL) { SetLayoutManager(new views::BoxLayout( views::BoxLayout::kVertical, 1, 1, 1)); set_background(views::Background::CreateSolidBackground(kBackgroundColor)); @@ -92,7 +92,7 @@ class IMEDetailedView : public views::View, AppendIMEList(list); if (!property_list.empty()) AppendIMEProperties(property_list); - if (status_ != user::LOGGED_IN_NONE) + if (login_ != user::LOGGED_IN_NONE && login_ != user::LOGGED_IN_LOCKED) AppendSettings(); Layout(); @@ -172,11 +172,12 @@ class IMEDetailedView : public views::View, } } + user::LoginStatus login_; + std::map<views::View*, std::string> ime_map_; std::map<views::View*, std::string> property_map_; views::View* header_; views::View* settings_; - user::LoginStatus status_; DISALLOW_COPY_AND_ASSIGN(IMEDetailedView); }; diff --git a/ash/system/network/tray_network.cc b/ash/system/network/tray_network.cc index cf674de..4187994 100644 --- a/ash/system/network/tray_network.cc +++ b/ash/system/network/tray_network.cc @@ -209,9 +209,12 @@ class NetworkDetailedView : public views::View, AppendHeaderEntry(); AppendNetworkEntries(); - AppendNetworkExtra(); - AppendNetworkToggles(); - AppendSettingsEntry(); + + if (login_ != user::LOGGED_IN_LOCKED) { + AppendNetworkExtra(); + AppendNetworkToggles(); + AppendSettingsEntry(); + } Layout(); } @@ -417,9 +420,14 @@ class NetworkDetailedView : public views::View, info_bubble_->GetWidget()->Close(); info_bubble_ = NULL; } - if (sender == header_) { + + if (sender == header_) Shell::GetInstance()->tray()->ShowDefaultView(); - } else if (sender == settings_) { + + if (login_ == user::LOGGED_IN_LOCKED) + return; + + if (sender == settings_) { delegate->ShowNetworkSettings(); } else if (sender == proxy_settings_) { delegate->ChangeProxySettings(); diff --git a/ash/system/power/tray_power.cc b/ash/system/power/tray_power.cc index cae430a..22d0df62 100644 --- a/ash/system/power/tray_power.cc +++ b/ash/system/power/tray_power.cc @@ -169,7 +169,7 @@ views::View* TrayPower::CreateTrayView(user::LoginStatus status) { views::View* TrayPower::CreateDefaultView(user::LoginStatus status) { date_.reset(new tray::DateView(tray::DateView::DATE)); - if (status != user::LOGGED_IN_NONE) + if (status != user::LOGGED_IN_NONE && status != user::LOGGED_IN_LOCKED) date_->set_actionable(true); views::View* container = new views::View; diff --git a/ash/system/settings/tray_settings.cc b/ash/system/settings/tray_settings.cc index 0bafcbb..64f9d70 100644 --- a/ash/system/settings/tray_settings.cc +++ b/ash/system/settings/tray_settings.cc @@ -90,7 +90,7 @@ views::View* TraySettings::CreateTrayView(user::LoginStatus status) { } views::View* TraySettings::CreateDefaultView(user::LoginStatus status) { - if (status == user::LOGGED_IN_NONE) + if (status == user::LOGGED_IN_NONE || status == user::LOGGED_IN_LOCKED) return NULL; return new SettingsView; diff --git a/ash/system/user/login_status.h b/ash/system/user/login_status.h index 119e42e5..635ff20 100644 --- a/ash/system/user/login_status.h +++ b/ash/system/user/login_status.h @@ -9,6 +9,7 @@ namespace ash { namespace user { enum LoginStatus { + LOGGED_IN_LOCKED, // A user has locked the screen. LOGGED_IN_USER, // A normal user is logged in. LOGGED_IN_OWNER, // The owner of the device is logged in. LOGGED_IN_GUEST, // A guest is logged in (i.e. incognito) diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc index beb8704..b8ad72a 100644 --- a/ash/system/user/tray_user.cc +++ b/ash/system/user/tray_user.cc @@ -105,23 +105,42 @@ namespace tray { class UserView : public views::View, public views::ButtonListener { public: - explicit UserView(ash::user::LoginStatus status) - : username_(NULL), + explicit UserView(ash::user::LoginStatus login) + : login_(login), + username_(NULL), email_(NULL), update_(NULL), shutdown_(NULL), signout_(NULL), lock_(NULL) { - CHECK(status != ash::user::LOGGED_IN_NONE); + CHECK(login_ != ash::user::LOGGED_IN_NONE); SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); set_background(views::Background::CreateSolidBackground(SK_ColorWHITE)); - bool guest = status == ash::user::LOGGED_IN_GUEST; - bool kiosk = status == ash::user::LOGGED_IN_KIOSK; + bool guest = login_ == ash::user::LOGGED_IN_GUEST; + bool kiosk = login_ == ash::user::LOGGED_IN_KIOSK; + bool locked = login_ == ash::user::LOGGED_IN_LOCKED; + if (!guest && !kiosk) AddUserInfo(); + if (!guest && !kiosk && !locked) + RefreshForUpdate(); + + // A user should not be able to modify logged in state when screen is + // locked. + if (!locked) + AddButtonContainer(); + } + + virtual ~UserView() {} + + // Create container for buttons. + void AddButtonContainer() { + bool guest = login_ == ash::user::LOGGED_IN_GUEST; + bool kiosk = login_ == ash::user::LOGGED_IN_KIOSK; + views::View* button_container = new views::View; views::BoxLayout *layout = new views::BoxLayout(views::BoxLayout::kHorizontal, @@ -164,8 +183,6 @@ class UserView : public views::View, AddChildView(button_container); } - virtual ~UserView() {} - // Shows update notification if available. void RefreshForUpdate() { ash::SystemTrayDelegate* tray = ash::Shell::GetInstance()->tray_delegate(); @@ -229,8 +246,6 @@ class UserView : public views::View, user_info_->AddChildView(user); AddChildView(user_info_); - - RefreshForUpdate(); } // Overridden from views::ButtonListener. @@ -259,6 +274,8 @@ class UserView : public views::View, update_->SetBoundsRect(bounds); } + user::LoginStatus login_; + views::View* user_info_; views::Label* username_; views::Label* email_; |