| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/launcher/launcher_model.h" | 10 #include "ash/launcher/launcher_model.h" |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 } | 777 } |
| 778 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 778 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
| 779 const content::Details<extensions::UnloadedExtensionInfo> unload_info( | 779 const content::Details<extensions::UnloadedExtensionInfo> unload_info( |
| 780 details); | 780 details); |
| 781 const Extension* extension = unload_info->extension; | 781 const Extension* extension = unload_info->extension; |
| 782 if (IsAppPinned(extension->id())) | 782 if (IsAppPinned(extension->id())) |
| 783 DoUnpinAppsWithID(extension->id()); | 783 DoUnpinAppsWithID(extension->id()); |
| 784 app_icon_loader_->ClearImage(extension->id()); | 784 app_icon_loader_->ClearImage(extension->id()); |
| 785 break; | 785 break; |
| 786 } | 786 } |
| 787 case chrome::NOTIFICATION_PREF_CHANGED: { | |
| 788 const std::string& pref_name( | |
| 789 *content::Details<std::string>(details).ptr()); | |
| 790 if (pref_name == prefs::kPinnedLauncherApps) { | |
| 791 UpdateAppLaunchersFromPref(); | |
| 792 } else if (pref_name == prefs::kShelfAlignmentLocal) { | |
| 793 SetShelfAlignmentFromPrefs(); | |
| 794 } else if (pref_name == prefs::kShelfAutoHideBehaviorLocal) { | |
| 795 SetShelfAutoHideBehaviorFromPrefs(); | |
| 796 } else { | |
| 797 NOTREACHED() << "Unexpected pref change for " << pref_name; | |
| 798 } | |
| 799 break; | |
| 800 } | |
| 801 default: | 787 default: |
| 802 NOTREACHED() << "Unexpected notification type=" << type; | 788 NOTREACHED() << "Unexpected notification type=" << type; |
| 803 } | 789 } |
| 804 } | 790 } |
| 805 | 791 |
| 792 void ChromeLauncherController::OnPreferenceChanged( |
| 793 PrefServiceBase* service, |
| 794 const std::string& pref_name) { |
| 795 if (pref_name == prefs::kPinnedLauncherApps) { |
| 796 UpdateAppLaunchersFromPref(); |
| 797 } else if (pref_name == prefs::kShelfAlignmentLocal) { |
| 798 SetShelfAlignmentFromPrefs(); |
| 799 } else if (pref_name == prefs::kShelfAutoHideBehaviorLocal) { |
| 800 SetShelfAutoHideBehaviorFromPrefs(); |
| 801 } else { |
| 802 NOTREACHED() << "Unexpected pref change for " << pref_name; |
| 803 } |
| 804 } |
| 805 |
| 806 void ChromeLauncherController::OnShelfAlignmentChanged() { | 806 void ChromeLauncherController::OnShelfAlignmentChanged() { |
| 807 const char* pref_value = NULL; | 807 const char* pref_value = NULL; |
| 808 // TODO(oshima): Support multiple displays. | 808 // TODO(oshima): Support multiple displays. |
| 809 switch (ash::Shell::GetInstance()->GetShelfAlignment( | 809 switch (ash::Shell::GetInstance()->GetShelfAlignment( |
| 810 ash::Shell::GetPrimaryRootWindow())) { | 810 ash::Shell::GetPrimaryRootWindow())) { |
| 811 case ash::SHELF_ALIGNMENT_BOTTOM: | 811 case ash::SHELF_ALIGNMENT_BOTTOM: |
| 812 pref_value = ash::kShelfAlignmentBottom; | 812 pref_value = ash::kShelfAlignmentBottom; |
| 813 break; | 813 break; |
| 814 case ash::SHELF_ALIGNMENT_LEFT: | 814 case ash::SHELF_ALIGNMENT_LEFT: |
| 815 pref_value = ash::kShelfAlignmentLeft; | 815 pref_value = ash::kShelfAlignmentLeft; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 void ChromeLauncherController::StopLoadingAnimation() { | 1122 void ChromeLauncherController::StopLoadingAnimation() { |
| 1123 DCHECK(observed_sync_service_); | 1123 DCHECK(observed_sync_service_); |
| 1124 | 1124 |
| 1125 model_->SetStatus(ash::LauncherModel::STATUS_NORMAL); | 1125 model_->SetStatus(ash::LauncherModel::STATUS_NORMAL); |
| 1126 loading_timer_.Stop(); | 1126 loading_timer_.Stop(); |
| 1127 observed_sync_service_->RemoveObserver(this); | 1127 observed_sync_service_->RemoveObserver(this); |
| 1128 observed_sync_service_ = NULL; | 1128 observed_sync_service_ = NULL; |
| 1129 } | 1129 } |
| OLD | NEW |