Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: components/reading_list/ios/reading_list_model_impl.cc

Issue 2770723004: Remove all ReadingList entries on managed account signout. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "components/reading_list/ios/reading_list_model_impl.h" 5 #include "components/reading_list/ios/reading_list_model_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (storage_layer_) { 136 if (storage_layer_) {
137 storage_layer_->SaveEntry(entry); 137 storage_layer_->SaveEntry(entry);
138 } 138 }
139 for (auto& observer : observers_) { 139 for (auto& observer : observers_) {
140 observer.ReadingListDidApplyChanges(this); 140 observer.ReadingListDidApplyChanges(this);
141 } 141 }
142 } 142 }
143 DCHECK(unseen_entry_count_ == 0); 143 DCHECK(unseen_entry_count_ == 0);
144 } 144 }
145 145
146 bool ReadingListModelImpl::DeleteAllEntries() {
147 DCHECK(CalledOnValidThread());
148 if (!loaded()) {
149 return false;
150 }
151 auto scoped_model_batch_updates = BeginBatchUpdates();
152 for (const auto& url : Keys()) {
153 RemoveEntryByURL(url);
154 }
155 return entries_->empty();
156 }
157
146 void ReadingListModelImpl::UpdateEntryStateCountersOnEntryRemoval( 158 void ReadingListModelImpl::UpdateEntryStateCountersOnEntryRemoval(
147 const ReadingListEntry& entry) { 159 const ReadingListEntry& entry) {
148 if (!entry.HasBeenSeen()) { 160 if (!entry.HasBeenSeen()) {
149 unseen_entry_count_--; 161 unseen_entry_count_--;
150 } 162 }
151 if (entry.IsRead()) { 163 if (entry.IsRead()) {
152 read_entry_count_--; 164 read_entry_count_--;
153 } else { 165 } else {
154 unread_entry_count_--; 166 unread_entry_count_--;
155 } 167 }
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 syncer::ModelTypeSyncBridge* ReadingListModelImpl::GetModelTypeSyncBridge() { 511 syncer::ModelTypeSyncBridge* ReadingListModelImpl::GetModelTypeSyncBridge() {
500 DCHECK(loaded()); 512 DCHECK(loaded());
501 if (!storage_layer_) 513 if (!storage_layer_)
502 return nullptr; 514 return nullptr;
503 return storage_layer_.get(); 515 return storage_layer_.get();
504 } 516 }
505 517
506 ReadingListModelStorage* ReadingListModelImpl::StorageLayer() { 518 ReadingListModelStorage* ReadingListModelImpl::StorageLayer() {
507 return storage_layer_.get(); 519 return storage_layer_.get();
508 } 520 }
OLDNEW
« no previous file with comments | « components/reading_list/ios/reading_list_model_impl.h ('k') | ios/chrome/browser/reading_list/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698