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

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

Issue 2608913002: Handle invalid URLs in share extension. (Closed)
Patch Set: adding gambard as OWNER 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
« no previous file with comments | « no previous file | ios/chrome/browser/share_extension/OWNERS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/share_extension/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698