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_chromeos.h" | 5 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
6 | 6 |
7 #include "apps/app_window.h" | 7 #include "apps/app_window.h" |
8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/desktop_background/user_wallpaper_delegate.h" | 10 #include "ash/desktop_background/user_wallpaper_delegate.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 bool MultiUserWindowManagerChromeOS::IsWindowOnDesktopOfUser( | 358 bool MultiUserWindowManagerChromeOS::IsWindowOnDesktopOfUser( |
359 aura::Window* window, | 359 aura::Window* window, |
360 const std::string& user_id) { | 360 const std::string& user_id) { |
361 const std::string& presenting_user = GetUserPresentingWindow(window); | 361 const std::string& presenting_user = GetUserPresentingWindow(window); |
362 return presenting_user.empty() || presenting_user == user_id; | 362 return presenting_user.empty() || presenting_user == user_id; |
363 } | 363 } |
364 | 364 |
365 bool MultiUserWindowManagerChromeOS::ShouldShowAvatar(aura::Window* window) { | |
366 // Note: In case of the M-31 mode the window manager won't exist. | |
367 if (GetMultiProfileMode() == MULTI_PROFILE_MODE_SEPARATED) { | |
368 // If the window is shown on a different desktop than the user, it should | |
369 // have the avatar icon. | |
370 | |
371 // Note: When the window manager the window is either on it's owners desktop | |
372 // (and shows no icon) or it is now (in which it will show an icon). So we | |
373 // can return here. | |
Mr4D (OOO till 08-26)
2014/03/13 00:08:15
I think you can remove line 370-373.
oshima
2014/03/13 01:02:53
Done.
| |
374 return !IsWindowOnDesktopOfUser(window, GetWindowOwner(window)); | |
375 } | |
376 return false; | |
377 } | |
378 | |
365 const std::string& MultiUserWindowManagerChromeOS::GetUserPresentingWindow( | 379 const std::string& MultiUserWindowManagerChromeOS::GetUserPresentingWindow( |
366 aura::Window* window) { | 380 aura::Window* window) { |
367 WindowToEntryMap::iterator it = window_to_entry_.find(window); | 381 WindowToEntryMap::iterator it = window_to_entry_.find(window); |
368 // If the window is not owned by anyone it is shown on all desktops and we | 382 // If the window is not owned by anyone it is shown on all desktops and we |
369 // return the empty string. | 383 // return the empty string. |
370 if (it == window_to_entry_.end()) | 384 if (it == window_to_entry_.end()) |
371 return base::EmptyString(); | 385 return base::EmptyString(); |
372 // Otherwise we ask the object for its desktop. | 386 // Otherwise we ask the object for its desktop. |
373 return it->second->show_for_user(); | 387 return it->second->show_for_user(); |
374 } | 388 } |
375 | 389 |
376 void MultiUserWindowManagerChromeOS::AddUser(Profile* profile) { | 390 void MultiUserWindowManagerChromeOS::AddUser(content::BrowserContext* context) { |
391 Profile* profile = Profile::FromBrowserContext(context); | |
377 const std::string& user_id = multi_user_util::GetUserIDFromProfile(profile); | 392 const std::string& user_id = multi_user_util::GetUserIDFromProfile(profile); |
378 if (user_id_to_app_observer_.find(user_id) != user_id_to_app_observer_.end()) | 393 if (user_id_to_app_observer_.find(user_id) != user_id_to_app_observer_.end()) |
379 return; | 394 return; |
380 | 395 |
381 user_id_to_app_observer_[user_id] = new AppObserver(user_id); | 396 user_id_to_app_observer_[user_id] = new AppObserver(user_id); |
382 apps::AppWindowRegistry::Get(profile) | 397 apps::AppWindowRegistry::Get(profile) |
383 ->AddObserver(user_id_to_app_observer_[user_id]); | 398 ->AddObserver(user_id_to_app_observer_[user_id]); |
384 | 399 |
385 // Account all existing application windows of this user accordingly. | 400 // Account all existing application windows of this user accordingly. |
386 const apps::AppWindowRegistry::AppWindowList& app_windows = | 401 const apps::AppWindowRegistry::AppWindowList& app_windows = |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
862 window->Show(); | 877 window->Show(); |
863 else | 878 else |
864 window->Hide(); | 879 window->Hide(); |
865 | 880 |
866 // Make sure that animations have no influence on the window state after the | 881 // Make sure that animations have no influence on the window state after the |
867 // call. | 882 // call. |
868 DCHECK_EQ(visible, window->IsVisible()); | 883 DCHECK_EQ(visible, window->IsVisible()); |
869 } | 884 } |
870 | 885 |
871 } // namespace chrome | 886 } // namespace chrome |
OLD | NEW |