| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/chrome/app/spotlight/bookmarks_spotlight_manager.h" | 5 #import "ios/chrome/app/spotlight/bookmarks_spotlight_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #import <CoreSpotlight/CoreSpotlight.h> | 9 #import <CoreSpotlight/CoreSpotlight.h> |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 @end | 73 @end |
| 74 | 74 |
| 75 // Handles notification that bookmarks has been removed changed so we can update | 75 // Handles notification that bookmarks has been removed changed so we can update |
| 76 // the Spotlight index. | 76 // the Spotlight index. |
| 77 class SpotlightBookmarkModelBridge : public bookmarks::BookmarkModelObserver { | 77 class SpotlightBookmarkModelBridge : public bookmarks::BookmarkModelObserver { |
| 78 public: | 78 public: |
| 79 explicit SpotlightBookmarkModelBridge(BookmarksSpotlightManager* owner) | 79 explicit SpotlightBookmarkModelBridge(BookmarksSpotlightManager* owner) |
| 80 : owner_(owner){}; | 80 : owner_(owner){}; |
| 81 | 81 |
| 82 ~SpotlightBookmarkModelBridge() override{}; | 82 ~SpotlightBookmarkModelBridge() override {} |
| 83 | 83 |
| 84 void BookmarkNodeRemoved(bookmarks::BookmarkModel* model, | 84 void BookmarkNodeRemoved(bookmarks::BookmarkModel* model, |
| 85 const bookmarks::BookmarkNode* parent, | 85 const bookmarks::BookmarkNode* parent, |
| 86 int old_index, | 86 int old_index, |
| 87 const bookmarks::BookmarkNode* node, | 87 const bookmarks::BookmarkNode* node, |
| 88 const std::set<GURL>& removed_urls) override {} | 88 const std::set<GURL>& removed_urls) override {} |
| 89 | 89 |
| 90 void OnWillRemoveBookmarks(bookmarks::BookmarkModel* model, | 90 void OnWillRemoveBookmarks(bookmarks::BookmarkModel* model, |
| 91 const bookmarks::BookmarkNode* parent, | 91 const bookmarks::BookmarkNode* parent, |
| 92 int old_index, | 92 int old_index, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 126 } |
| 127 | 127 |
| 128 void BookmarkAllUserNodesRemoved( | 128 void BookmarkAllUserNodesRemoved( |
| 129 bookmarks::BookmarkModel* model, | 129 bookmarks::BookmarkModel* model, |
| 130 const std::set<GURL>& removed_urls) override { | 130 const std::set<GURL>& removed_urls) override { |
| 131 [owner_ clearAllSpotlightItems:nil]; | 131 [owner_ clearAllSpotlightItems:nil]; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void BookmarkNodeChildrenReordered( | 134 void BookmarkNodeChildrenReordered( |
| 135 bookmarks::BookmarkModel* model, | 135 bookmarks::BookmarkModel* model, |
| 136 const bookmarks::BookmarkNode* node) override{}; | 136 const bookmarks::BookmarkNode* node) override {} |
| 137 | 137 |
| 138 void BookmarkNodeMoved(bookmarks::BookmarkModel* model, | 138 void BookmarkNodeMoved(bookmarks::BookmarkModel* model, |
| 139 const bookmarks::BookmarkNode* old_parent, | 139 const bookmarks::BookmarkNode* old_parent, |
| 140 int old_index, | 140 int old_index, |
| 141 const bookmarks::BookmarkNode* new_parent, | 141 const bookmarks::BookmarkNode* new_parent, |
| 142 int new_index) override { | 142 int new_index) override { |
| 143 [owner_ refreshNodeInIndex:new_parent->GetChild(new_index) initial:NO]; | 143 [owner_ refreshNodeInIndex:new_parent->GetChild(new_index) initial:NO]; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 private: | 146 private: |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 spotlight::kCurrentSpotlightIndexVersion] | 338 spotlight::kCurrentSpotlightIndexVersion] |
| 339 forKey:@(spotlight::kSpotlightLastIndexingVersionKey)]; | 339 forKey:@(spotlight::kSpotlightLastIndexingVersionKey)]; |
| 340 [_delegate bookmarkUpdated]; | 340 [_delegate bookmarkUpdated]; |
| 341 }); | 341 }); |
| 342 } | 342 } |
| 343 }; | 343 }; |
| 344 [self clearAllSpotlightItems:completion]; | 344 [self clearAllSpotlightItems:completion]; |
| 345 } | 345 } |
| 346 | 346 |
| 347 @end | 347 @end |
| OLD | NEW |