| 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/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 #endif | 372 #endif |
| 373 | 373 |
| 374 // Right now ash::Shell isn't created for tests. | 374 // Right now ash::Shell isn't created for tests. |
| 375 // TODO(mukai): Allows it to observe display change and write tests. | 375 // TODO(mukai): Allows it to observe display change and write tests. |
| 376 if (ash::Shell::HasInstance()) { | 376 if (ash::Shell::HasInstance()) { |
| 377 ash::Shell::GetInstance()->display_controller()->AddObserver(this); | 377 ash::Shell::GetInstance()->display_controller()->AddObserver(this); |
| 378 item_delegate_manager_ = | 378 item_delegate_manager_ = |
| 379 ash::Shell::GetInstance()->shelf_item_delegate_manager(); | 379 ash::Shell::GetInstance()->shelf_item_delegate_manager(); |
| 380 } | 380 } |
| 381 | 381 |
| 382 notification_registrar_.Add(this, | 382 notification_registrar_.Add( |
| 383 chrome::NOTIFICATION_EXTENSION_LOADED, | 383 this, |
| 384 content::Source<Profile>(profile_)); | 384 chrome::NOTIFICATION_EXTENSION_LOADED, |
| 385 notification_registrar_.Add(this, | 385 content::Source<Profile>(profile_)); |
| 386 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 386 notification_registrar_.Add( |
| 387 content::Source<Profile>(profile_)); | 387 this, |
| 388 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 389 content::Source<Profile>(profile_)); |
| 388 } | 390 } |
| 389 | 391 |
| 390 ChromeLauncherController::~ChromeLauncherController() { | 392 ChromeLauncherController::~ChromeLauncherController() { |
| 391 // Reset the BrowserStatusMonitor as it has a weak pointer to this. | 393 // Reset the BrowserStatusMonitor as it has a weak pointer to this. |
| 392 browser_status_monitor_.reset(); | 394 browser_status_monitor_.reset(); |
| 393 | 395 |
| 394 // Reset the app window controller here since it has a weak pointer to this. | 396 // Reset the app window controller here since it has a weak pointer to this. |
| 395 app_window_controller_.reset(); | 397 app_window_controller_.reset(); |
| 396 | 398 |
| 397 for (std::set<ash::Shelf*>::iterator iter = shelves_.begin(); | 399 for (std::set<ash::Shelf*>::iterator iter = shelves_.begin(); |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 content::Details<const Extension>(details).ptr(); | 1161 content::Details<const Extension>(details).ptr(); |
| 1160 if (IsAppPinned(extension->id())) { | 1162 if (IsAppPinned(extension->id())) { |
| 1161 // Clear and re-fetch to ensure icon is up-to-date. | 1163 // Clear and re-fetch to ensure icon is up-to-date. |
| 1162 app_icon_loader_->ClearImage(extension->id()); | 1164 app_icon_loader_->ClearImage(extension->id()); |
| 1163 app_icon_loader_->FetchImage(extension->id()); | 1165 app_icon_loader_->FetchImage(extension->id()); |
| 1164 } | 1166 } |
| 1165 | 1167 |
| 1166 UpdateAppLaunchersFromPref(); | 1168 UpdateAppLaunchersFromPref(); |
| 1167 break; | 1169 break; |
| 1168 } | 1170 } |
| 1169 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 1171 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| 1170 const content::Details<UnloadedExtensionInfo>& unload_info(details); | 1172 const content::Details<UnloadedExtensionInfo>& unload_info(details); |
| 1171 const Extension* extension = unload_info->extension; | 1173 const Extension* extension = unload_info->extension; |
| 1172 const std::string& id = extension->id(); | 1174 const std::string& id = extension->id(); |
| 1173 // Since we might have windowed apps of this type which might have | 1175 // Since we might have windowed apps of this type which might have |
| 1174 // outstanding locks which needs to be removed. | 1176 // outstanding locks which needs to be removed. |
| 1175 if (GetShelfIDForAppID(id) && | 1177 if (GetShelfIDForAppID(id) && |
| 1176 unload_info->reason == UnloadedExtensionInfo::REASON_UNINSTALL) { | 1178 unload_info->reason == UnloadedExtensionInfo::REASON_UNINSTALL) { |
| 1177 CloseWindowedAppsFromRemovedExtension(id); | 1179 CloseWindowedAppsFromRemovedExtension(id); |
| 1178 } | 1180 } |
| 1179 | 1181 |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 } | 2057 } |
| 2056 | 2058 |
| 2057 void ChromeLauncherController::ReleaseProfile() { | 2059 void ChromeLauncherController::ReleaseProfile() { |
| 2058 if (app_sync_ui_state_) | 2060 if (app_sync_ui_state_) |
| 2059 app_sync_ui_state_->RemoveObserver(this); | 2061 app_sync_ui_state_->RemoveObserver(this); |
| 2060 | 2062 |
| 2061 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2063 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
| 2062 | 2064 |
| 2063 pref_change_registrar_.RemoveAll(); | 2065 pref_change_registrar_.RemoveAll(); |
| 2064 } | 2066 } |
| OLD | NEW |