Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: chrome/browser/ui/app_list/app_list_syncable_service.cc

Issue 2845113002: Remove raw base::DictionaryValue::SetWithoutPathExpansion in //chrome (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/app_list/app_list_syncable_service.h" 5 #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 179
180 void UpdateSyncItemInLocalStorage( 180 void UpdateSyncItemInLocalStorage(
181 Profile* profile, 181 Profile* profile,
182 const AppListSyncableService::SyncItem* sync_item) { 182 const AppListSyncableService::SyncItem* sync_item) {
183 DictionaryPrefUpdate pref_update(profile->GetPrefs(), 183 DictionaryPrefUpdate pref_update(profile->GetPrefs(),
184 prefs::kAppListLocalState); 184 prefs::kAppListLocalState);
185 base::DictionaryValue* dict_item = nullptr; 185 base::DictionaryValue* dict_item = nullptr;
186 if (!pref_update->GetDictionaryWithoutPathExpansion(sync_item->item_id, 186 if (!pref_update->GetDictionaryWithoutPathExpansion(sync_item->item_id,
187 &dict_item)) { 187 &dict_item)) {
188 dict_item = new base::DictionaryValue(); 188 pref_update->SetWithoutPathExpansion(
189 pref_update->SetWithoutPathExpansion(sync_item->item_id, dict_item); 189 sync_item->item_id, base::MakeUnique<base::DictionaryValue>());
190 pref_update->GetDictionaryWithoutPathExpansion(sync_item->item_id,
191 &dict_item);
190 } 192 }
191 193
192 dict_item->SetString(kNameKey, sync_item->item_name); 194 dict_item->SetString(kNameKey, sync_item->item_name);
193 dict_item->SetString(kParentIdKey, sync_item->parent_id); 195 dict_item->SetString(kParentIdKey, sync_item->parent_id);
194 dict_item->SetString(kPositionKey,sync_item->item_ordinal.IsValid() ? 196 dict_item->SetString(kPositionKey,sync_item->item_ordinal.IsValid() ?
195 sync_item->item_ordinal.ToInternalValue() : std::string()); 197 sync_item->item_ordinal.ToInternalValue() : std::string());
196 dict_item->SetString(kPinPositionKey, sync_item->item_pin_ordinal.IsValid() ? 198 dict_item->SetString(kPinPositionKey, sync_item->item_pin_ordinal.IsValid() ?
197 sync_item->item_pin_ordinal.ToInternalValue() : std::string()); 199 sync_item->item_pin_ordinal.ToInternalValue() : std::string());
198 dict_item->SetInteger(kTypeKey, static_cast<int>(sync_item->item_type)); 200 dict_item->SetInteger(kTypeKey, static_cast<int>(sync_item->item_type));
199 } 201 }
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 res += " { " + item_name + " }"; 1233 res += " { " + item_name + " }";
1232 res += " [" + item_ordinal.ToDebugString() + "]"; 1234 res += " [" + item_ordinal.ToDebugString() + "]";
1233 if (!parent_id.empty()) 1235 if (!parent_id.empty())
1234 res += " <" + parent_id.substr(0, 8) + ">"; 1236 res += " <" + parent_id.substr(0, 8) + ">";
1235 res += " [" + item_pin_ordinal.ToDebugString() + "]"; 1237 res += " [" + item_pin_ordinal.ToDebugString() + "]";
1236 } 1238 }
1237 return res; 1239 return res;
1238 } 1240 }
1239 1241
1240 } // namespace app_list 1242 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698