| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 StartQueryForMostVisited(); | 647 StartQueryForMostVisited(); |
| 648 } | 648 } |
| 649 | 649 |
| 650 void TopSites::AddBlacklistedURL(const GURL& url) { | 650 void TopSites::AddBlacklistedURL(const GURL& url) { |
| 651 RemovePinnedURL(url); | 651 RemovePinnedURL(url); |
| 652 Value* dummy = Value::CreateNullValue(); | 652 Value* dummy = Value::CreateNullValue(); |
| 653 blacklist_->SetWithoutPathExpansion(GetURLHash(url), dummy); | 653 blacklist_->SetWithoutPathExpansion(GetURLHash(url), dummy); |
| 654 } | 654 } |
| 655 | 655 |
| 656 bool TopSites::IsBlacklisted(const GURL& url) { | 656 bool TopSites::IsBlacklisted(const GURL& url) { |
| 657 Value* dummy = Value::CreateNullValue(); | 657 bool result = blacklist_->HasKey(GetURLHash(url)); |
| 658 bool result = blacklist_->GetWithoutPathExpansion(GetURLHash(url), &dummy); | |
| 659 return result; | 658 return result; |
| 660 } | 659 } |
| 661 | 660 |
| 662 void TopSites::RemoveBlacklistedURL(const GURL& url) { | 661 void TopSites::RemoveBlacklistedURL(const GURL& url) { |
| 663 Value* dummy = NULL; | 662 Value* dummy = NULL; |
| 664 blacklist_->RemoveWithoutPathExpansion(GetURLHash(url), &dummy); | 663 blacklist_->RemoveWithoutPathExpansion(GetURLHash(url), &dummy); |
| 665 } | 664 } |
| 666 | 665 |
| 667 void TopSites::ClearBlacklistedURLs() { | 666 void TopSites::ClearBlacklistedURLs() { |
| 668 blacklist_->Clear(); | 667 blacklist_->Clear(); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB)); | 823 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB)); |
| 825 db_.reset(new TopSitesDatabaseImpl()); | 824 db_.reset(new TopSitesDatabaseImpl()); |
| 826 file_util::Delete(db_path_, false); | 825 file_util::Delete(db_path_, false); |
| 827 if (!db_->Init(db_path_)) { | 826 if (!db_->Init(db_path_)) { |
| 828 NOTREACHED() << "Failed to initialize database."; | 827 NOTREACHED() << "Failed to initialize database."; |
| 829 return; | 828 return; |
| 830 } | 829 } |
| 831 } | 830 } |
| 832 | 831 |
| 833 } // namespace history | 832 } // namespace history |
| OLD | NEW |