OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 void TopSites::MigratePinnedURLs() { | 676 void TopSites::MigratePinnedURLs() { |
677 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 677 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
678 | 678 |
679 std::map<GURL, size_t> tmp_map; | 679 std::map<GURL, size_t> tmp_map; |
680 for (DictionaryValue::key_iterator it = pinned_urls_->begin_keys(); | 680 for (DictionaryValue::key_iterator it = pinned_urls_->begin_keys(); |
681 it != pinned_urls_->end_keys(); ++it) { | 681 it != pinned_urls_->end_keys(); ++it) { |
682 Value* value; | 682 Value* value; |
683 if (!pinned_urls_->GetWithoutPathExpansion(*it, &value)) | 683 if (!pinned_urls_->GetWithoutPathExpansion(*it, &value)) |
684 continue; | 684 continue; |
685 | 685 |
686 if (value->IsType(DictionaryValue::TYPE_DICTIONARY)) { | 686 if (value->IsDictionary()) { |
687 DictionaryValue* dict = static_cast<DictionaryValue*>(value); | 687 DictionaryValue* dict = static_cast<DictionaryValue*>(value); |
688 std::string url_string; | 688 std::string url_string; |
689 int index; | 689 int index; |
690 if (dict->GetString("url", &url_string) && | 690 if (dict->GetString("url", &url_string) && |
691 dict->GetInteger("index", &index)) | 691 dict->GetInteger("index", &index)) |
692 tmp_map[GURL(url_string)] = index; | 692 tmp_map[GURL(url_string)] = index; |
693 } | 693 } |
694 } | 694 } |
695 | 695 |
696 { | 696 { |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 SetTopSites(pages); | 1006 SetTopSites(pages); |
1007 | 1007 |
1008 // Used only in testing. | 1008 // Used only in testing. |
1009 NotificationService::current()->Notify( | 1009 NotificationService::current()->Notify( |
1010 chrome::NOTIFICATION_TOP_SITES_UPDATED, | 1010 chrome::NOTIFICATION_TOP_SITES_UPDATED, |
1011 Source<TopSites>(this), | 1011 Source<TopSites>(this), |
1012 Details<CancelableRequestProvider::Handle>(&handle)); | 1012 Details<CancelableRequestProvider::Handle>(&handle)); |
1013 } | 1013 } |
1014 | 1014 |
1015 } // namespace history | 1015 } // namespace history |
OLD | NEW |