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

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

Issue 2647763005: Store the distilled_url in Reading List entry in Reading List on iOS. (Closed)
Patch Set: feedback Created 3 years, 11 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 entry.SetTitle(title); 382 entry.SetTitle(title);
383 if (storage_layer_) { 383 if (storage_layer_) {
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::SetEntryDistilledPath( 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 DCHECK(CalledOnValidThread()); 395 DCHECK(CalledOnValidThread());
395 DCHECK(loaded()); 396 DCHECK(loaded());
396 auto iterator = entries_->find(url); 397 auto iterator = entries_->find(url);
397 if (iterator == entries_->end()) { 398 if (iterator == entries_->end()) {
398 return; 399 return;
399 } 400 }
400 ReadingListEntry& entry = iterator->second; 401 ReadingListEntry& entry = iterator->second;
401 if (entry.DistilledState() == ReadingListEntry::PROCESSED && 402 if (entry.DistilledState() == ReadingListEntry::PROCESSED &&
402 entry.DistilledPath() == distilled_path) { 403 entry.DistilledPath() == distilled_path) {
403 return; 404 return;
404 } 405 }
405 406
406 for (ReadingListModelObserver& observer : observers_) { 407 for (ReadingListModelObserver& observer : observers_) {
407 observer.ReadingListWillUpdateEntry(this, url); 408 observer.ReadingListWillUpdateEntry(this, url);
408 } 409 }
409 entry.SetDistilledPath(distilled_path); 410 entry.SetDistilledInfo(distilled_path, distilled_url);
410 if (storage_layer_) { 411 if (storage_layer_) {
411 storage_layer_->SaveEntry(entry); 412 storage_layer_->SaveEntry(entry);
412 } 413 }
413 for (ReadingListModelObserver& observer : observers_) { 414 for (ReadingListModelObserver& observer : observers_) {
414 observer.ReadingListDidApplyChanges(this); 415 observer.ReadingListDidApplyChanges(this);
415 } 416 }
416 } 417 }
417 418
418 void ReadingListModelImpl::SetEntryDistilledState( 419 void ReadingListModelImpl::SetEntryDistilledState(
419 const GURL& url, 420 const GURL& url,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 syncer::ModelTypeSyncBridge* ReadingListModelImpl::GetModelTypeSyncBridge() { 496 syncer::ModelTypeSyncBridge* ReadingListModelImpl::GetModelTypeSyncBridge() {
496 DCHECK(loaded()); 497 DCHECK(loaded());
497 if (!storage_layer_) 498 if (!storage_layer_)
498 return nullptr; 499 return nullptr;
499 return storage_layer_.get(); 500 return storage_layer_.get();
500 } 501 }
501 502
502 ReadingListModelStorage* ReadingListModelImpl::StorageLayer() { 503 ReadingListModelStorage* ReadingListModelImpl::StorageLayer() {
503 return storage_layer_.get(); 504 return storage_layer_.get();
504 } 505 }
OLDNEW
« no previous file with comments | « components/reading_list/ios/reading_list_model_impl.h ('k') | components/reading_list/ios/reading_list_model_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698