| 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" |
| 11 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 11 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/browser_tabstrip.h" | 14 #include "chrome/browser/ui/browser_tabstrip.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/settings_window_manager.h" | 16 #include "chrome/browser/ui/settings_window_manager.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "grit/ash_resources.h" | 18 #include "grit/ash_resources.h" |
| 19 #include "grit/generated_resources.h" |
| 20 #include "ui/base/l10n/l10n_util.h" |
| 19 | 21 |
| 20 MultiProfileBrowserStatusMonitor::MultiProfileBrowserStatusMonitor( | 22 MultiProfileBrowserStatusMonitor::MultiProfileBrowserStatusMonitor( |
| 21 ChromeLauncherController* launcher_controller) | 23 ChromeLauncherController* launcher_controller) |
| 22 : BrowserStatusMonitor(launcher_controller), | 24 : BrowserStatusMonitor(launcher_controller), |
| 23 launcher_controller_(launcher_controller) { | 25 launcher_controller_(launcher_controller) { |
| 24 } | 26 } |
| 25 | 27 |
| 26 MultiProfileBrowserStatusMonitor::~MultiProfileBrowserStatusMonitor() { | 28 MultiProfileBrowserStatusMonitor::~MultiProfileBrowserStatusMonitor() { |
| 27 } | 29 } |
| 28 | 30 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // icons for windows associated with the current profile. | 81 // icons for windows associated with the current profile. |
| 80 for (BrowserList::const_iterator it = browser_list->begin(); | 82 for (BrowserList::const_iterator it = browser_list->begin(); |
| 81 it != browser_list->end(); ++it) { | 83 it != browser_list->end(); ++it) { |
| 82 Browser* browser = *it; | 84 Browser* browser = *it; |
| 83 if (!chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser( | 85 if (!chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser( |
| 84 browser)) { | 86 browser)) { |
| 85 continue; | 87 continue; |
| 86 } | 88 } |
| 87 if (multi_user_util::IsProfileFromActiveUser(browser->profile())) { | 89 if (multi_user_util::IsProfileFromActiveUser(browser->profile())) { |
| 88 ash::SetShelfItemDetailsForDialogWindow( | 90 ash::SetShelfItemDetailsForDialogWindow( |
| 89 browser->window()->GetNativeWindow(), | 91 browser->window()->GetNativeWindow(), |
| 90 IDR_ASH_SHELF_ICON_SETTINGS); | 92 IDR_ASH_SHELF_ICON_SETTINGS, |
| 93 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); |
| 91 } else { | 94 } else { |
| 92 ash::ClearShelfItemDetailsForWindow(browser->window()->GetNativeWindow()); | 95 ash::ClearShelfItemDetailsForWindow(browser->window()->GetNativeWindow()); |
| 93 } | 96 } |
| 94 } | 97 } |
| 95 | 98 |
| 96 // Update the browser state since some of the removals / adds above might have | 99 // Update the browser state since some of the removals / adds above might have |
| 97 // had an impact on the browser item. | 100 // had an impact on the browser item. |
| 98 UpdateBrowserItemState(); | 101 UpdateBrowserItemState(); |
| 99 } | 102 } |
| 100 | 103 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 130 | 133 |
| 131 void MultiProfileBrowserStatusMonitor::DisconnectV1AppFromLauncher( | 134 void MultiProfileBrowserStatusMonitor::DisconnectV1AppFromLauncher( |
| 132 Browser* browser) { | 135 Browser* browser) { |
| 133 // 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 |
| 134 // the launcher item. | 137 // the launcher item. |
| 135 launcher_controller_->UpdateAppState( | 138 launcher_controller_->UpdateAppState( |
| 136 browser->tab_strip_model()->GetActiveWebContents(), | 139 browser->tab_strip_model()->GetActiveWebContents(), |
| 137 ChromeLauncherController::APP_STATE_REMOVED); | 140 ChromeLauncherController::APP_STATE_REMOVED); |
| 138 BrowserStatusMonitor::RemoveV1AppFromShelf(browser); | 141 BrowserStatusMonitor::RemoveV1AppFromShelf(browser); |
| 139 } | 142 } |
| OLD | NEW |