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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h"
7 BookmarkModelObserverForCocoa::BookmarkModelObserverForCocoa(
9 ChangeCallback callback) {
11 callback_.reset(Block_copy(callback));
13 model_->AddObserver(this);
16 BookmarkModelObserverForCocoa::~BookmarkModelObserverForCocoa() {
17 model_->RemoveObserver(this);
20 void BookmarkModelObserverForCocoa::StartObservingNode(
21 const BookmarkNode* node) {
25 void BookmarkModelObserverForCocoa::StopObservingNode(
26 const BookmarkNode* node) {
30 void BookmarkModelObserverForCocoa::BookmarkModelBeingDeleted(
31 BookmarkModel* model) {
35 void BookmarkModelObserverForCocoa::BookmarkNodeMoved(
37 const BookmarkNode* old_parent,
39 const BookmarkNode* new_parent,
41 // Editors often have a tree of parents, so movement of folders
42 // must cause a cancel.
46 void BookmarkModelObserverForCocoa::BookmarkNodeRemoved(
48 const BookmarkNode* parent,
50 const BookmarkNode* node,
51 const std::set<GURL>& removed_urls) {
52 // See comment in BookmarkNodeMoved.
56 void BookmarkModelObserverForCocoa::BookmarkAllNodesRemoved(
58 const std::set<GURL>& removed_urls) {
62 void BookmarkModelObserverForCocoa::BookmarkNodeChanged(
64 const BookmarkNode* node) {
65 if (!nodes_.size() || nodes_.find(node) != nodes_.end())
69 void BookmarkModelObserverForCocoa::Notify(BOOL deleted) {
70 callback_.get()(deleted);