diff options
author | nkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-04 16:58:34 +0000 |
---|---|---|
committer | nkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-04 16:58:34 +0000 |
commit | cfad875c42dc022d8632dc19b9cf7647b14e9ee9 (patch) | |
tree | a90005ced7fadb1fb77ff7038e23d822fef95b4f /ash/system | |
parent | 08a21f37b4668e33a2cf760e25f37178712a6de3 (diff) | |
download | chromium_src-cfad875c42dc022d8632dc19b9cf7647b14e9ee9.zip chromium_src-cfad875c42dc022d8632dc19b9cf7647b14e9ee9.tar.gz chromium_src-cfad875c42dc022d8632dc19b9cf7647b14e9ee9.tar.bz2 |
Add SessionStateObserver with ActiveUserChanged()
Depends on https://codereview.chromium.org/15974008/ which renames SessionStateObserver to LockStateObserver
* Rename few instances of email to user_id
* Add SessionStateDelegateChromeos implementation
BUG=180903
R=bartfab@chromium.org, skuhne@chromium.org, sky@chromium.org, stevenjb@chromium.org
Review URL: https://codereview.chromium.org/15718003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203985 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system')
-rw-r--r-- | ash/system/tray/system_tray.cc | 2 | ||||
-rw-r--r-- | ash/system/tray/system_tray.h | 4 | ||||
-rw-r--r-- | ash/system/tray/system_tray_unittest.cc | 8 | ||||
-rw-r--r-- | ash/system/user/tray_user.cc | 7 | ||||
-rw-r--r-- | ash/system/user/tray_user_unittest.cc | 6 |
5 files changed, 18 insertions, 9 deletions
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index 4602271..e4caaad 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -321,7 +321,7 @@ bool SystemTray::IsMouseInNotificationBubble() const { Shell::GetScreen()->GetCursorScreenPoint()); } -bool SystemTray::CloseSystemBubbleForTest() const { +bool SystemTray::CloseSystemBubble() const { if (!system_bubble_) return false; system_bubble_->bubble()->Close(); diff --git a/ash/system/tray/system_tray.h b/ash/system/tray/system_tray.h index 48875fd..1a6b6fa 100644 --- a/ash/system/tray/system_tray.h +++ b/ash/system/tray/system_tray.h @@ -124,10 +124,12 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView, // Returns true if the mouse is inside the notification bubble. bool IsMouseInNotificationBubble() const; + // Closes system bubble and returns true if it did exist. + bool CloseSystemBubble() const; + // Accessors for testing. // Returns true if the bubble exists. - bool CloseSystemBubbleForTest() const; bool CloseNotificationBubbleForTest() const; // Overridden from TrayBackgroundView. diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc index 5af8742b..6d36329 100644 --- a/ash/system/tray/system_tray_unittest.cc +++ b/ash/system/tray/system_tray_unittest.cc @@ -142,9 +142,9 @@ TEST_F(SystemTrayTest, SystemTrayDefaultView) { tray->ShowDefaultView(BUBBLE_CREATE_NEW); // Ensure that closing the bubble destroys it. - ASSERT_TRUE(tray->CloseSystemBubbleForTest()); + ASSERT_TRUE(tray->CloseSystemBubble()); RunAllPendingInMessageLoop(); - ASSERT_FALSE(tray->CloseSystemBubbleForTest()); + ASSERT_FALSE(tray->CloseSystemBubble()); } TEST_F(SystemTrayTest, SystemTrayTestItems) { @@ -247,8 +247,8 @@ TEST_F(SystemTrayTest, SystemTrayNotifications) { ASSERT_TRUE(detailed_item->detailed_view() != NULL); ASSERT_TRUE(test_item->notification_view() != NULL); - // Hide the detailed view, ensure the notificaiton view still exists. - ASSERT_TRUE(tray->CloseSystemBubbleForTest()); + // Hide the detailed view, ensure the notification view still exists. + ASSERT_TRUE(tray->CloseSystemBubble()); RunAllPendingInMessageLoop(); ASSERT_TRUE(detailed_item->detailed_view() == NULL); ASSERT_TRUE(test_item->notification_view() != NULL); diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc index e3c0697..965a248 100644 --- a/ash/system/user/tray_user.cc +++ b/ash/system/user/tray_user.cc @@ -273,6 +273,9 @@ class UserView : public views::View, // The view of the user card. views::View* user_card_view_; + // This is the owner system tray item of this view. + SystemTrayItem* owner_; + // True if |user_card_view_| is a |UserView| - otherwise it is only a // |views::View|. bool is_user_card_; @@ -595,6 +598,7 @@ UserView::UserView(SystemTrayItem* owner, MultiProfileIndex index) : multiprofile_index_(index), user_card_view_(NULL), + owner_(owner), is_user_card_(false), logout_button_(NULL), add_user_visible_but_disabled_(false) { @@ -710,6 +714,9 @@ void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { ash::SessionStateDelegate* delegate = ash::Shell::GetInstance()->session_state_delegate(); delegate->SwitchActiveUser(delegate->GetUserEmail(multiprofile_index_)); + // Since the user list is about to change the system menu should get + // closed. + owner_->system_tray()->CloseSystemBubble(); } } else if (add_menu_option_.get() && sender == add_menu_option_->GetContentsView()) { diff --git a/ash/system/user/tray_user_unittest.cc b/ash/system/user/tray_user_unittest.cc index b2f8a43..7d7b066 100644 --- a/ash/system/user/tray_user_unittest.cc +++ b/ash/system/user/tray_user_unittest.cc @@ -140,7 +140,7 @@ TEST_F(TrayUserTest, SingleUserModeDoesNotAllowAddingUser) { ash::internal::TrayUser::HIDDEN, tray_user(i)->GetStateForTest()); - tray()->CloseSystemBubbleForTest(); + tray()->CloseSystemBubble(); } // Make sure that in multi user mode the user panel can be activated and there @@ -207,7 +207,7 @@ TEST_F(TrayUserTest, MutiUserModeDoesNotAllowToAddUser) { tray_user(0)->GetStateForTest()); // Close and check that everything is deleted. - tray()->CloseSystemBubbleForTest(); + tray()->CloseSystemBubble(); EXPECT_FALSE(tray()->IsAnyBubbleVisible()); for (int i = 0; i < delegate()->GetMaximumNumberOfLoggedInUsers(); i++) EXPECT_EQ(ash::internal::TrayUser::HIDDEN, @@ -226,7 +226,7 @@ TEST_F(TrayUserTest, MutiUserModeButtonClicks) { ClickUserItem(&generator, 1); EXPECT_EQ(delegate()->get_activated_user(), delegate()->GetUserEmail(1)); - tray()->CloseSystemBubbleForTest(); + tray()->CloseSystemBubble(); } } // namespace internal |