OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_TEST_TEST_SESSION_STATE_DELEGATE_H_ | 5 #ifndef ASH_TEST_TEST_SESSION_STATE_DELEGATE_H_ |
6 #define ASH_TEST_TEST_SESSION_STATE_DELEGATE_H_ | 6 #define ASH_TEST_TEST_SESSION_STATE_DELEGATE_H_ |
7 | 7 |
8 #include "ash/session_state_delegate.h" | 8 #include "ash/session_state_delegate.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "ui/gfx/image/image_skia.h" | 11 #include "ui/gfx/image/image_skia.h" |
12 | 12 |
13 namespace ash { | 13 namespace ash { |
14 namespace test { | 14 namespace test { |
15 | 15 |
16 class TestSessionStateDelegate : public SessionStateDelegate { | 16 class TestSessionStateDelegate : public SessionStateDelegate { |
17 public: | 17 public: |
18 TestSessionStateDelegate(); | 18 TestSessionStateDelegate(); |
19 virtual ~TestSessionStateDelegate(); | 19 virtual ~TestSessionStateDelegate(); |
20 | 20 |
21 void set_logged_in_users(int users) { logged_in_users_ = users; } | 21 void set_logged_in_users(int users) { logged_in_users_ = users; } |
22 const std::string& get_activated_user() { return activated_user_; } | 22 const std::string& get_activated_user() { return activated_user_; } |
23 | 23 |
24 // SessionStateDelegate: | 24 // SessionStateDelegate: |
25 virtual content::BrowserContext* GetBrowserContextByIndex( | 25 virtual content::BrowserContext* GetBrowserContextByIndex( |
26 MultiProfileIndex index) OVERRIDE; | 26 MultiProfileIndex index) OVERRIDE; |
| 27 virtual content::BrowserContext* GetBrowserContextForWindow( |
| 28 aura::Window* window) OVERRIDE; |
27 virtual int GetMaximumNumberOfLoggedInUsers() const OVERRIDE; | 29 virtual int GetMaximumNumberOfLoggedInUsers() const OVERRIDE; |
28 virtual int NumberOfLoggedInUsers() const OVERRIDE; | 30 virtual int NumberOfLoggedInUsers() const OVERRIDE; |
29 virtual bool IsActiveUserSessionStarted() const OVERRIDE; | 31 virtual bool IsActiveUserSessionStarted() const OVERRIDE; |
30 virtual bool CanLockScreen() const OVERRIDE; | 32 virtual bool CanLockScreen() const OVERRIDE; |
31 virtual bool IsScreenLocked() const OVERRIDE; | 33 virtual bool IsScreenLocked() const OVERRIDE; |
32 virtual bool ShouldLockScreenBeforeSuspending() const OVERRIDE; | 34 virtual bool ShouldLockScreenBeforeSuspending() const OVERRIDE; |
33 virtual void LockScreen() OVERRIDE; | 35 virtual void LockScreen() OVERRIDE; |
34 virtual void UnlockScreen() OVERRIDE; | 36 virtual void UnlockScreen() OVERRIDE; |
35 virtual bool IsUserSessionBlocked() const OVERRIDE; | 37 virtual bool IsUserSessionBlocked() const OVERRIDE; |
36 virtual const base::string16 GetUserDisplayName( | 38 virtual const base::string16 GetUserDisplayName( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // is an active user. | 70 // is an active user. |
69 void SetCanLockScreen(bool can_lock_screen); | 71 void SetCanLockScreen(bool can_lock_screen); |
70 | 72 |
71 // Updates |should_lock_screen_before_suspending_|. | 73 // Updates |should_lock_screen_before_suspending_|. |
72 void SetShouldLockScreenBeforeSuspending(bool should_lock); | 74 void SetShouldLockScreenBeforeSuspending(bool should_lock); |
73 | 75 |
74 // Updates the internal state that indicates whether user adding screen is | 76 // Updates the internal state that indicates whether user adding screen is |
75 // running now. | 77 // running now. |
76 void SetUserAddingScreenRunning(bool user_adding_screen_running); | 78 void SetUserAddingScreenRunning(bool user_adding_screen_running); |
77 | 79 |
| 80 // Setting non NULL image enables avatar icon. |
| 81 void SetUserImage(const gfx::ImageSkia& user_image); |
| 82 |
78 private: | 83 private: |
79 // Whether a session is in progress and there is an active user. | 84 // Whether a session is in progress and there is an active user. |
80 bool has_active_user_; | 85 bool has_active_user_; |
81 | 86 |
82 // When a user becomes active, the profile and browser UI are not immediately | 87 // When a user becomes active, the profile and browser UI are not immediately |
83 // available. Only once this flag becomes |true| is the browser startup | 88 // available. Only once this flag becomes |true| is the browser startup |
84 // complete and both profile and UI are fully available. | 89 // complete and both profile and UI are fully available. |
85 bool active_user_session_started_; | 90 bool active_user_session_started_; |
86 | 91 |
87 // Whether the screen can be locked. Locking will only actually be allowed | 92 // Whether the screen can be locked. Locking will only actually be allowed |
88 // when this is |true| and there is an active user. | 93 // when this is |true| and there is an active user. |
89 bool can_lock_screen_; | 94 bool can_lock_screen_; |
90 | 95 |
91 // Return value for ShouldLockScreenBeforeSuspending(). | 96 // Return value for ShouldLockScreenBeforeSuspending(). |
92 bool should_lock_screen_before_suspending_; | 97 bool should_lock_screen_before_suspending_; |
93 | 98 |
94 // Whether the screen is currently locked. | 99 // Whether the screen is currently locked. |
95 bool screen_locked_; | 100 bool screen_locked_; |
96 | 101 |
97 // Whether user addding screen is running now. | 102 // Whether user addding screen is running now. |
98 bool user_adding_screen_running_; | 103 bool user_adding_screen_running_; |
99 | 104 |
100 // The number of users logged in. | 105 // The number of users logged in. |
101 int logged_in_users_; | 106 int logged_in_users_; |
102 | 107 |
103 // The activated user. | 108 // The activated user. |
104 std::string activated_user_; | 109 std::string activated_user_; |
105 | 110 |
106 // A test user image. | 111 // A test user image. |
107 gfx::ImageSkia null_image_; | 112 gfx::ImageSkia user_image_; |
108 | 113 |
109 DISALLOW_COPY_AND_ASSIGN(TestSessionStateDelegate); | 114 DISALLOW_COPY_AND_ASSIGN(TestSessionStateDelegate); |
110 }; | 115 }; |
111 | 116 |
112 } // namespace test | 117 } // namespace test |
113 } // namespace ash | 118 } // namespace ash |
114 | 119 |
115 #endif // ASH_TEST_TEST_SESSION_STATE_DELEGATE_H_ | 120 #endif // ASH_TEST_TEST_SESSION_STATE_DELEGATE_H_ |
OLD | NEW |