| 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 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // PartnerBookmarksShim is responsible to applying and storing the user changes | 28 // PartnerBookmarksShim is responsible to applying and storing the user changes |
| 29 // (deletions/renames) in the user profile, thus keeping the hierarchy intact. | 29 // (deletions/renames) in the user profile, thus keeping the hierarchy intact. |
| 30 struct PartnerModelKeeper { | 30 struct PartnerModelKeeper { |
| 31 std::unique_ptr<BookmarkNode> partner_bookmarks_root; | 31 std::unique_ptr<BookmarkNode> partner_bookmarks_root; |
| 32 bool loaded; | 32 bool loaded; |
| 33 | 33 |
| 34 PartnerModelKeeper() | 34 PartnerModelKeeper() |
| 35 : loaded(false) {} | 35 : loaded(false) {} |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 base::LazyInstance<PartnerModelKeeper> g_partner_model_keeper = | 38 base::LazyInstance<PartnerModelKeeper>::DestructorAtExit |
| 39 LAZY_INSTANCE_INITIALIZER; | 39 g_partner_model_keeper = LAZY_INSTANCE_INITIALIZER; |
| 40 | 40 |
| 41 const void* const kPartnerBookmarksShimUserDataKey = | 41 const void* const kPartnerBookmarksShimUserDataKey = |
| 42 &kPartnerBookmarksShimUserDataKey; | 42 &kPartnerBookmarksShimUserDataKey; |
| 43 | 43 |
| 44 // Dictionary keys for entries in the kPartnerBookmarksMapping pref. | 44 // Dictionary keys for entries in the kPartnerBookmarksMapping pref. |
| 45 const char kMappingUrl[] = "url"; | 45 const char kMappingUrl[] = "url"; |
| 46 const char kMappingProviderTitle[] = "provider_title"; | 46 const char kMappingProviderTitle[] = "provider_title"; |
| 47 const char kMappingTitle[] = "mapped_title"; | 47 const char kMappingTitle[] = "mapped_title"; |
| 48 | 48 |
| 49 bool g_disable_partner_bookmarks_editing = false; | 49 bool g_disable_partner_bookmarks_editing = false; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 i != node_rename_remove_map_.end(); | 283 i != node_rename_remove_map_.end(); |
| 284 ++i) { | 284 ++i) { |
| 285 base::DictionaryValue* dict = new base::DictionaryValue(); | 285 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 286 dict->SetString(kMappingUrl, i->first.url().spec()); | 286 dict->SetString(kMappingUrl, i->first.url().spec()); |
| 287 dict->SetString(kMappingProviderTitle, i->first.provider_title()); | 287 dict->SetString(kMappingProviderTitle, i->first.provider_title()); |
| 288 dict->SetString(kMappingTitle, i->second); | 288 dict->SetString(kMappingTitle, i->second); |
| 289 list.Append(dict); | 289 list.Append(dict); |
| 290 } | 290 } |
| 291 prefs_->Set(prefs::kPartnerBookmarkMappings, list); | 291 prefs_->Set(prefs::kPartnerBookmarkMappings, list); |
| 292 } | 292 } |
| OLD | NEW |