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 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 58 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
59 | 59 |
60 PartnerBookmarksShim* data = | 60 PartnerBookmarksShim* data = |
61 static_cast<PartnerBookmarksShim*>( | 61 static_cast<PartnerBookmarksShim*>( |
62 browser_context->GetUserData(kPartnerBookmarksShimUserDataKey)); | 62 browser_context->GetUserData(kPartnerBookmarksShimUserDataKey)); |
63 if (data) | 63 if (data) |
64 return data; | 64 return data; |
65 | 65 |
66 data = new PartnerBookmarksShim( | 66 data = new PartnerBookmarksShim( |
67 Profile::FromBrowserContext(browser_context)->GetPrefs()); | 67 Profile::FromBrowserContext(browser_context)->GetPrefs()); |
68 browser_context->SetUserData(kPartnerBookmarksShimUserDataKey, data); | 68 browser_context->SetUserData(kPartnerBookmarksShimUserDataKey, |
| 69 base::WrapUnique(data)); |
69 data->ReloadNodeMapping(); | 70 data->ReloadNodeMapping(); |
70 return data; | 71 return data; |
71 } | 72 } |
72 | 73 |
73 // static | 74 // static |
74 void PartnerBookmarksShim::RegisterProfilePrefs( | 75 void PartnerBookmarksShim::RegisterProfilePrefs( |
75 user_prefs::PrefRegistrySyncable* registry) { | 76 user_prefs::PrefRegistrySyncable* registry) { |
76 registry->RegisterListPref(prefs::kPartnerBookmarkMappings); | 77 registry->RegisterListPref(prefs::kPartnerBookmarkMappings); |
77 } | 78 } |
78 | 79 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 i != node_rename_remove_map_.end(); | 286 i != node_rename_remove_map_.end(); |
286 ++i) { | 287 ++i) { |
287 auto dict = base::MakeUnique<base::DictionaryValue>(); | 288 auto dict = base::MakeUnique<base::DictionaryValue>(); |
288 dict->SetString(kMappingUrl, i->first.url().spec()); | 289 dict->SetString(kMappingUrl, i->first.url().spec()); |
289 dict->SetString(kMappingProviderTitle, i->first.provider_title()); | 290 dict->SetString(kMappingProviderTitle, i->first.provider_title()); |
290 dict->SetString(kMappingTitle, i->second); | 291 dict->SetString(kMappingTitle, i->second); |
291 list.Append(std::move(dict)); | 292 list.Append(std::move(dict)); |
292 } | 293 } |
293 prefs_->Set(prefs::kPartnerBookmarkMappings, list); | 294 prefs_->Set(prefs::kPartnerBookmarkMappings, list); |
294 } | 295 } |
OLD | NEW |