Chromium Code Reviews| Index: chrome/browser/bookmarks/chrome_bookmark_client.cc |
| diff --git a/chrome/browser/bookmarks/chrome_bookmark_client.cc b/chrome/browser/bookmarks/chrome_bookmark_client.cc |
| index b57fb06f3c37ae0563662a19d708b6557b4a880a..27845427a8d475faada11d190cbf5ef611e2deab 100644 |
| --- a/chrome/browser/bookmarks/chrome_bookmark_client.cc |
| +++ b/chrome/browser/bookmarks/chrome_bookmark_client.cc |
| @@ -31,10 +31,18 @@ void NotifyHistoryOfRemovedURLs(Profile* profile, |
| } // namespace |
| -ChromeBookmarkClient::ChromeBookmarkClient(Profile* profile, bool index_urls) |
| - : profile_(profile), |
| - model_(new BookmarkModel(this, index_urls)) { |
| +ChromeBookmarkClient::ChromeBookmarkClient(Profile* profile) |
| + : profile_(profile), model_(NULL) { |
| +} |
| + |
| +ChromeBookmarkClient::~ChromeBookmarkClient() { |
| +} |
| + |
| +void ChromeBookmarkClient::Init(BookmarkModel* model) { |
| + DCHECK(!model_ && model); |
| + model_ = model; |
| model_->AddObserver(this); |
| + |
| // Listen for changes to favicons so that we can update the favicon of the |
| // node appropriately. |
| registrar_.Add(this, |
| @@ -42,10 +50,13 @@ ChromeBookmarkClient::ChromeBookmarkClient(Profile* profile, bool index_urls) |
| content::Source<Profile>(profile_)); |
| } |
| -ChromeBookmarkClient::~ChromeBookmarkClient() { |
| - model_->RemoveObserver(this); |
| +void ChromeBookmarkClient::Shutdown() { |
| + if (model_) { |
| + registrar_.RemoveAll(); |
| - registrar_.RemoveAll(); |
| + model_->RemoveObserver(this); |
| + model_ = NULL; |
| + } |
|
blundell
2014/06/05 09:48:30
You should call BookmarkClient::Shutdown() here.
sdefresne
2014/06/10 13:12:21
Done.
|
| } |
| bool ChromeBookmarkClient::PreferTouchIcon() { |
| @@ -131,10 +142,6 @@ void ChromeBookmarkClient::Observe( |
| } |
| } |
| -void ChromeBookmarkClient::Shutdown() { |
| - model_->Shutdown(); |
| -} |
| - |
| void ChromeBookmarkClient::BookmarkModelChanged() { |
| } |