OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 5 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_stub.h" | 8 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_stub.h" |
9 | 9 |
10 #if defined(OS_CHROMEOS) | 10 #if defined(OS_CHROMEOS) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 return g_instance; | 60 return g_instance; |
61 } | 61 } |
62 | 62 |
63 // static | 63 // static |
64 MultiUserWindowManager::MultiProfileMode | 64 MultiUserWindowManager::MultiProfileMode |
65 MultiUserWindowManager::GetMultiProfileMode() { | 65 MultiUserWindowManager::GetMultiProfileMode() { |
66 return multi_user_mode_; | 66 return multi_user_mode_; |
67 } | 67 } |
68 | 68 |
| 69 // satic |
| 70 bool MultiUserWindowManager::ShouldShowAvatar(aura::Window* window) { |
| 71 // Note: In case of the M-31 mode the window manager won't exist. |
| 72 if (GetMultiProfileMode() == MULTI_PROFILE_MODE_SEPARATED) { |
| 73 // If the window is shown on a different desktop than the user, it should |
| 74 // have the avatar icon |
| 75 MultiUserWindowManager* instance = GetInstance(); |
| 76 return !instance->IsWindowOnDesktopOfUser(window, |
| 77 instance->GetWindowOwner(window)); |
| 78 } |
| 79 return false; |
| 80 } |
| 81 |
69 // static | 82 // static |
70 void MultiUserWindowManager::DeleteInstance() { | 83 void MultiUserWindowManager::DeleteInstance() { |
71 DCHECK(g_instance); | 84 DCHECK(g_instance); |
72 delete g_instance; | 85 delete g_instance; |
73 g_instance = NULL; | 86 g_instance = NULL; |
74 multi_user_mode_ = MULTI_PROFILE_MODE_UNINITIALIZED; | 87 multi_user_mode_ = MULTI_PROFILE_MODE_UNINITIALIZED; |
75 } | 88 } |
76 | 89 |
77 void MultiUserWindowManager::SetInstanceForTest( | 90 void MultiUserWindowManager::SetInstanceForTest( |
78 MultiUserWindowManager* instance, | 91 MultiUserWindowManager* instance, |
79 MultiProfileMode mode) { | 92 MultiProfileMode mode) { |
80 if (g_instance) | 93 if (g_instance) |
81 DeleteInstance(); | 94 DeleteInstance(); |
82 g_instance = instance; | 95 g_instance = instance; |
83 multi_user_mode_ = mode; | 96 multi_user_mode_ = mode; |
84 } | 97 } |
85 | 98 |
86 } // namespace chrome | 99 } // namespace chrome |
OLD | NEW |