summaryrefslogtreecommitdiffstats
path: root/ash/system/user
diff options
context:
space:
mode:
authorskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-03 07:51:57 +0000
committerskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-03 07:51:57 +0000
commit53092f18b6f4dba58dc7587bd888d8032e88df2e (patch)
tree924f301f7cfffcbc8538a234bb704b89f740d7a8 /ash/system/user
parent65af1a74e2a057fbbd62678f49703165f091edce (diff)
downloadchromium_src-53092f18b6f4dba58dc7587bd888d8032e88df2e.zip
chromium_src-53092f18b6f4dba58dc7587bd888d8032e88df2e.tar.gz
chromium_src-53092f18b6f4dba58dc7587bd888d8032e88df2e.tar.bz2
Removal of drag window to user tray icon functionality
BUG=348133 TEST=let it run and compiled - removal of code Review URL: https://codereview.chromium.org/184113005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system/user')
-rw-r--r--ash/system/user/tray_user.cc102
-rw-r--r--ash/system/user/tray_user.h12
-rw-r--r--ash/system/user/tray_user_unittest.cc70
3 files changed, 10 insertions, 174 deletions
diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc
index 26f8204..25a4b98 100644
--- a/ash/system/user/tray_user.cc
+++ b/ash/system/user/tray_user.cc
@@ -77,8 +77,6 @@ const int kUserIconSize = 27;
const int kUserIconLargeSize = 32;
const int kUserIconLargeCornerRadius = 2;
const int kUserLabelToIconPadding = 5;
-// When using multi login, this spacing is added between user icons.
-const int kTrayLabelSpacing = 1;
// When a hover border is used, it is starting this many pixels before the icon
// position.
@@ -176,24 +174,6 @@ class RoundedImageView : public views::View {
DISALLOW_COPY_AND_ASSIGN(RoundedImageView);
};
-// An inactive user view which can be clicked to make active. Note that this
-// "button" does not show as a button any click or hover changes.
-class UserSwitcherView : public RoundedImageView {
- public:
- UserSwitcherView(int corner_radius, MultiProfileIndex user_index);
- virtual ~UserSwitcherView() {}
-
- virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
- virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
-
- private:
- // The user index to activate when the item was clicked. Note that this
- // index refers to the LRU list of logged in users.
- MultiProfileIndex user_index_;
-
- DISALLOW_COPY_AND_ASSIGN(UserSwitcherView);
-};
-
// The user details shown in public account mode. This is essentially a label
// but with custom painting code as the text is styled with multiple colors and
// contains a link.
@@ -446,27 +426,6 @@ void RoundedImageView::OnPaint(gfx::Canvas* canvas) {
path, paint);
}
-UserSwitcherView::UserSwitcherView(int corner_radius,
- MultiProfileIndex user_index)
- : RoundedImageView(corner_radius, false),
- user_index_(user_index) {
- SetEnabled(true);
-}
-
-void UserSwitcherView::OnMouseEvent(ui::MouseEvent* event) {
- if (event->type() == ui::ET_MOUSE_PRESSED) {
- SwitchUser(user_index_);
- event->SetHandled();
- }
-}
-
-void UserSwitcherView::OnTouchEvent(ui::TouchEvent* event) {
- if (event->type() == ui::ET_TOUCH_PRESSED) {
- SwitchUser(user_index_);
- event->SetHandled();
- }
-}
-
PublicAccountUserDetails::PublicAccountUserDetails(SystemTrayItem* owner,
int used_width)
: learn_more_(NULL) {
@@ -1153,23 +1112,6 @@ TrayUser::TestState TrayUser::GetStateForTest() const {
return user_->GetStateForTest();
}
-bool TrayUser::CanDropWindowHereToTransferToUser(
- const gfx::Point& point_in_screen) {
- // Check that this item is shown in the system tray (which means it must have
- // a view there) and that the user it represents is not the current user (in
- // which case |GetTrayIndex()| would return NULL).
- if (!layout_view_ || !GetTrayIndex())
- return false;
- return layout_view_->GetBoundsInScreen().Contains(point_in_screen);
-}
-
-bool TrayUser::TransferWindowToUser(aura::Window* window) {
- SessionStateDelegate* session_state_delegate =
- ash::Shell::GetInstance()->session_state_delegate();
- return session_state_delegate->TransferWindowToDesktopOfUser(window,
- GetTrayIndex());
-}
-
gfx::Rect TrayUser::GetUserPanelBoundsInScreenForTest() const {
DCHECK(user_);
return user_->GetBoundsInScreenOfUserButtonForTest();
@@ -1229,7 +1171,7 @@ void TrayUser::UpdateAfterLoginStatusChange(user::LoginStatus status) {
// Only the active user is represented in the tray.
if (!layout_view_)
return;
- if (GetTrayIndex() > 0 && !ash::switches::UseMultiUserTray())
+ if (GetTrayIndex() > 0)
return;
bool need_label = false;
bool need_avatar = false;
@@ -1264,15 +1206,7 @@ void TrayUser::UpdateAfterLoginStatusChange(user::LoginStatus status) {
label_ = NULL;
}
if (need_avatar) {
- MultiProfileIndex tray_index = GetTrayIndex();
- if (!tray_index) {
- // The active user (index #0) will always be the first.
- avatar_ = new tray::RoundedImageView(kProfileRoundedCornerRadius, true);
- } else {
- // All other users will be inactive users.
- avatar_ = new tray::UserSwitcherView(kProfileRoundedCornerRadius,
- tray_index);
- }
+ avatar_ = new tray::RoundedImageView(kProfileRoundedCornerRadius, true);
layout_view_->AddChildView(avatar_);
} else {
avatar_ = NULL;
@@ -1288,8 +1222,8 @@ void TrayUser::UpdateAfterLoginStatusChange(user::LoginStatus status) {
}
if (avatar_ && switches::UseAlternateShelfLayout()) {
- int corner_radius = GetTrayItemRadius();
- avatar_->SetCornerRadii(0, corner_radius, corner_radius, 0);
+ avatar_->SetCornerRadii(
+ 0, kUserIconLargeCornerRadius, kUserIconLargeCornerRadius, 0);
avatar_->SetBorder(views::Border::NullBorder());
}
UpdateAvatarImage(status);
@@ -1302,18 +1236,13 @@ void TrayUser::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
// Inactive users won't have a layout.
if (!layout_view_)
return;
- int corner_radius = GetTrayItemRadius();
if (alignment == SHELF_ALIGNMENT_BOTTOM ||
alignment == SHELF_ALIGNMENT_TOP) {
if (avatar_) {
if (switches::UseAlternateShelfLayout()) {
- if (multiprofile_index_) {
- avatar_->SetBorder(
- views::Border::CreateEmptyBorder(0, kTrayLabelSpacing, 0, 0));
- } else {
- avatar_->SetBorder(views::Border::NullBorder());
- }
- avatar_->SetCornerRadii(0, corner_radius, corner_radius, 0);
+ avatar_->SetBorder(views::Border::NullBorder());
+ avatar_->SetCornerRadii(
+ 0, kUserIconLargeCornerRadius, kUserIconLargeCornerRadius, 0);
} else {
avatar_->SetBorder(views::Border::CreateEmptyBorder(
0,
@@ -1335,13 +1264,9 @@ void TrayUser::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
} else {
if (avatar_) {
if (switches::UseAlternateShelfLayout()) {
- if (multiprofile_index_) {
- avatar_->SetBorder(
- views::Border::CreateEmptyBorder(kTrayLabelSpacing, 0, 0, 0));
- } else {
- avatar_->SetBorder(views::Border::NullBorder());
- }
- avatar_->SetCornerRadii(0, 0, corner_radius, corner_radius);
+ avatar_->SetBorder(views::Border::NullBorder());
+ avatar_->SetCornerRadii(
+ 0, 0, kUserIconLargeCornerRadius, kUserIconLargeCornerRadius);
} else {
SetTrayImageItemBorder(avatar_, alignment);
}
@@ -1410,13 +1335,6 @@ MultiProfileIndex TrayUser::GetTrayIndex() {
1 - multiprofile_index_;
}
-int TrayUser::GetTrayItemRadius() {
- SessionStateDelegate* delegate =
- Shell::GetInstance()->session_state_delegate();
- bool is_last_item = GetTrayIndex() == (delegate->NumberOfLoggedInUsers() - 1);
- return is_last_item ? kUserIconLargeCornerRadius : 0;
-}
-
void TrayUser::UpdateLayoutOfItem() {
internal::RootWindowController* controller =
internal::GetRootWindowController(
diff --git a/ash/system/user/tray_user.h b/ash/system/user/tray_user.h
index 079bf75..3bc4128 100644
--- a/ash/system/user/tray_user.h
+++ b/ash/system/user/tray_user.h
@@ -13,7 +13,6 @@
namespace gfx {
class Rect;
-class Point;
}
namespace views {
@@ -49,14 +48,6 @@ class ASH_EXPORT TrayUser : public SystemTrayItem,
};
TestState GetStateForTest() const;
- // Checks if a drag and drop operation would be able to land a window on this
- // |point_in_screen|.
- bool CanDropWindowHereToTransferToUser(const gfx::Point& point_in_screen);
-
- // Try to re-parent the |window| to a new owner. Returns true if the window
- // got transfered.
- bool TransferWindowToUser(aura::Window* window);
-
// Returns the bounds of the user panel in screen coordinates.
// Note: This only works when the panel shown.
gfx::Rect GetUserPanelBoundsInScreenForTest() const;
@@ -82,9 +73,6 @@ class ASH_EXPORT TrayUser : public SystemTrayItem,
// Get the user index which should be used for the tray icon of this item.
MultiProfileIndex GetTrayIndex();
- // Return the radius for the tray item to use.
- int GetTrayItemRadius();
-
// Updates the layout of this item.
void UpdateLayoutOfItem();
diff --git a/ash/system/user/tray_user_unittest.cc b/ash/system/user/tray_user_unittest.cc
index ad69661..600bc8d 100644
--- a/ash/system/user/tray_user_unittest.cc
+++ b/ash/system/user/tray_user_unittest.cc
@@ -21,10 +21,6 @@
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
-#if defined(OS_CHROMEOS)
-#include "ash/system/tray/system_tray_notifier.h"
-#endif
-
namespace ash {
namespace internal {
@@ -71,24 +67,6 @@ class TrayUserTest : public ash::test::AshTestBase {
DISALLOW_COPY_AND_ASSIGN(TrayUserTest);
};
-#if defined(OS_CHROMEOS)
-// The tray user test which tests functionality where multiple tray items are
-// visible in the system tray.
-class MultiTrayUserTest : public TrayUserTest {
- public:
- MultiTrayUserTest() {}
-
- virtual void SetUp() OVERRIDE {
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- command_line->AppendSwitch(ash::switches::kAshEnableMultiUserTray);
- TrayUserTest::SetUp();
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MultiTrayUserTest);
-};
-#endif
-
TrayUserTest::TrayUserTest()
: shelf_(NULL),
tray_(NULL),
@@ -266,54 +244,6 @@ TEST_F(TrayUserTest, MutiUserModeButtonClicks) {
tray()->CloseSystemBubble();
}
-// Make sure that we show items for all users in the tray accordingly.
-TEST_F(MultiTrayUserTest, CheckTrayUserItems) {
- InitializeParameters(1, true);
-
- int max_users = delegate()->GetMaximumNumberOfLoggedInUsers();
- // Checking now for each amount of users that the proper items are visible in
- // the tray. The proper item is hereby:
- // 2 -> User #1
- // 1 -> User #2
- // 0 -> User #3
- // Note: Tray items are required to populate system tray items as well as the
- // system tray menu. The system tray menu changes it's appearance with the
- // addition of more users, but the system tray does not create new items after
- // it got created.
- for (int present_users = 1; present_users <= max_users; ++present_users) {
- // We simulate the user addition by telling the delegate the new number of
- // users, then change all user tray items and finally tell the tray to
- // re-layout itself.
- delegate()->set_logged_in_users(present_users);
- Shell::GetInstance()->system_tray_notifier()->NotifyUserAddedToSession();
- tray()->Layout();
-
- // Check that the tray items are being shown in the reverse order.
- for (int i = 0; i < max_users; i++) {
- gfx::Rect rect =
- tray()->GetTrayItemViewForTest(tray_user(i))->GetBoundsInScreen();
- if (max_users - 1 - i < present_users)
- EXPECT_FALSE(rect.IsEmpty());
- else
- EXPECT_TRUE(rect.IsEmpty());
- }
- }
-
- // Click on the last item to see that the user changes.
- aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
- generator.set_async(false);
-
- // Switch to a new user - again, note that we have to click on the reverse
- // item in the list. Since the first clickable item is 1, we get user #2.
- gfx::Point point =
- tray()->GetTrayItemViewForTest(tray_user(1))->
- GetBoundsInScreen().CenterPoint();
-
- generator.MoveMouseTo(point.x(), point.y());
- generator.ClickLeftButton();
- EXPECT_EQ(delegate()->get_activated_user(), delegate()->GetUserID(1));
-}
-
#endif
} // namespace internal