| 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/launcher/multi_profile_browser_status_monitor.h" | 5 #include "chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h" |
| 6 | 6 |
| 7 #include "ash/shelf/shelf_util.h" | 7 #include "ash/shelf/shelf_util.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 MultiProfileBrowserStatusMonitor::MultiProfileBrowserStatusMonitor( | 22 MultiProfileBrowserStatusMonitor::MultiProfileBrowserStatusMonitor( |
| 23 ChromeLauncherController* launcher_controller) | 23 ChromeLauncherController* launcher_controller) |
| 24 : BrowserStatusMonitor(launcher_controller), | 24 : BrowserStatusMonitor(launcher_controller), |
| 25 launcher_controller_(launcher_controller) { | 25 launcher_controller_(launcher_controller) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 MultiProfileBrowserStatusMonitor::~MultiProfileBrowserStatusMonitor() { | 28 MultiProfileBrowserStatusMonitor::~MultiProfileBrowserStatusMonitor() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 void MultiProfileBrowserStatusMonitor::ActiveUserChanged( | 31 void MultiProfileBrowserStatusMonitor::ActiveUserChanged( |
| 32 const std::string& user_email) { | 32 const user_manager::UserID& user_id) { |
| 33 // Handle windowed apps. | 33 // Handle windowed apps. |
| 34 for (AppList::iterator it = app_list_.begin(); it != app_list_.end(); ++it) { | 34 for (AppList::iterator it = app_list_.begin(); it != app_list_.end(); ++it) { |
| 35 bool owned = multi_user_util::IsProfileFromActiveUser((*it)->profile()); | 35 bool owned = multi_user_util::IsProfileFromActiveUser((*it)->profile()); |
| 36 bool shown = IsV1AppInShelf(*it); | 36 bool shown = IsV1AppInShelf(*it); |
| 37 if (owned && !shown) | 37 if (owned && !shown) |
| 38 ConnectV1AppToLauncher(*it); | 38 ConnectV1AppToLauncher(*it); |
| 39 else if (!owned && shown) | 39 else if (!owned && shown) |
| 40 DisconnectV1AppFromLauncher(*it); | 40 DisconnectV1AppFromLauncher(*it); |
| 41 } | 41 } |
| 42 | 42 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 void MultiProfileBrowserStatusMonitor::DisconnectV1AppFromLauncher( | 134 void MultiProfileBrowserStatusMonitor::DisconnectV1AppFromLauncher( |
| 135 Browser* browser) { | 135 Browser* browser) { |
| 136 // Removing a V1 app from the launcher requires to remove the content and | 136 // Removing a V1 app from the launcher requires to remove the content and |
| 137 // the launcher item. | 137 // the launcher item. |
| 138 launcher_controller_->UpdateAppState( | 138 launcher_controller_->UpdateAppState( |
| 139 browser->tab_strip_model()->GetActiveWebContents(), | 139 browser->tab_strip_model()->GetActiveWebContents(), |
| 140 ChromeLauncherController::APP_STATE_REMOVED); | 140 ChromeLauncherController::APP_STATE_REMOVED); |
| 141 BrowserStatusMonitor::RemoveV1AppFromShelf(browser); | 141 BrowserStatusMonitor::RemoveV1AppFromShelf(browser); |
| 142 } | 142 } |
| OLD | NEW |