Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: components/bookmarks/browser/bookmark_model.cc

Issue 1233673002: Fix componentization of chrome/browser/bookmarks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_model.h" 5 #include "components/bookmarks/browser/bookmark_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/i18n/string_compare.h" 12 #include "base/i18n/string_compare.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
16 #include "base/profiler/scoped_tracker.h" 16 #include "base/profiler/scoped_tracker.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/values.h"
18 #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h" 19 #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h"
19 #include "components/bookmarks/browser/bookmark_index.h" 20 #include "components/bookmarks/browser/bookmark_index.h"
20 #include "components/bookmarks/browser/bookmark_match.h" 21 #include "components/bookmarks/browser/bookmark_match.h"
21 #include "components/bookmarks/browser/bookmark_model_observer.h" 22 #include "components/bookmarks/browser/bookmark_model_observer.h"
22 #include "components/bookmarks/browser/bookmark_node_data.h" 23 #include "components/bookmarks/browser/bookmark_node_data.h"
23 #include "components/bookmarks/browser/bookmark_storage.h" 24 #include "components/bookmarks/browser/bookmark_storage.h"
24 #include "components/bookmarks/browser/bookmark_utils.h" 25 #include "components/bookmarks/browser/bookmark_utils.h"
26 #include "components/bookmarks/common/bookmark_pref_names.h"
25 #include "components/favicon_base/favicon_types.h" 27 #include "components/favicon_base/favicon_types.h"
28 #include "components/pref_registry/pref_registry_syncable.h"
26 #include "grit/components_strings.h" 29 #include "grit/components_strings.h"
27 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/gfx/favicon_size.h" 31 #include "ui/gfx/favicon_size.h"
29 32
30 using base::Time; 33 using base::Time;
31 34
32 namespace bookmarks { 35 namespace bookmarks {
33 36
34 namespace { 37 namespace {
35 38
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 FOR_EACH_OBSERVER(BookmarkModelObserver, observers_, 115 FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
113 BookmarkModelBeingDeleted(this)); 116 BookmarkModelBeingDeleted(this));
114 117
115 if (store_.get()) { 118 if (store_.get()) {
116 // The store maintains a reference back to us. We need to tell it we're gone 119 // The store maintains a reference back to us. We need to tell it we're gone
117 // so that it doesn't try and invoke a method back on us again. 120 // so that it doesn't try and invoke a method back on us again.
118 store_->BookmarkModelDeleted(); 121 store_->BookmarkModelDeleted();
119 } 122 }
120 } 123 }
121 124
125 // static
126 void BookmarkModel::RegisterProfilePrefs(
tfarina 2015/07/10 17:29:06 Why does this needs to me a static method on Bookm
sdefresne 2015/07/16 07:23:33 Does not have to be a static method on BookmarkMod
127 user_prefs::PrefRegistrySyncable* registry) {
128 // Don't sync this, as otherwise, due to a limitation in sync, it
129 // will cause a deadlock (see http://crbug.com/97955). If we truly
130 // want to sync the expanded state of folders, it should be part of
131 // bookmark sync itself (i.e., a property of the sync folder nodes).
132 registry->RegisterListPref(bookmarks::prefs::kBookmarkEditorExpandedNodes,
133 new base::ListValue);
134 registry->RegisterListPref(bookmarks::prefs::kManagedBookmarks);
135 registry->RegisterListPref(bookmarks::prefs::kSupervisedBookmarks);
136 }
137
122 void BookmarkModel::Shutdown() { 138 void BookmarkModel::Shutdown() {
123 if (loaded_) 139 if (loaded_)
124 return; 140 return;
125 141
126 // See comment in HistoryService::ShutdownOnUIThread where this is invoked for 142 // See comment in HistoryService::ShutdownOnUIThread where this is invoked for
127 // details. It is also called when the BookmarkModel is deleted. 143 // details. It is also called when the BookmarkModel is deleted.
128 loaded_signal_.Signal(); 144 loaded_signal_.Signal();
129 } 145 }
130 146
131 void BookmarkModel::Load( 147 void BookmarkModel::Load(
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 return scoped_ptr<BookmarkLoadDetails>(new BookmarkLoadDetails( 1058 return scoped_ptr<BookmarkLoadDetails>(new BookmarkLoadDetails(
1043 bb_node, 1059 bb_node,
1044 other_node, 1060 other_node,
1045 mobile_node, 1061 mobile_node,
1046 client_->GetLoadExtraNodesCallback(), 1062 client_->GetLoadExtraNodesCallback(),
1047 new BookmarkIndex(client_, accept_languages), 1063 new BookmarkIndex(client_, accept_languages),
1048 next_node_id_)); 1064 next_node_id_));
1049 } 1065 }
1050 1066
1051 } // namespace bookmarks 1067 } // namespace bookmarks
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698