| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_SYSTEM_USER_TRAY_USER_H_ | 5 #ifndef ASH_SYSTEM_USER_TRAY_USER_H_ |
| 6 #define ASH_SYSTEM_USER_TRAY_USER_H_ | 6 #define ASH_SYSTEM_USER_TRAY_USER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/session_state_delegate.h" | 9 #include "ash/session_state_delegate.h" |
| 10 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
| 11 #include "ash/system/user/user_observer.h" | 11 #include "ash/system/user/user_observer.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Rect; | 15 class Rect; |
| 16 class Point; | |
| 17 } | 16 } |
| 18 | 17 |
| 19 namespace views { | 18 namespace views { |
| 20 class ImageView; | 19 class ImageView; |
| 21 class Label; | 20 class Label; |
| 22 } | 21 } |
| 23 | 22 |
| 24 namespace ash { | 23 namespace ash { |
| 25 namespace internal { | 24 namespace internal { |
| 26 | 25 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 42 // Allows unit tests to see if the item was created. | 41 // Allows unit tests to see if the item was created. |
| 43 enum TestState { | 42 enum TestState { |
| 44 HIDDEN, // The item is hidden. | 43 HIDDEN, // The item is hidden. |
| 45 SHOWN, // The item gets presented to the user. | 44 SHOWN, // The item gets presented to the user. |
| 46 HOVERED, // The item is hovered and presented to the user. | 45 HOVERED, // The item is hovered and presented to the user. |
| 47 ACTIVE, // The item was clicked and can add a user. | 46 ACTIVE, // The item was clicked and can add a user. |
| 48 ACTIVE_BUT_DISABLED // The item was clicked anc cannot add a user. | 47 ACTIVE_BUT_DISABLED // The item was clicked anc cannot add a user. |
| 49 }; | 48 }; |
| 50 TestState GetStateForTest() const; | 49 TestState GetStateForTest() const; |
| 51 | 50 |
| 52 // Checks if a drag and drop operation would be able to land a window on this | |
| 53 // |point_in_screen|. | |
| 54 bool CanDropWindowHereToTransferToUser(const gfx::Point& point_in_screen); | |
| 55 | |
| 56 // Try to re-parent the |window| to a new owner. Returns true if the window | |
| 57 // got transfered. | |
| 58 bool TransferWindowToUser(aura::Window* window); | |
| 59 | |
| 60 // Returns the bounds of the user panel in screen coordinates. | 51 // Returns the bounds of the user panel in screen coordinates. |
| 61 // Note: This only works when the panel shown. | 52 // Note: This only works when the panel shown. |
| 62 gfx::Rect GetUserPanelBoundsInScreenForTest() const; | 53 gfx::Rect GetUserPanelBoundsInScreenForTest() const; |
| 63 | 54 |
| 64 private: | 55 private: |
| 65 // Overridden from SystemTrayItem. | 56 // Overridden from SystemTrayItem. |
| 66 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE; | 57 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE; |
| 67 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; | 58 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; |
| 68 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; | 59 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; |
| 69 virtual void DestroyTrayView() OVERRIDE; | 60 virtual void DestroyTrayView() OVERRIDE; |
| 70 virtual void DestroyDefaultView() OVERRIDE; | 61 virtual void DestroyDefaultView() OVERRIDE; |
| 71 virtual void DestroyDetailedView() OVERRIDE; | 62 virtual void DestroyDetailedView() OVERRIDE; |
| 72 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE; | 63 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE; |
| 73 virtual void UpdateAfterShelfAlignmentChange( | 64 virtual void UpdateAfterShelfAlignmentChange( |
| 74 ShelfAlignment alignment) OVERRIDE; | 65 ShelfAlignment alignment) OVERRIDE; |
| 75 | 66 |
| 76 // Overridden from UserObserver. | 67 // Overridden from UserObserver. |
| 77 virtual void OnUserUpdate() OVERRIDE; | 68 virtual void OnUserUpdate() OVERRIDE; |
| 78 virtual void OnUserAddedToSession() OVERRIDE; | 69 virtual void OnUserAddedToSession() OVERRIDE; |
| 79 | 70 |
| 80 void UpdateAvatarImage(user::LoginStatus status); | 71 void UpdateAvatarImage(user::LoginStatus status); |
| 81 | 72 |
| 82 // Get the user index which should be used for the tray icon of this item. | 73 // Get the user index which should be used for the tray icon of this item. |
| 83 MultiProfileIndex GetTrayIndex(); | 74 MultiProfileIndex GetTrayIndex(); |
| 84 | 75 |
| 85 // Return the radius for the tray item to use. | |
| 86 int GetTrayItemRadius(); | |
| 87 | |
| 88 // Updates the layout of this item. | 76 // Updates the layout of this item. |
| 89 void UpdateLayoutOfItem(); | 77 void UpdateLayoutOfItem(); |
| 90 | 78 |
| 91 // The user index to use. | 79 // The user index to use. |
| 92 MultiProfileIndex multiprofile_index_; | 80 MultiProfileIndex multiprofile_index_; |
| 93 | 81 |
| 94 tray::UserView* user_; | 82 tray::UserView* user_; |
| 95 | 83 |
| 96 // View that contains label and/or avatar. | 84 // View that contains label and/or avatar. |
| 97 views::View* layout_view_; | 85 views::View* layout_view_; |
| 98 tray::RoundedImageView* avatar_; | 86 tray::RoundedImageView* avatar_; |
| 99 views::Label* label_; | 87 views::Label* label_; |
| 100 | 88 |
| 101 DISALLOW_COPY_AND_ASSIGN(TrayUser); | 89 DISALLOW_COPY_AND_ASSIGN(TrayUser); |
| 102 }; | 90 }; |
| 103 | 91 |
| 104 } // namespace internal | 92 } // namespace internal |
| 105 } // namespace ash | 93 } // namespace ash |
| 106 | 94 |
| 107 #endif // ASH_SYSTEM_USER_TRAY_USER_H_ | 95 #endif // ASH_SYSTEM_USER_TRAY_USER_H_ |
| OLD | NEW |