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/android/bookmarks/partner_bookmarks_shim.h" | 5 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/memory/ptr_util.h" |
10 #include "base/values.h" | 12 #include "base/values.h" |
11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
13 #include "components/bookmarks/browser/bookmark_model.h" | 15 #include "components/bookmarks/browser/bookmark_model.h" |
14 #include "components/pref_registry/pref_registry_syncable.h" | 16 #include "components/pref_registry/pref_registry_syncable.h" |
15 #include "components/prefs/pref_service.h" | 17 #include "components/prefs/pref_service.h" |
16 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
17 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
18 | 20 |
19 using bookmarks::BookmarkNode; | 21 using bookmarks::BookmarkNode; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 277 |
276 void PartnerBookmarksShim::SaveNodeMapping() { | 278 void PartnerBookmarksShim::SaveNodeMapping() { |
277 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 279 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
278 if (!prefs_) | 280 if (!prefs_) |
279 return; | 281 return; |
280 | 282 |
281 base::ListValue list; | 283 base::ListValue list; |
282 for (NodeRenamingMap::const_iterator i = node_rename_remove_map_.begin(); | 284 for (NodeRenamingMap::const_iterator i = node_rename_remove_map_.begin(); |
283 i != node_rename_remove_map_.end(); | 285 i != node_rename_remove_map_.end(); |
284 ++i) { | 286 ++i) { |
285 base::DictionaryValue* dict = new base::DictionaryValue(); | 287 auto dict = base::MakeUnique<base::DictionaryValue>(); |
286 dict->SetString(kMappingUrl, i->first.url().spec()); | 288 dict->SetString(kMappingUrl, i->first.url().spec()); |
287 dict->SetString(kMappingProviderTitle, i->first.provider_title()); | 289 dict->SetString(kMappingProviderTitle, i->first.provider_title()); |
288 dict->SetString(kMappingTitle, i->second); | 290 dict->SetString(kMappingTitle, i->second); |
289 list.Append(dict); | 291 list.Append(std::move(dict)); |
290 } | 292 } |
291 prefs_->Set(prefs::kPartnerBookmarkMappings, list); | 293 prefs_->Set(prefs::kPartnerBookmarkMappings, list); |
292 } | 294 } |
OLD | NEW |