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 #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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 storage_layer_->SaveEntry(entry); | 384 storage_layer_->SaveEntry(entry); |
385 } | 385 } |
386 for (ReadingListModelObserver& observer : observers_) { | 386 for (ReadingListModelObserver& observer : observers_) { |
387 observer.ReadingListDidApplyChanges(this); | 387 observer.ReadingListDidApplyChanges(this); |
388 } | 388 } |
389 } | 389 } |
390 | 390 |
391 void ReadingListModelImpl::SetEntryDistilledInfo( | 391 void ReadingListModelImpl::SetEntryDistilledInfo( |
392 const GURL& url, | 392 const GURL& url, |
393 const base::FilePath& distilled_path, | 393 const base::FilePath& distilled_path, |
394 const GURL& distilled_url) { | 394 const GURL& distilled_url, |
| 395 int64_t distillation_size, |
| 396 int64_t distillation_date) { |
395 DCHECK(CalledOnValidThread()); | 397 DCHECK(CalledOnValidThread()); |
396 DCHECK(loaded()); | 398 DCHECK(loaded()); |
397 auto iterator = entries_->find(url); | 399 auto iterator = entries_->find(url); |
398 if (iterator == entries_->end()) { | 400 if (iterator == entries_->end()) { |
399 return; | 401 return; |
400 } | 402 } |
401 ReadingListEntry& entry = iterator->second; | 403 ReadingListEntry& entry = iterator->second; |
402 if (entry.DistilledState() == ReadingListEntry::PROCESSED && | 404 if (entry.DistilledState() == ReadingListEntry::PROCESSED && |
403 entry.DistilledPath() == distilled_path) { | 405 entry.DistilledPath() == distilled_path) { |
404 return; | 406 return; |
405 } | 407 } |
406 | 408 |
407 for (ReadingListModelObserver& observer : observers_) { | 409 for (ReadingListModelObserver& observer : observers_) { |
408 observer.ReadingListWillUpdateEntry(this, url); | 410 observer.ReadingListWillUpdateEntry(this, url); |
409 } | 411 } |
410 entry.SetDistilledInfo(distilled_path, distilled_url); | 412 entry.SetDistilledInfo(distilled_path, distilled_url, distillation_size, |
| 413 distillation_date); |
411 if (storage_layer_) { | 414 if (storage_layer_) { |
412 storage_layer_->SaveEntry(entry); | 415 storage_layer_->SaveEntry(entry); |
413 } | 416 } |
414 for (ReadingListModelObserver& observer : observers_) { | 417 for (ReadingListModelObserver& observer : observers_) { |
415 observer.ReadingListDidApplyChanges(this); | 418 observer.ReadingListDidApplyChanges(this); |
416 } | 419 } |
417 } | 420 } |
418 | 421 |
419 void ReadingListModelImpl::SetEntryDistilledState( | 422 void ReadingListModelImpl::SetEntryDistilledState( |
420 const GURL& url, | 423 const GURL& url, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 syncer::ModelTypeSyncBridge* ReadingListModelImpl::GetModelTypeSyncBridge() { | 499 syncer::ModelTypeSyncBridge* ReadingListModelImpl::GetModelTypeSyncBridge() { |
497 DCHECK(loaded()); | 500 DCHECK(loaded()); |
498 if (!storage_layer_) | 501 if (!storage_layer_) |
499 return nullptr; | 502 return nullptr; |
500 return storage_layer_.get(); | 503 return storage_layer_.get(); |
501 } | 504 } |
502 | 505 |
503 ReadingListModelStorage* ReadingListModelImpl::StorageLayer() { | 506 ReadingListModelStorage* ReadingListModelImpl::StorageLayer() { |
504 return storage_layer_.get(); | 507 return storage_layer_.get(); |
505 } | 508 } |
OLD | NEW |