| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 entries_->erase(url); | 285 entries_->erase(url); |
| 286 for (auto& observer : observers_) | 286 for (auto& observer : observers_) |
| 287 observer.ReadingListDidApplyChanges(this); | 287 observer.ReadingListDidApplyChanges(this); |
| 288 } | 288 } |
| 289 | 289 |
| 290 const ReadingListEntry& ReadingListModelImpl::AddEntry( | 290 const ReadingListEntry& ReadingListModelImpl::AddEntry( |
| 291 const GURL& url, | 291 const GURL& url, |
| 292 const std::string& title) { | 292 const std::string& title) { |
| 293 DCHECK(CalledOnValidThread()); | 293 DCHECK(CalledOnValidThread()); |
| 294 DCHECK(loaded()); | 294 DCHECK(loaded()); |
| 295 DCHECK(url.SchemeIsHTTPOrHTTPS()); |
| 295 RemoveEntryByURL(url); | 296 RemoveEntryByURL(url); |
| 296 | 297 |
| 297 std::string trimmedTitle(title); | 298 std::string trimmedTitle(title); |
| 298 base::TrimWhitespaceASCII(trimmedTitle, base::TRIM_ALL, &trimmedTitle); | 299 base::TrimWhitespaceASCII(trimmedTitle, base::TRIM_ALL, &trimmedTitle); |
| 299 | 300 |
| 300 ReadingListEntry entry(url, trimmedTitle); | 301 ReadingListEntry entry(url, trimmedTitle); |
| 301 for (auto& observer : observers_) | 302 for (auto& observer : observers_) |
| 302 observer.ReadingListWillAddEntry(this, entry); | 303 observer.ReadingListWillAddEntry(this, entry); |
| 303 has_unseen_ = true; | 304 has_unseen_ = true; |
| 304 SetPersistentHasUnseen(true); | 305 SetPersistentHasUnseen(true); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 syncer::ModelTypeSyncBridge* ReadingListModelImpl::GetModelTypeSyncBridge() { | 477 syncer::ModelTypeSyncBridge* ReadingListModelImpl::GetModelTypeSyncBridge() { |
| 477 DCHECK(loaded()); | 478 DCHECK(loaded()); |
| 478 if (!storage_layer_) | 479 if (!storage_layer_) |
| 479 return nullptr; | 480 return nullptr; |
| 480 return storage_layer_.get(); | 481 return storage_layer_.get(); |
| 481 } | 482 } |
| 482 | 483 |
| 483 ReadingListModelStorage* ReadingListModelImpl::StorageLayer() { | 484 ReadingListModelStorage* ReadingListModelImpl::StorageLayer() { |
| 484 return storage_layer_.get(); | 485 return storage_layer_.get(); |
| 485 } | 486 } |
| OLD | NEW |