OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/history/top_sites.h" | 5 #include "chrome/browser/history/top_sites.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 for (DictionaryValue::key_iterator it = pinned_urls_->begin_keys(); | 367 for (DictionaryValue::key_iterator it = pinned_urls_->begin_keys(); |
368 it != pinned_urls_->end_keys(); ++it) { | 368 it != pinned_urls_->end_keys(); ++it) { |
369 Value* value; | 369 Value* value; |
370 if (!pinned_urls_->GetWithoutPathExpansion(*it, &value)) | 370 if (!pinned_urls_->GetWithoutPathExpansion(*it, &value)) |
371 continue; | 371 continue; |
372 | 372 |
373 if (value->IsType(DictionaryValue::TYPE_DICTIONARY)) { | 373 if (value->IsType(DictionaryValue::TYPE_DICTIONARY)) { |
374 DictionaryValue* dict = static_cast<DictionaryValue*>(value); | 374 DictionaryValue* dict = static_cast<DictionaryValue*>(value); |
375 std::string url_string; | 375 std::string url_string; |
376 int index; | 376 int index; |
377 if (dict->GetString(L"url", &url_string) && | 377 if (dict->GetString("url", &url_string) && |
378 dict->GetInteger(L"index", &index)) | 378 dict->GetInteger("index", &index)) |
379 tmp_map[GURL(url_string)] = index; | 379 tmp_map[GURL(url_string)] = index; |
380 } | 380 } |
381 } | 381 } |
382 pinned_urls_->Clear(); | 382 pinned_urls_->Clear(); |
383 for (std::map<GURL, size_t>::iterator it = tmp_map.begin(); | 383 for (std::map<GURL, size_t>::iterator it = tmp_map.begin(); |
384 it != tmp_map.end(); ++it) | 384 it != tmp_map.end(); ++it) |
385 AddPinnedURL(it->first, it->second); | 385 AddPinnedURL(it->first, it->second); |
386 } | 386 } |
387 | 387 |
388 void TopSites::ApplyBlacklistAndPinnedURLs(const MostVisitedURLList& urls, | 388 void TopSites::ApplyBlacklistAndPinnedURLs(const MostVisitedURLList& urls, |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB)); | 936 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB)); |
937 db_.reset(new TopSitesDatabaseImpl()); | 937 db_.reset(new TopSitesDatabaseImpl()); |
938 file_util::Delete(db_path_, false); | 938 file_util::Delete(db_path_, false); |
939 if (!db_->Init(db_path_)) { | 939 if (!db_->Init(db_path_)) { |
940 NOTREACHED() << "Failed to initialize database."; | 940 NOTREACHED() << "Failed to initialize database."; |
941 return; | 941 return; |
942 } | 942 } |
943 } | 943 } |
944 | 944 |
945 } // namespace history | 945 } // namespace history |
OLD | NEW |