bookmark_model_loaded_observer.cc revision cedac228d2dd51db4b79ea1e72c7f249408ee061
1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/profiles/bookmark_model_loaded_observer.h"
6
7#include "chrome/browser/sync/profile_sync_service_factory.h"
8#include "components/bookmarks/browser/bookmark_model.h"
9
10BookmarkModelLoadedObserver::BookmarkModelLoadedObserver(Profile* profile)
11    : profile_(profile) {
12}
13
14void BookmarkModelLoadedObserver::BookmarkModelChanged() {
15}
16
17void BookmarkModelLoadedObserver::BookmarkModelLoaded(BookmarkModel* model,
18                                                      bool ids_reassigned) {
19  // Causes lazy-load if sync is enabled.
20  ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_);
21  model->RemoveObserver(this);
22  delete this;
23}
24
25void BookmarkModelLoadedObserver::BookmarkModelBeingDeleted(
26    BookmarkModel* model) {
27  model->RemoveObserver(this);
28  delete this;
29}
30