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 using bookmarks::BookmarkModel;
8 using bookmarks::BookmarkNode;
10 BookmarkModelObserverForCocoa::BookmarkModelObserverForCocoa(
12 ChangeCallback callback) {
14 callback_.reset(Block_copy(callback));
16 model_->AddObserver(this);
19 BookmarkModelObserverForCocoa::~BookmarkModelObserverForCocoa() {
20 model_->RemoveObserver(this);
23 void BookmarkModelObserverForCocoa::StartObservingNode(
24 const BookmarkNode* node) {
28 void BookmarkModelObserverForCocoa::StopObservingNode(
29 const BookmarkNode* node) {
33 void BookmarkModelObserverForCocoa::BookmarkModelBeingDeleted(
34 BookmarkModel* model) {
38 void BookmarkModelObserverForCocoa::BookmarkNodeMoved(
40 const BookmarkNode* old_parent,
42 const BookmarkNode* new_parent,
44 // Editors often have a tree of parents, so movement of folders
45 // must cause a cancel.
49 void BookmarkModelObserverForCocoa::BookmarkNodeRemoved(
51 const BookmarkNode* parent,
53 const BookmarkNode* node,
54 const std::set<GURL>& removed_urls) {
55 // See comment in BookmarkNodeMoved.
59 void BookmarkModelObserverForCocoa::BookmarkAllUserNodesRemoved(
61 const std::set<GURL>& removed_urls) {
65 void BookmarkModelObserverForCocoa::BookmarkNodeChanged(
67 const BookmarkNode* node) {
68 if (!nodes_.size() || nodes_.find(node) != nodes_.end())
72 void BookmarkModelObserverForCocoa::Notify() {