| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/app_list/app_list_prefs.h" | 5 #include "chrome/browser/ui/app_list/app_list_prefs.h" |
| 6 #include "chrome/browser/ui/app_list/app_list_prefs_factory.h" | 6 #include "chrome/browser/ui/app_list/app_list_prefs_factory.h" |
| 7 #include "components/pref_registry/pref_registry_syncable.h" | 7 #include "components/pref_registry/pref_registry_syncable.h" |
| 8 #include "components/prefs/pref_service.h" | 8 #include "components/prefs/pref_service.h" |
| 9 #include "components/prefs/scoped_user_pref_update.h" | 9 #include "components/prefs/scoped_user_pref_update.h" |
| 10 | 10 |
| 11 namespace app_list { | 11 namespace app_list { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // App list ordering and folder data. | 15 // App list ordering and folder data. |
| 16 const char kPrefModel[] = "app_list.model"; | 16 const char kPrefModel[] = "app_list.model"; |
| 17 | 17 |
| 18 const char kModelItemPosition[] = "position"; | 18 const char kModelItemPosition[] = "position"; |
| 19 const char kModelItemType[] = "item_type"; | 19 const char kModelItemType[] = "item_type"; |
| 20 const char kModelItemParentId[] = "parent_id"; | 20 const char kModelItemParentId[] = "parent_id"; |
| 21 const char kModelItemName[] = "name"; | 21 const char kModelItemName[] = "name"; |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 // AppListInfo | 25 // AppListInfo |
| 26 | 26 |
| 27 AppListPrefs::AppListInfo::AppListInfo() : item_type(ITEM_TYPE_INVALID) { | 27 AppListPrefs::AppListInfo::AppListInfo() : item_type(ITEM_TYPE_INVALID) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 AppListPrefs::AppListInfo::AppListInfo(const AppListInfo& other) = default; |
| 31 |
| 30 AppListPrefs::AppListInfo::~AppListInfo() { | 32 AppListPrefs::AppListInfo::~AppListInfo() { |
| 31 } | 33 } |
| 32 | 34 |
| 33 scoped_ptr<base::DictionaryValue> | 35 scoped_ptr<base::DictionaryValue> |
| 34 AppListPrefs::AppListInfo::CreateDictFromAppListInfo() const { | 36 AppListPrefs::AppListInfo::CreateDictFromAppListInfo() const { |
| 35 scoped_ptr<base::DictionaryValue> item_dict(new base::DictionaryValue()); | 37 scoped_ptr<base::DictionaryValue> item_dict(new base::DictionaryValue()); |
| 36 item_dict->SetString(kModelItemPosition, position.ToInternalValue()); | 38 item_dict->SetString(kModelItemPosition, position.ToInternalValue()); |
| 37 item_dict->SetString(kModelItemParentId, parent_id); | 39 item_dict->SetString(kModelItemParentId, parent_id); |
| 38 item_dict->SetString(kModelItemName, name); | 40 item_dict->SetString(kModelItemName, name); |
| 39 item_dict->SetInteger(kModelItemType, item_type); | 41 item_dict->SetInteger(kModelItemType, item_type); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 (*out)[it.key()] = *AppListInfo::CreateAppListInfoFromDict(item_dict); | 120 (*out)[it.key()] = *AppListInfo::CreateAppListInfoFromDict(item_dict); |
| 119 } | 121 } |
| 120 } | 122 } |
| 121 | 123 |
| 122 void AppListPrefs::DeleteAppListInfo(const std::string& id) { | 124 void AppListPrefs::DeleteAppListInfo(const std::string& id) { |
| 123 DictionaryPrefUpdate model_dict(pref_service_, kPrefModel); | 125 DictionaryPrefUpdate model_dict(pref_service_, kPrefModel); |
| 124 model_dict->Remove(id, NULL); | 126 model_dict->Remove(id, NULL); |
| 125 } | 127 } |
| 126 | 128 |
| 127 } // namespace app_list | 129 } // namespace app_list |
| OLD | NEW |