| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/reading_list/ios/reading_list_model_bridge_observer.h" | 5 #import "components/reading_list/ios/reading_list_model_bridge_observer.h" |
| 6 | 6 |
| 7 #include "components/reading_list/ios/reading_list_entry.h" | 7 #include "components/reading_list/ios/reading_list_entry.h" |
| 8 #include "components/reading_list/ios/reading_list_model.h" | 8 #include "components/reading_list/ios/reading_list_model.h" |
| 9 | 9 |
| 10 ReadingListModelBridge::ReadingListModelBridge( | 10 ReadingListModelBridge::ReadingListModelBridge( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 void ReadingListModelBridge::ReadingListModelBeingDeleted( | 29 void ReadingListModelBridge::ReadingListModelBeingDeleted( |
| 30 const ReadingListModel* model) { | 30 const ReadingListModel* model) { |
| 31 if ([observer_ respondsToSelector:@selector(readingListModelBeingDeleted:)]) { | 31 if ([observer_ respondsToSelector:@selector(readingListModelBeingDeleted:)]) { |
| 32 [observer_ readingListModelBeingDeleted:model]; | 32 [observer_ readingListModelBeingDeleted:model]; |
| 33 } | 33 } |
| 34 model_ = nullptr; | 34 model_ = nullptr; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void ReadingListModelBridge::ReadingListWillRemoveUnreadEntry( | 37 void ReadingListModelBridge::ReadingListWillRemoveEntry( |
| 38 const ReadingListModel* model, | 38 const ReadingListModel* model, |
| 39 size_t index) { | 39 const GURL& url) { |
| 40 if ([observer_ respondsToSelector:@selector(readingListModel: | 40 if ([observer_ |
| 41 willRemoveUnreadEntryAtIndex:)]) { | 41 respondsToSelector:@selector(readingListModel:willRemoveEntry:)]) { |
| 42 [observer_ readingListModel:model willRemoveUnreadEntryAtIndex:index]; | 42 [observer_ readingListModel:model willRemoveEntry:url]; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 void ReadingListModelBridge::ReadingListWillRemoveReadEntry( | 46 void ReadingListModelBridge::ReadingListWillAddEntry( |
| 47 const ReadingListModel* model, | 47 const ReadingListModel* model, |
| 48 size_t index) { | 48 const ReadingListEntry& entry) { |
| 49 if ([observer_ respondsToSelector:@selector(readingListModel: | 49 if ([observer_ |
| 50 willRemoveReadEntryAtIndex:)]) { | 50 respondsToSelector:@selector(readingListModel:willAddEntry:)]) { |
| 51 [observer_ readingListModel:model willRemoveReadEntryAtIndex:index]; | 51 [observer_ readingListModel:model willAddEntry:entry]; |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 void ReadingListModelBridge::ReadingListWillAddReadEntry( | 55 void ReadingListModelBridge::ReadingListDidAddEntry( |
| 56 const ReadingListModel* model, | 56 const ReadingListModel* model, |
| 57 const ReadingListEntry& entry) { | 57 const GURL& url) { |
| 58 if ([observer_ | 58 if ([observer_ respondsToSelector:@selector(readingListModel:didAddEntry:)]) { |
| 59 respondsToSelector:@selector(readingListModel:willAddReadEntry:)]) { | 59 [observer_ readingListModel:model didAddEntry:url]; |
| 60 [observer_ readingListModel:model willAddReadEntry:entry]; | |
| 61 } | 60 } |
| 62 } | 61 } |
| 63 | 62 |
| 64 void ReadingListModelBridge::ReadingListWillAddUnreadEntry( | |
| 65 const ReadingListModel* model, | |
| 66 const ReadingListEntry& entry) { | |
| 67 if ([observer_ | |
| 68 respondsToSelector:@selector(readingListModel:willAddUnreadEntry:)]) { | |
| 69 [observer_ readingListModel:model willAddUnreadEntry:entry]; | |
| 70 } | |
| 71 } | |
| 72 | |
| 73 void ReadingListModelBridge::ReadingListDidApplyChanges( | 63 void ReadingListModelBridge::ReadingListDidApplyChanges( |
| 74 ReadingListModel* model) { | 64 ReadingListModel* model) { |
| 75 [observer_ readingListModelDidApplyChanges:model]; | 65 [observer_ readingListModelDidApplyChanges:model]; |
| 76 } | 66 } |
| 77 | 67 |
| 78 void ReadingListModelBridge::ReadingListModelBeganBatchUpdates( | 68 void ReadingListModelBridge::ReadingListModelBeganBatchUpdates( |
| 79 const ReadingListModel* model) { | 69 const ReadingListModel* model) { |
| 80 if ([observer_ | 70 if ([observer_ |
| 81 respondsToSelector:@selector(readingListModelBeganBatchUpdates:)]) { | 71 respondsToSelector:@selector(readingListModelBeganBatchUpdates:)]) { |
| 82 [observer_ readingListModelBeganBatchUpdates:model]; | 72 [observer_ readingListModelBeganBatchUpdates:model]; |
| 83 } | 73 } |
| 84 } | 74 } |
| 85 | 75 |
| 86 void ReadingListModelBridge::ReadingListModelCompletedBatchUpdates( | 76 void ReadingListModelBridge::ReadingListModelCompletedBatchUpdates( |
| 87 const ReadingListModel* model) { | 77 const ReadingListModel* model) { |
| 88 if ([observer_ | 78 if ([observer_ |
| 89 respondsToSelector:@selector( | 79 respondsToSelector:@selector( |
| 90 readingListModelCompletedBatchUpdates:)]) { | 80 readingListModelCompletedBatchUpdates:)]) { |
| 91 [observer_ readingListModelCompletedBatchUpdates:model]; | 81 [observer_ readingListModelCompletedBatchUpdates:model]; |
| 92 } | 82 } |
| 93 } | 83 } |
| 94 | 84 |
| 95 void ReadingListModelBridge::ReadingListWillMoveEntry( | 85 void ReadingListModelBridge::ReadingListWillMoveEntry( |
| 96 const ReadingListModel* model, | 86 const ReadingListModel* model, |
| 97 size_t index, | 87 const GURL& url) { |
| 98 bool read) { | 88 if ([observer_ |
| 99 if ([observer_ respondsToSelector:@selector(readingListModel: | 89 respondsToSelector:@selector(readingListModel:willMoveEntry:)]) { |
| 100 willMoveEntry: | 90 [observer_ readingListModel:model willMoveEntry:url]; |
| 101 isRead:)]) { | |
| 102 [observer_ readingListModel:model willMoveEntry:index isRead:read]; | |
| 103 } | 91 } |
| 104 } | 92 } |
| 105 | 93 |
| 106 void ReadingListModelBridge::ReadingListWillUpdateUnreadEntry( | 94 void ReadingListModelBridge::ReadingListWillUpdateEntry( |
| 107 const ReadingListModel* model, | 95 const ReadingListModel* model, |
| 108 size_t index) { | 96 const GURL& url) { |
| 109 if ([observer_ respondsToSelector:@selector(readingListModel: | 97 if ([observer_ |
| 110 willUpdateUnreadEntryAtIndex:)]) { | 98 respondsToSelector:@selector(readingListModel:willUpdateEntry:)]) { |
| 111 [observer_ readingListModel:model willUpdateUnreadEntryAtIndex:index]; | 99 [observer_ readingListModel:model willUpdateEntry:url]; |
| 112 } | 100 } |
| 113 } | 101 } |
| 114 | |
| 115 void ReadingListModelBridge::ReadingListWillUpdateReadEntry( | |
| 116 const ReadingListModel* model, | |
| 117 size_t index) { | |
| 118 if ([observer_ respondsToSelector:@selector(readingListModel: | |
| 119 willUpdateReadEntryAtIndex:)]) { | |
| 120 [observer_ readingListModel:model willUpdateReadEntryAtIndex:index]; | |
| 121 } | |
| 122 } | |
| OLD | NEW |