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 24 matching lines...) Expand all Loading... |
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 |
43 // Handle apps in browser tabs: Add the new applications. | 43 // Handle apps in browser tabs: Add the new applications. |
44 BrowserList* browser_list = | 44 BrowserList* browser_list = |
45 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 45 BrowserList::GetInstance(ui::HOST_DESKTOP_TYPE_ASH); |
46 | 46 |
47 // Remove old (tabbed V1) applications. | 47 // Remove old (tabbed V1) applications. |
48 for (BrowserList::const_iterator it = browser_list->begin(); | 48 for (BrowserList::const_iterator it = browser_list->begin(); |
49 it != browser_list->end(); ++it) { | 49 it != browser_list->end(); ++it) { |
50 Browser* browser = *it; | 50 Browser* browser = *it; |
51 if (!browser->is_app() && | 51 if (!browser->is_app() && |
52 browser->is_type_tabbed() && | 52 browser->is_type_tabbed() && |
53 !multi_user_util::IsProfileFromActiveUser(browser->profile())) { | 53 !multi_user_util::IsProfileFromActiveUser(browser->profile())) { |
54 for (int i = 0; i < browser->tab_strip_model()->count(); ++i) { | 54 for (int i = 0; i < browser->tab_strip_model()->count(); ++i) { |
55 launcher_controller_->UpdateAppState( | 55 launcher_controller_->UpdateAppState( |
(...skipping 77 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 |