| 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/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/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 void MostVisitedHandler::SendPagesValue() { | 115 void MostVisitedHandler::SendPagesValue() { |
| 116 if (pages_value_.get()) { | 116 if (pages_value_.get()) { |
| 117 Profile* profile = web_ui_->GetProfile(); | 117 Profile* profile = web_ui_->GetProfile(); |
| 118 const DictionaryValue* url_blacklist = | 118 const DictionaryValue* url_blacklist = |
| 119 profile->GetPrefs()->GetDictionary(prefs::kNTPMostVisitedURLsBlacklist); | 119 profile->GetPrefs()->GetDictionary(prefs::kNTPMostVisitedURLsBlacklist); |
| 120 bool has_blacklisted_urls = !url_blacklist->empty(); | 120 bool has_blacklisted_urls = !url_blacklist->empty(); |
| 121 history::TopSites* ts = profile->GetTopSites(); | 121 history::TopSites* ts = profile->GetTopSites(); |
| 122 if (ts) | 122 if (ts) |
| 123 has_blacklisted_urls = ts->HasBlacklistedItems(); | 123 has_blacklisted_urls = ts->HasBlacklistedItems(); |
| 124 FundamentalValue has_blacklisted_urls_value(has_blacklisted_urls); | 124 base::FundamentalValue has_blacklisted_urls_value(has_blacklisted_urls); |
| 125 web_ui_->CallJavascriptFunction("setMostVisitedPages", | 125 web_ui_->CallJavascriptFunction("setMostVisitedPages", |
| 126 *(pages_value_.get()), | 126 *(pages_value_.get()), |
| 127 has_blacklisted_urls_value); | 127 has_blacklisted_urls_value); |
| 128 pages_value_.reset(); | 128 pages_value_.reset(); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 void MostVisitedHandler::StartQueryForMostVisited() { | 132 void MostVisitedHandler::StartQueryForMostVisited() { |
| 133 history::TopSites* ts = web_ui_->GetProfile()->GetTopSites(); | 133 history::TopSites* ts = web_ui_->GetProfile()->GetTopSites(); |
| 134 if (ts) { | 134 if (ts) { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 return base::MD5String(url); | 332 return base::MD5String(url); |
| 333 } | 333 } |
| 334 | 334 |
| 335 // static | 335 // static |
| 336 void MostVisitedHandler::RegisterUserPrefs(PrefService* prefs) { | 336 void MostVisitedHandler::RegisterUserPrefs(PrefService* prefs) { |
| 337 prefs->RegisterDictionaryPref(prefs::kNTPMostVisitedURLsBlacklist, | 337 prefs->RegisterDictionaryPref(prefs::kNTPMostVisitedURLsBlacklist, |
| 338 PrefService::UNSYNCABLE_PREF); | 338 PrefService::UNSYNCABLE_PREF); |
| 339 prefs->RegisterDictionaryPref(prefs::kNTPMostVisitedPinnedURLs, | 339 prefs->RegisterDictionaryPref(prefs::kNTPMostVisitedPinnedURLs, |
| 340 PrefService::UNSYNCABLE_PREF); | 340 PrefService::UNSYNCABLE_PREF); |
| 341 } | 341 } |
| OLD | NEW |