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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 return; | 835 return; |
836 } | 836 } |
837 | 837 |
838 // Set kUseDefaultPinnedApps to false and use pinned apps list from prefs | 838 // Set kUseDefaultPinnedApps to false and use pinned apps list from prefs |
839 // from now on. | 839 // from now on. |
840 profile_->GetPrefs()->SetBoolean(prefs::kUseDefaultPinnedApps, false); | 840 profile_->GetPrefs()->SetBoolean(prefs::kUseDefaultPinnedApps, false); |
841 | 841 |
842 // Mutating kPinnedLauncherApps is going to notify us and trigger us to | 842 // Mutating kPinnedLauncherApps is going to notify us and trigger us to |
843 // process the change. We don't want that to happen so remove ourselves as a | 843 // process the change. We don't want that to happen so remove ourselves as a |
844 // listener. | 844 // listener. |
845 pref_change_registrar_.Remove(prefs::kPinnedLauncherApps, this); | 845 pref_change_registrar_.Remove(prefs::kPinnedLauncherApps); |
846 { | 846 { |
847 ListPrefUpdate updater(profile_->GetPrefs(), prefs::kPinnedLauncherApps); | 847 ListPrefUpdate updater(profile_->GetPrefs(), prefs::kPinnedLauncherApps); |
848 updater->Clear(); | 848 updater->Clear(); |
849 for (size_t i = 0; i < model_->items().size(); ++i) { | 849 for (size_t i = 0; i < model_->items().size(); ++i) { |
850 if (model_->items()[i].type == ash::TYPE_APP_SHORTCUT) { | 850 if (model_->items()[i].type == ash::TYPE_APP_SHORTCUT) { |
851 ash::LauncherID id = model_->items()[i].id; | 851 ash::LauncherID id = model_->items()[i].id; |
852 if (HasItemController(id) && IsPinned(id)) { | 852 if (HasItemController(id) && IsPinned(id)) { |
853 base::DictionaryValue* app_value = ash::CreateAppDict( | 853 base::DictionaryValue* app_value = ash::CreateAppDict( |
854 id_to_item_controller_map_[id]->app_id()); | 854 id_to_item_controller_map_[id]->app_id()); |
855 if (app_value) | 855 if (app_value) |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 new AppShortcutLauncherItemController(app_id, this); | 1072 new AppShortcutLauncherItemController(app_id, this); |
1073 ash::LauncherID launcher_id = InsertAppLauncherItem( | 1073 ash::LauncherID launcher_id = InsertAppLauncherItem( |
1074 controller, app_id, ash::STATUS_CLOSED, index); | 1074 controller, app_id, ash::STATUS_CLOSED, index); |
1075 return launcher_id; | 1075 return launcher_id; |
1076 } | 1076 } |
1077 | 1077 |
1078 bool ChromeLauncherController::HasItemController(ash::LauncherID id) const { | 1078 bool ChromeLauncherController::HasItemController(ash::LauncherID id) const { |
1079 return id_to_item_controller_map_.find(id) != | 1079 return id_to_item_controller_map_.find(id) != |
1080 id_to_item_controller_map_.end(); | 1080 id_to_item_controller_map_.end(); |
1081 } | 1081 } |
OLD | NEW |