diff options
-rw-r--r-- | ash/ash_switches.cc | 13 | ||||
-rw-r--r-- | ash/ash_switches.h | 3 | ||||
-rw-r--r-- | ash/session_state_delegate.h | 7 | ||||
-rw-r--r-- | ash/session_state_delegate_stub.cc | 6 | ||||
-rw-r--r-- | ash/session_state_delegate_stub.h | 3 | ||||
-rw-r--r-- | ash/system/tray/system_tray.cc | 17 | ||||
-rw-r--r-- | ash/system/tray/system_tray.h | 11 | ||||
-rw-r--r-- | ash/system/user/tray_user.cc | 102 | ||||
-rw-r--r-- | ash/system/user/tray_user.h | 12 | ||||
-rw-r--r-- | ash/system/user/tray_user_unittest.cc | 70 | ||||
-rw-r--r-- | ash/test/test_session_state_delegate.cc | 10 | ||||
-rw-r--r-- | ash/test/test_session_state_delegate.h | 11 | ||||
-rw-r--r-- | ash/wm/drag_window_resizer.cc | 72 | ||||
-rw-r--r-- | ash/wm/drag_window_resizer.h | 9 | ||||
-rw-r--r-- | ash/wm/drag_window_resizer_unittest.cc | 94 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 6 | ||||
-rw-r--r-- | chrome/browser/about_flags.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/ash/session_state_delegate_chromeos.cc | 21 | ||||
-rw-r--r-- | chrome/browser/ui/ash/session_state_delegate_chromeos.h | 3 | ||||
-rw-r--r-- | chrome/browser/ui/ash/session_state_delegate_views.cc | 7 | ||||
-rw-r--r-- | chrome/browser/ui/ash/session_state_delegate_views.h | 3 |
21 files changed, 14 insertions, 474 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index bde14fe..764be1c 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -105,9 +105,6 @@ const char kAshEnableImmersiveFullscreenForBrowserOnly[] = // Enables key bindings to scroll magnified screen. const char kAshEnableMagnifierKeyScroller[] = "ash-enable-magnifier-key-scroller"; - -// Enables the multi user icons in the system tray. -const char kAshEnableMultiUserTray[] = "ash-enable-multi-user-tray"; #endif // Enables software based mirroring. @@ -194,16 +191,6 @@ bool UseImmersiveFullscreenForAllWindows() { kAshEnableImmersiveFullscreenForBrowserOnly); } -bool UseMultiUserTray() { -#if defined(OS_CHROMEOS) - // TODO(skuhne): If this gets removed for good, remove also - // |SystemTray::user_items_| and the use of it. - return CommandLine::ForCurrentProcess()->HasSwitch(kAshEnableMultiUserTray); -#else - return false; -#endif -} - bool UseOverviewMode() { return !CommandLine::ForCurrentProcess()->HasSwitch(kAshDisableOverviewMode); } diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 8837061..08b28f4 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -77,9 +77,6 @@ ASH_EXPORT bool UseDragOffShelf(); // immersive fullscreen via <F4>. ASH_EXPORT bool UseImmersiveFullscreenForAllWindows(); -// Returns true if multiple user icons are allowed in the tray. -ASH_EXPORT bool UseMultiUserTray(); - // Returns true if overview mode should be activated for window switching. ASH_EXPORT bool UseOverviewMode(); diff --git a/ash/session_state_delegate.h b/ash/session_state_delegate.h index 91c6229..31e34c9 100644 --- a/ash/session_state_delegate.h +++ b/ash/session_state_delegate.h @@ -109,13 +109,6 @@ class ASH_EXPORT SessionStateDelegate { // Adds or removes sessions state observer. virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0; virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0; - - // Transfers the visibility of a window to another user. Returns true when - // transfer was done. This could fail if the |window| belongs to no one and - // is therefore shown on the desktop of every user. - virtual bool TransferWindowToDesktopOfUser( - aura::Window* window, - ash::MultiProfileIndex index) = 0; }; } // namespace ash diff --git a/ash/session_state_delegate_stub.cc b/ash/session_state_delegate_stub.cc index f336f02..fea3a56 100644 --- a/ash/session_state_delegate_stub.cc +++ b/ash/session_state_delegate_stub.cc @@ -93,10 +93,4 @@ void SessionStateDelegateStub::RemoveSessionStateObserver( ash::SessionStateObserver* observer) { } -bool SessionStateDelegateStub::TransferWindowToDesktopOfUser( - aura::Window* window, - ash::MultiProfileIndex index) { - return false; -} - } // namespace ash diff --git a/ash/session_state_delegate_stub.h b/ash/session_state_delegate_stub.h index f496e6b..4a11833 100644 --- a/ash/session_state_delegate_stub.h +++ b/ash/session_state_delegate_stub.h @@ -43,9 +43,6 @@ class SessionStateDelegateStub : public SessionStateDelegate { ash::SessionStateObserver* observer) OVERRIDE; virtual void RemoveSessionStateObserver( ash::SessionStateObserver* observer) OVERRIDE; - virtual bool TransferWindowToDesktopOfUser( - aura::Window* window, - ash::MultiProfileIndex index) OVERRIDE; private: bool screen_locked_; diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index ebb5e68..0bb523d 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -164,11 +164,9 @@ void SystemTray::CreateItems(SystemTrayDelegate* delegate) { ash::Shell* shell = ash::Shell::GetInstance(); int maximum_user_profiles = shell->session_state_delegate()->GetMaximumNumberOfLoggedInUsers(); - for (int i = 0; i < maximum_user_profiles; i++) { - internal::TrayUser* tray_user = new internal::TrayUser(this, i); - AddTrayItem(tray_user); - user_items_.push_back(tray_user); - } + for (int i = 0; i < maximum_user_profiles; i++) + AddTrayItem(new internal::TrayUser(this, i)); + if (maximum_user_profiles > 1) { // Add a special double line separator between users and the rest of the // menu if more then one user is logged in. @@ -241,10 +239,6 @@ const std::vector<SystemTrayItem*>& SystemTray::GetTrayItems() const { return items_.get(); } -const std::vector<internal::TrayUser*>& SystemTray::GetTrayUserItems() const { - return user_items_; -} - void SystemTray::ShowDefaultView(BubbleCreationType creation_type) { ShowDefaultViewWithOffset( creation_type, @@ -686,11 +680,6 @@ views::View* SystemTray::GetTrayItemViewForTest(SystemTrayItem* item) { return it == tray_item_map_.end() ? NULL : it->second; } -void SystemTray::AddTrayUserItemForTest(internal::TrayUser* tray_user) { - AddTrayItem(tray_user); - user_items_.push_back(tray_user); -} - internal::TrayDate* SystemTray::GetTrayDateForTesting() const { return tray_date_; } diff --git a/ash/system/tray/system_tray.h b/ash/system/tray/system_tray.h index abbbbd6..7c5aa4f 100644 --- a/ash/system/tray/system_tray.h +++ b/ash/system/tray/system_tray.h @@ -56,9 +56,6 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView, // Returns all tray items that has been added to system tray. const std::vector<SystemTrayItem*>& GetTrayItems() const; - // Returns all tray user items that were added to the system tray. - const std::vector<internal::TrayUser*>& GetTrayUserItems() const; - // Shows the default view of all items. void ShowDefaultView(BubbleCreationType creation_type); @@ -154,10 +151,6 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView, // Get the tray item view (or NULL) for a given |tray_item| in a unit test. views::View* GetTrayItemViewForTest(SystemTrayItem* tray_item); - // Add a tray user item for testing purposes. Note: The passed |tray_user| - // will be owned by the SystemTray after the call. - void AddTrayUserItemForTest(internal::TrayUser* tray_user); - // Gets tray_date_ for browser tests. internal::TrayDate* GetTrayDateForTesting() const; @@ -209,10 +202,6 @@ class ASH_EXPORT SystemTray : public internal::TrayBackgroundView, // Owned items. ScopedVector<SystemTrayItem> items_; - // User items - note, this is a subset of the |items_| list. Note that no - // item in this list needs to be deleted. - std::vector<internal::TrayUser*> user_items_; - // Pointers to members of |items_|. SystemTrayItem* detailed_item_; std::vector<SystemTrayItem*> notification_items_; 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 diff --git a/ash/test/test_session_state_delegate.cc b/ash/test/test_session_state_delegate.cc index 171cd43d..e1085c0 100644 --- a/ash/test/test_session_state_delegate.cc +++ b/ash/test/test_session_state_delegate.cc @@ -34,8 +34,7 @@ TestSessionStateDelegate::TestSessionStateDelegate() should_lock_screen_before_suspending_(false), screen_locked_(false), user_adding_screen_running_(false), - logged_in_users_(1), - num_transfer_to_desktop_of_user_calls_(0) { + logged_in_users_(1) { } TestSessionStateDelegate::~TestSessionStateDelegate() { @@ -159,12 +158,5 @@ void TestSessionStateDelegate::RemoveSessionStateObserver( SessionStateObserver* observer) { } -bool TestSessionStateDelegate::TransferWindowToDesktopOfUser( - aura::Window* window, - ash::MultiProfileIndex index) { - num_transfer_to_desktop_of_user_calls_++; - return false; -} - } // namespace test } // namespace ash diff --git a/ash/test/test_session_state_delegate.h b/ash/test/test_session_state_delegate.h index 8c26c88..1277a068 100644 --- a/ash/test/test_session_state_delegate.h +++ b/ash/test/test_session_state_delegate.h @@ -46,9 +46,6 @@ class TestSessionStateDelegate : public SessionStateDelegate { ash::SessionStateObserver* observer) OVERRIDE; virtual void RemoveSessionStateObserver( ash::SessionStateObserver* observer) OVERRIDE; - virtual bool TransferWindowToDesktopOfUser( - aura::Window* window, - ash::MultiProfileIndex index) OVERRIDE; // TODO(oshima): Use state machine instead of using boolean variables. @@ -76,11 +73,6 @@ class TestSessionStateDelegate : public SessionStateDelegate { // running now. void SetUserAddingScreenRunning(bool user_adding_screen_running); - // Returns the number of calls to TransferWindowToDesktopOfUser. - int num_transfer_to_desktop_of_user_calls() { - return num_transfer_to_desktop_of_user_calls_; - } - private: // Whether a session is in progress and there is an active user. bool has_active_user_; @@ -112,9 +104,6 @@ class TestSessionStateDelegate : public SessionStateDelegate { // A test user image. gfx::ImageSkia null_image_; - // The number of calls which happened to TransferWindowToDesktopOfUser. - int num_transfer_to_desktop_of_user_calls_; - DISALLOW_COPY_AND_ASSIGN(TestSessionStateDelegate); }; diff --git a/ash/wm/drag_window_resizer.cc b/ash/wm/drag_window_resizer.cc index b5455e7..3e72e4a 100644 --- a/ash/wm/drag_window_resizer.cc +++ b/ash/wm/drag_window_resizer.cc @@ -5,11 +5,8 @@ #include "ash/wm/drag_window_resizer.h" #include "ash/display/mouse_cursor_event_filter.h" -#include "ash/root_window_controller.h" #include "ash/screen_util.h" #include "ash/shell.h" -#include "ash/system/tray/system_tray.h" -#include "ash/system/user/tray_user.h" #include "ash/wm/coordinate_conversion.h" #include "ash/wm/drag_window_controller.h" #include "ash/wm/window_state.h" @@ -33,9 +30,6 @@ namespace { // The maximum opacity of the drag phantom window. const float kMaxOpacity = 0.8f; -// The opacity of the window when dragging it over a user item in the tray. -const float kOpacityWhenDraggedOverUserIcon = 0.4f; - // Returns true if Ash has more than one root window. bool HasSecondaryRootWindow() { return Shell::GetAllRootWindows().size() > 1; @@ -78,13 +72,6 @@ DragWindowResizer* DragWindowResizer::Create( void DragWindowResizer::Drag(const gfx::Point& location, int event_flags) { base::WeakPtr<DragWindowResizer> resizer(weak_ptr_factory_.GetWeakPtr()); - - // If we are on top of a window to desktop transfer button, we move the window - // temporarily back to where it was initially and make it semi-transparent. - GetTarget()->layer()->SetOpacity( - GetTrayUserItemAtPoint(location) ? kOpacityWhenDraggedOverUserIcon : - details().initial_opacity); - next_window_resizer_->Drag(location, event_flags); if (!resizer) @@ -104,9 +91,6 @@ void DragWindowResizer::Drag(const gfx::Point& location, int event_flags) { } void DragWindowResizer::CompleteDrag() { - if (TryDraggingToNewUser()) - return; - next_window_resizer_->CompleteDrag(); GetTarget()->layer()->SetOpacity(details().initial_opacity); @@ -227,61 +211,5 @@ bool DragWindowResizer::ShouldAllowMouseWarp() { GetTarget()->type() == ui::wm::WINDOW_TYPE_PANEL); } -TrayUser* DragWindowResizer::GetTrayUserItemAtPoint( - const gfx::Point& point_in_screen) { - // Unit tests might not have an ash shell. - if (!ash::Shell::GetInstance()) - return NULL; - - // Check that this is a drag move operation from a suitable window. - if (details().window_component != HTCAPTION || - views::corewm::GetTransientParent(GetTarget()) || - (GetTarget()->type() != ui::wm::WINDOW_TYPE_NORMAL && - GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL && - GetTarget()->type() != ui::wm::WINDOW_TYPE_POPUP)) - return NULL; - - // We only allow to drag the window onto a tray of it's own RootWindow. - SystemTray* tray = internal::GetRootWindowController( - GetTarget()->GetRootWindow())->GetSystemTray(); - - // Again - unit tests might not have a tray. - if (!tray) - return NULL; - - const std::vector<internal::TrayUser*> tray_users = tray->GetTrayUserItems(); - if (tray_users.size() <= 1) - return NULL; - - std::vector<internal::TrayUser*>::const_iterator it = tray_users.begin(); - for (; it != tray_users.end(); ++it) { - if ((*it)->CanDropWindowHereToTransferToUser(point_in_screen)) - return *it; - } - return NULL; -} - -bool DragWindowResizer::TryDraggingToNewUser() { - TrayUser* tray_user = GetTrayUserItemAtPoint(last_mouse_location_); - // No need to try dragging if there is no user. - if (!tray_user) - return false; - - // We have to avoid a brief flash caused by the RevertDrag operation. - // To do this, we first set the opacity of our target window to 0, so that no - // matter what the RevertDrag does the window will stay hidden. Then transfer - // the window to the new owner (which will hide it). RevertDrag will then do - // it's thing and return the transparency to its original value. - int old_opacity = GetTarget()->layer()->opacity(); - GetTarget()->layer()->SetOpacity(0); - GetTarget()->SetBounds(details().initial_bounds_in_parent); - if (!tray_user->TransferWindowToUser(GetTarget())) { - GetTarget()->layer()->SetOpacity(old_opacity); - return false; - } - RevertDrag(); - return true; -} - } // namespace internal } // namespace ash diff --git a/ash/wm/drag_window_resizer.h b/ash/wm/drag_window_resizer.h index 2cb6ecc..67f4702 100644 --- a/ash/wm/drag_window_resizer.h +++ b/ash/wm/drag_window_resizer.h @@ -15,7 +15,6 @@ namespace ash { namespace internal { class DragWindowController; -class TrayUser; // DragWindowResizer is a decorator of WindowResizer and adds the ability to // drag windows across displays. @@ -50,14 +49,6 @@ class ASH_EXPORT DragWindowResizer : public WindowResizer { // Returns true if we should allow the mouse pointer to warp. bool ShouldAllowMouseWarp(); - // Get the user drop target underneath the given |point_in_screen| or NULL. - TrayUser* GetTrayUserItemAtPoint(const gfx::Point& point_in_screen); - - // Check if a completed drag might cause the window to change active desktops. - // If the call was causing a "transfer of ownership to another desktop" and it - // will return false indicating that no further processing is needed. - bool TryDraggingToNewUser(); - scoped_ptr<WindowResizer> next_window_resizer_; // Shows a semi-transparent image of the window being dragged. diff --git a/ash/wm/drag_window_resizer_unittest.cc b/ash/wm/drag_window_resizer_unittest.cc index 76f633c..af08202 100644 --- a/ash/wm/drag_window_resizer_unittest.cc +++ b/ash/wm/drag_window_resizer_unittest.cc @@ -25,13 +25,6 @@ #include "ui/views/corewm/window_util.h" #include "ui/views/widget/widget.h" -#if defined(OS_CHROMEOS) -#include "ash/system/tray/system_tray.h" -#include "ash/system/user/tray_user.h" -#include "ash/test/test_session_state_delegate.h" -#include "ash/test/test_shell_delegate.h" -#endif - namespace ash { namespace internal { namespace { @@ -639,92 +632,5 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) { } } -#if defined(OS_CHROMEOS) -// Checks that moving a window to another desktop will properly set and reset -// the transparency. -TEST_F(DragWindowResizerTest, DragToOtherDesktopOpacity) { - // Set up a few things we need for multi profile. - ash::test::TestSessionStateDelegate* session_delegate = - static_cast<ash::test::TestSessionStateDelegate*>( - ash::Shell::GetInstance()->session_state_delegate()); - session_delegate->set_logged_in_users(2); - ash::test::TestShellDelegate* shell_delegate = - static_cast<ash::test::TestShellDelegate*>( - ash::Shell::GetInstance()->delegate()); - shell_delegate->set_multi_profiles_enabled(true); - - // Create one other user where we can drag our stuff onto. - SystemTray* tray = Shell::GetPrimaryRootWindowController()->GetSystemTray(); - TrayUser* tray_user = new TrayUser(tray, 1); - tray->AddTrayUserItemForTest(tray_user); - - // Move the view somewhere where we can hit it. - views::View* view = tray->GetTrayItemViewForTest(tray_user); - view->SetBounds(80, 0, 20, 20); - gfx::Point center = view->GetBoundsInScreen().CenterPoint(); - - gfx::Rect initial_bounds = gfx::Rect(0, 0, 50, 60); - // Drag the window over the icon and let it drop. Test that the window's - // layer gets transparent and reverts back. - { - aura::Window* window = window_.get(); - window->SetBoundsInScreen(initial_bounds, - Shell::GetScreen()->GetPrimaryDisplay()); - // Grab (0, 0) of the window. - scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( - window, gfx::Point(), HTCAPTION)); - ASSERT_TRUE(resizer.get()); - EXPECT_EQ(1.0, window->layer()->opacity()); - resizer->Drag(center, 0); - EXPECT_NE(1.0, window->layer()->opacity()); - EXPECT_EQ(0, session_delegate->num_transfer_to_desktop_of_user_calls()); - resizer->CompleteDrag(); - EXPECT_EQ(1.0, window->layer()->opacity()); - EXPECT_EQ(1, session_delegate->num_transfer_to_desktop_of_user_calls()); - EXPECT_EQ(initial_bounds.ToString(), window->bounds().ToString()); - } - - // Drag the window over the icon and cancel the operation. Test that the - // window's layer gets transparent and reverts back. - { - aura::Window* window = window_.get(); - window->SetBoundsInScreen(initial_bounds, - Shell::GetScreen()->GetPrimaryDisplay()); - // Grab (0, 0) of the window. - scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( - window, gfx::Point(), HTCAPTION)); - ASSERT_TRUE(resizer.get()); - EXPECT_EQ(1.0, window->layer()->opacity()); - resizer->Drag(center, 0); - EXPECT_NE(1.0, window->layer()->opacity()); - resizer->RevertDrag(); - EXPECT_EQ(1.0, window->layer()->opacity()); - EXPECT_EQ(1, session_delegate->num_transfer_to_desktop_of_user_calls()); - EXPECT_EQ(initial_bounds.ToString(), window->bounds().ToString()); - } - - // Drag the window over the icon and somewhere else and see that it properly - // reverts its transparency. - { - aura::Window* window = window_.get(); - window->SetBoundsInScreen(initial_bounds, - Shell::GetScreen()->GetPrimaryDisplay()); - // Grab (0, 0) of the window. - scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( - window, gfx::Point(), HTCAPTION)); - ASSERT_TRUE(resizer.get()); - EXPECT_EQ(1.0, window->layer()->opacity()); - resizer->Drag(center, 0); - EXPECT_NE(1.0, window->layer()->opacity()); - resizer->Drag(gfx::Point(), 0); - EXPECT_EQ(1.0, window->layer()->opacity()); - resizer->CompleteDrag(); - EXPECT_EQ(1, session_delegate->num_transfer_to_desktop_of_user_calls()); - EXPECT_NE(initial_bounds.ToString(), window->bounds().ToString()); - } -} -#endif - - } // namespace internal } // namespace ash diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 8a62d9f..4550fc13 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6321,12 +6321,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_FLAGS_ENABLE_FULL_MULTI_PROFILE_MODE_DESCRIPTION" desc="Title for the full multi profile mode flag."> Enable side-by-side multi profile mode in which all browser and app windows share the same workspace. </message> - <message name="IDS_FLAGS_ENABLE_MULTI_USER_TRAY" desc="Title for the full multi profile tray flag."> - Enable multi profile tray - </message> - <message name="IDS_FLAGS_ENABLE_MULTI_USER_TRAY_DESCRIPTION" desc="Title for showing/hiding the multi profile icons in the system tray."> - Show in the system tray the icons for all logged in users. - </message> <message name="IDS_FLAGS_ASH_AUDIO_DEVICE_MENU_NAME" desc="Title for a flag for audio switching."> Audio input/output menu </message> diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index c6895f5..301a4af 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -1167,14 +1167,6 @@ const Experiment kExperiments[] = { kOsCrOS, SINGLE_VALUE_TYPE(ash::switches::kAshEnableTouchViewTesting), }, -#if defined(OS_CHROMEOS) - { "ash-enable-multi-user-tray", - IDS_FLAGS_ENABLE_MULTI_USER_TRAY, - IDS_FLAGS_ENABLE_MULTI_USER_TRAY_DESCRIPTION, - kOsCrOS, - SINGLE_VALUE_TYPE(ash::switches::kAshEnableMultiUserTray), - }, -#endif #endif #if defined(OS_CHROMEOS) { diff --git a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc index b92b402..141d9d8 100644 --- a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc @@ -15,7 +15,6 @@ #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" #include "chrome/common/pref_names.h" #include "chromeos/chromeos_switches.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -193,26 +192,6 @@ void SessionStateDelegateChromeos::RemoveSessionStateObserver( session_state_observer_list_.RemoveObserver(observer); } -bool SessionStateDelegateChromeos::TransferWindowToDesktopOfUser( - aura::Window* window, - ash::MultiProfileIndex index) { - if (chrome::MultiUserWindowManager::GetMultiProfileMode() != - chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) - return false; - chrome::MultiUserWindowManager* window_manager = - chrome::MultiUserWindowManager::GetInstance(); - if (window_manager->GetWindowOwner(window).empty()) - return false; - - ash::MultiProfileUMA::RecordTeleportAction( - ash::MultiProfileUMA::TELEPORT_WINDOW_DRAG_AND_DROP); - - DCHECK_LT(index, NumberOfLoggedInUsers()); - window_manager->ShowWindowForUser(window, - chromeos::UserManager::Get()->GetLRULoggedInUsers()[index]->email()); - return true; -} - void SessionStateDelegateChromeos::ActiveUserChanged( const chromeos::User* active_user) { FOR_EACH_OBSERVER(ash::SessionStateObserver, diff --git a/chrome/browser/ui/ash/session_state_delegate_chromeos.h b/chrome/browser/ui/ash/session_state_delegate_chromeos.h index 4bd3a56..01779d4 100644 --- a/chrome/browser/ui/ash/session_state_delegate_chromeos.h +++ b/chrome/browser/ui/ash/session_state_delegate_chromeos.h @@ -47,9 +47,6 @@ class SessionStateDelegateChromeos ash::SessionStateObserver* observer) OVERRIDE; virtual void RemoveSessionStateObserver( ash::SessionStateObserver* observer) OVERRIDE; - virtual bool TransferWindowToDesktopOfUser( - aura::Window* window, - ash::MultiProfileIndex index) OVERRIDE; // UserManager::UserSessionStateObserver: virtual void ActiveUserChanged(const chromeos::User* active_user) OVERRIDE; virtual void UserAddedToSession(const chromeos::User* added_user) OVERRIDE; diff --git a/chrome/browser/ui/ash/session_state_delegate_views.cc b/chrome/browser/ui/ash/session_state_delegate_views.cc index 68423e7..e8c26ca 100644 --- a/chrome/browser/ui/ash/session_state_delegate_views.cc +++ b/chrome/browser/ui/ash/session_state_delegate_views.cc @@ -100,10 +100,3 @@ void SessionStateDelegate::RemoveSessionStateObserver( ash::SessionStateObserver* observer) { NOTIMPLEMENTED(); } - -bool SessionStateDelegate::TransferWindowToDesktopOfUser( - aura::Window* window, - ash::MultiProfileIndex index) { - NOTIMPLEMENTED(); - return false; -} diff --git a/chrome/browser/ui/ash/session_state_delegate_views.h b/chrome/browser/ui/ash/session_state_delegate_views.h index fc805ba..f5f194d 100644 --- a/chrome/browser/ui/ash/session_state_delegate_views.h +++ b/chrome/browser/ui/ash/session_state_delegate_views.h @@ -44,9 +44,6 @@ class SessionStateDelegate : public ash::SessionStateDelegate { ash::SessionStateObserver* observer) OVERRIDE; virtual void RemoveSessionStateObserver( ash::SessionStateObserver* observer) OVERRIDE; - virtual bool TransferWindowToDesktopOfUser( - aura::Window* window, - ash::MultiProfileIndex index) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(SessionStateDelegate); }; |