| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 return; | 246 return; |
| 247 | 247 |
| 248 const base::ListValue* list = | 248 const base::ListValue* list = |
| 249 prefs_->GetList(prefs::kPartnerBookmarkMappings); | 249 prefs_->GetList(prefs::kPartnerBookmarkMappings); |
| 250 if (!list) | 250 if (!list) |
| 251 return; | 251 return; |
| 252 | 252 |
| 253 for (base::ListValue::const_iterator it = list->begin(); | 253 for (base::ListValue::const_iterator it = list->begin(); |
| 254 it != list->end(); ++it) { | 254 it != list->end(); ++it) { |
| 255 const base::DictionaryValue* dict = NULL; | 255 const base::DictionaryValue* dict = NULL; |
| 256 if (!*it || !(*it)->GetAsDictionary(&dict)) { | 256 if (!it->GetAsDictionary(&dict)) { |
| 257 NOTREACHED(); | 257 NOTREACHED(); |
| 258 continue; | 258 continue; |
| 259 } | 259 } |
| 260 | 260 |
| 261 std::string url; | 261 std::string url; |
| 262 base::string16 provider_title; | 262 base::string16 provider_title; |
| 263 base::string16 mapped_title; | 263 base::string16 mapped_title; |
| 264 if (!dict->GetString(kMappingUrl, &url) || | 264 if (!dict->GetString(kMappingUrl, &url) || |
| 265 !dict->GetString(kMappingProviderTitle, &provider_title) || | 265 !dict->GetString(kMappingProviderTitle, &provider_title) || |
| 266 !dict->GetString(kMappingTitle, &mapped_title)) { | 266 !dict->GetString(kMappingTitle, &mapped_title)) { |
| (...skipping 16 matching lines...) Expand all 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 |