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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
12 #include "components/bookmarks/browser/bookmark_model.h" | 12 #include "components/bookmarks/browser/bookmark_model.h" |
13 #include "components/pref_registry/pref_registry_syncable.h" | 13 #include "components/pref_registry/pref_registry_syncable.h" |
14 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 | 16 |
| 17 using bookmarks::BookmarkNode; |
17 using content::BrowserThread; | 18 using content::BrowserThread; |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 // PartnerModelKeeper is used as a singleton to store an immutable hierarchy | 22 // PartnerModelKeeper is used as a singleton to store an immutable hierarchy |
22 // of partner bookmarks. The hierarchy is retrieved from the partner bookmarks | 23 // of partner bookmarks. The hierarchy is retrieved from the partner bookmarks |
23 // provider and doesn't depend on the user profile. | 24 // provider and doesn't depend on the user profile. |
24 // The retrieved hierarchy persists | 25 // The retrieved hierarchy persists |
25 // PartnerBookmarksShim is responsible to applying and storing the user changes | 26 // PartnerBookmarksShim is responsible to applying and storing the user changes |
26 // (deletions/renames) in the user profile, thus keeping the hierarchy intact. | 27 // (deletions/renames) in the user profile, thus keeping the hierarchy intact. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 i != node_rename_remove_map_.end(); | 281 i != node_rename_remove_map_.end(); |
281 ++i) { | 282 ++i) { |
282 base::DictionaryValue* dict = new base::DictionaryValue(); | 283 base::DictionaryValue* dict = new base::DictionaryValue(); |
283 dict->SetString(kMappingUrl, i->first.url().spec()); | 284 dict->SetString(kMappingUrl, i->first.url().spec()); |
284 dict->SetString(kMappingProviderTitle, i->first.provider_title()); | 285 dict->SetString(kMappingProviderTitle, i->first.provider_title()); |
285 dict->SetString(kMappingTitle, i->second); | 286 dict->SetString(kMappingTitle, i->second); |
286 list.Append(dict); | 287 list.Append(dict); |
287 } | 288 } |
288 prefs_->Set(prefs::kPartnerBookmarkMappings, list); | 289 prefs_->Set(prefs::kPartnerBookmarkMappings, list); |
289 } | 290 } |
OLD | NEW |