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