| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/ntp/most_visited_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 has_blacklisted_urls_value); | 161 has_blacklisted_urls_value); |
| 162 pages_value_.reset(); | 162 pages_value_.reset(); |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 void MostVisitedHandler::StartQueryForMostVisited() { | 166 void MostVisitedHandler::StartQueryForMostVisited() { |
| 167 history::TopSites* ts = Profile::FromWebUI(web_ui())->GetTopSites(); | 167 history::TopSites* ts = Profile::FromWebUI(web_ui())->GetTopSites(); |
| 168 if (ts) { | 168 if (ts) { |
| 169 ts->GetMostVisitedURLs( | 169 ts->GetMostVisitedURLs( |
| 170 base::Bind(&MostVisitedHandler::OnMostVisitedUrlsAvailable, | 170 base::Bind(&MostVisitedHandler::OnMostVisitedUrlsAvailable, |
| 171 weak_ptr_factory_.GetWeakPtr())); | 171 weak_ptr_factory_.GetWeakPtr()), false); |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 void MostVisitedHandler::HandleBlacklistUrl(const ListValue* args) { | 175 void MostVisitedHandler::HandleBlacklistUrl(const ListValue* args) { |
| 176 std::string url = UTF16ToUTF8(ExtractStringValue(args)); | 176 std::string url = UTF16ToUTF8(ExtractStringValue(args)); |
| 177 BlacklistUrl(GURL(url)); | 177 BlacklistUrl(GURL(url)); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void MostVisitedHandler::HandleRemoveUrlsFromBlacklist(const ListValue* args) { | 180 void MostVisitedHandler::HandleRemoveUrlsFromBlacklist(const ListValue* args) { |
| 181 DCHECK(args->GetSize() != 0); | 181 DCHECK(args->GetSize() != 0); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 #endif | 296 #endif |
| 297 } | 297 } |
| 298 | 298 |
| 299 // static | 299 // static |
| 300 void MostVisitedHandler::RegisterProfilePrefs( | 300 void MostVisitedHandler::RegisterProfilePrefs( |
| 301 user_prefs::PrefRegistrySyncable* registry) { | 301 user_prefs::PrefRegistrySyncable* registry) { |
| 302 registry->RegisterDictionaryPref( | 302 registry->RegisterDictionaryPref( |
| 303 prefs::kNtpMostVisitedURLsBlacklist, | 303 prefs::kNtpMostVisitedURLsBlacklist, |
| 304 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 304 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 305 } | 305 } |
| OLD | NEW |