| 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/bookmarks/bookmark_expanded_state_tracker.h" | 5 #include "chrome/browser/bookmarks/bookmark_expanded_state_tracker.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 13 #include "components/bookmarks/bookmark_pref_names.h" |
| 13 | 14 |
| 14 BookmarkExpandedStateTracker::BookmarkExpandedStateTracker( | 15 BookmarkExpandedStateTracker::BookmarkExpandedStateTracker( |
| 15 BookmarkModel* bookmark_model, | 16 BookmarkModel* bookmark_model, |
| 16 PrefService* pref_service) | 17 PrefService* pref_service) |
| 17 : bookmark_model_(bookmark_model), | 18 : bookmark_model_(bookmark_model), |
| 18 pref_service_(pref_service) { | 19 pref_service_(pref_service) { |
| 19 bookmark_model->AddObserver(this); | 20 bookmark_model->AddObserver(this); |
| 20 } | 21 } |
| 21 | 22 |
| 22 BookmarkExpandedStateTracker::~BookmarkExpandedStateTracker() { | 23 BookmarkExpandedStateTracker::~BookmarkExpandedStateTracker() { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 return; | 100 return; |
| 100 | 101 |
| 101 base::ListValue values; | 102 base::ListValue values; |
| 102 for (Nodes::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { | 103 for (Nodes::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { |
| 103 values.Set(values.GetSize(), | 104 values.Set(values.GetSize(), |
| 104 new base::StringValue(base::Int64ToString((*i)->id()))); | 105 new base::StringValue(base::Int64ToString((*i)->id()))); |
| 105 } | 106 } |
| 106 | 107 |
| 107 pref_service_->Set(prefs::kBookmarkEditorExpandedNodes, values); | 108 pref_service_->Set(prefs::kBookmarkEditorExpandedNodes, values); |
| 108 } | 109 } |
| OLD | NEW |