| 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/bookmarks/bookmark_utils.h" | 5 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 return node; | 633 return node; |
| 634 } | 634 } |
| 635 | 635 |
| 636 // Formerly in BookmarkBarView | 636 // Formerly in BookmarkBarView |
| 637 void ToggleWhenVisible(Profile* profile) { | 637 void ToggleWhenVisible(Profile* profile) { |
| 638 PrefService* prefs = profile->GetPrefs(); | 638 PrefService* prefs = profile->GetPrefs(); |
| 639 const bool always_show = !prefs->GetBoolean(prefs::kShowBookmarkBar); | 639 const bool always_show = !prefs->GetBoolean(prefs::kShowBookmarkBar); |
| 640 | 640 |
| 641 // The user changed when the bookmark bar is shown, update the preferences. | 641 // The user changed when the bookmark bar is shown, update the preferences. |
| 642 prefs->SetBoolean(prefs::kShowBookmarkBar, always_show); | 642 prefs->SetBoolean(prefs::kShowBookmarkBar, always_show); |
| 643 prefs->ScheduleSavePersistentPrefs(); | |
| 644 } | 643 } |
| 645 | 644 |
| 646 void RegisterUserPrefs(PrefService* prefs) { | 645 void RegisterUserPrefs(PrefService* prefs) { |
| 647 prefs->RegisterBooleanPref(prefs::kShowBookmarkBar, | 646 prefs->RegisterBooleanPref(prefs::kShowBookmarkBar, |
| 648 false, | 647 false, |
| 649 PrefService::SYNCABLE_PREF); | 648 PrefService::SYNCABLE_PREF); |
| 650 prefs->RegisterBooleanPref(prefs::kEditBookmarksEnabled, | 649 prefs->RegisterBooleanPref(prefs::kEditBookmarksEnabled, |
| 651 true, | 650 true, |
| 652 PrefService::UNSYNCABLE_PREF); | 651 PrefService::UNSYNCABLE_PREF); |
| 653 } | 652 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 // Remove all the bookmarks. | 760 // Remove all the bookmarks. |
| 762 for (size_t i = 0; i < bookmarks.size(); ++i) { | 761 for (size_t i = 0; i < bookmarks.size(); ++i) { |
| 763 const BookmarkNode* node = bookmarks[i]; | 762 const BookmarkNode* node = bookmarks[i]; |
| 764 int index = node->parent()->GetIndexOf(node); | 763 int index = node->parent()->GetIndexOf(node); |
| 765 if (index > -1) | 764 if (index > -1) |
| 766 model->Remove(node->parent(), index); | 765 model->Remove(node->parent(), index); |
| 767 } | 766 } |
| 768 } | 767 } |
| 769 | 768 |
| 770 } // namespace bookmark_utils | 769 } // namespace bookmark_utils |
| OLD | NEW |