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/bookmarks_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/bookmarks_handler.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 NewTabUI::SetURLTitleAndDirection(dict, node->GetTitle(), node->url()); | 316 NewTabUI::SetURLTitleAndDirection(dict, node->GetTitle(), node->url()); |
317 | 317 |
318 if (!node->is_folder()) | 318 if (!node->is_folder()) |
319 dict->SetString(keys::kUrlKey, node->url().spec()); | 319 dict->SetString(keys::kUrlKey, node->url().spec()); |
320 | 320 |
321 return dict; | 321 return dict; |
322 } | 322 } |
323 | 323 |
324 void BookmarksHandler::AddNode(const BookmarkNode* node, | 324 void BookmarksHandler::AddNode(const BookmarkNode* node, |
325 base::ListValue* list) { | 325 base::ListValue* list) { |
326 if (node->IsVisible()) { | 326 list->Append(GetNodeDictionary(node)); |
327 base::DictionaryValue* dict = GetNodeDictionary(node); | |
328 list->Append(dict); | |
329 } | |
330 } | 327 } |
331 | 328 |
332 // static | 329 // static |
333 void BookmarksHandler::RegisterUserPrefs(PrefService* prefs) { | 330 void BookmarksHandler::RegisterUserPrefs(PrefService* prefs) { |
334 // Default folder is the root node. | 331 // Default folder is the root node. |
335 // TODO(csilv): Should we sync this preference? | 332 // TODO(csilv): Should we sync this preference? |
336 prefs->RegisterInt64Pref(prefs::kNTPShownBookmarksFolder, 0, | 333 prefs->RegisterInt64Pref(prefs::kNTPShownBookmarksFolder, 0, |
337 PrefService::UNSYNCABLE_PREF); | 334 PrefService::UNSYNCABLE_PREF); |
338 } | 335 } |
OLD | NEW |