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

Side by Side Diff: components/ntp_snippets/content_suggestions_service.cc

Issue 2744253004: NTP: clang-format (Closed)
Patch Set: Created 3 years, 9 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/ntp_snippets/content_suggestions_service.h" 5 #include "components/ntp_snippets/content_suggestions_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // basis. However this depends on the provider's details and thus cannot be 353 // basis. However this depends on the provider's details and thus cannot be
354 // done here. Introduce a OnURLsDeleted() method on the providers to move 354 // done here. Introduce a OnURLsDeleted() method on the providers to move
355 // this decision further down. 355 // this decision further down.
356 if (deleted_rows.size() < 2) { 356 if (deleted_rows.size() < 2) {
357 return; 357 return;
358 } 358 }
359 std::set<GURL> deleted_urls; 359 std::set<GURL> deleted_urls;
360 for (const history::URLRow& row : deleted_rows) { 360 for (const history::URLRow& row : deleted_rows) {
361 deleted_urls.insert(row.url()); 361 deleted_urls.insert(row.url());
362 } 362 }
363 base::Callback<bool(const GURL& url)> filter = base::Bind( 363 base::Callback<bool(const GURL& url)> filter =
364 [](const std::set<GURL>& set, const GURL& url) { 364 base::Bind([](const std::set<GURL>& set,
365 return set.count(url) != 0; 365 const GURL& url) { return set.count(url) != 0; },
366 }, 366 deleted_urls);
367 deleted_urls);
368 // We usually don't have any time-related information (the URLRow objects 367 // We usually don't have any time-related information (the URLRow objects
369 // usually don't provide a |last_visit()| timestamp. Hence we simply clear 368 // usually don't provide a |last_visit()| timestamp. Hence we simply clear
370 // the whole history for the selected URLs. 369 // the whole history for the selected URLs.
371 ClearHistory(base::Time(), base::Time::Max(), filter); 370 ClearHistory(base::Time(), base::Time::Max(), filter);
372 } 371 }
373 } 372 }
374 373
375 void ContentSuggestionsService::HistoryServiceBeingDeleted( 374 void ContentSuggestionsService::HistoryServiceBeingDeleted(
376 history::HistoryService* history_service) { 375 history::HistoryService* history_service) {
377 history_service_observer_.RemoveAll(); 376 history_service_observer_.RemoveAll();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 void ContentSuggestionsService::StoreDismissedCategoriesToPrefs() { 508 void ContentSuggestionsService::StoreDismissedCategoriesToPrefs() {
510 base::ListValue list; 509 base::ListValue list;
511 for (const auto& category_provider_pair : dismissed_providers_by_category_) { 510 for (const auto& category_provider_pair : dismissed_providers_by_category_) {
512 list.AppendInteger(category_provider_pair.first.id()); 511 list.AppendInteger(category_provider_pair.first.id());
513 } 512 }
514 513
515 pref_service_->Set(prefs::kDismissedCategories, list); 514 pref_service_->Set(prefs::kDismissedCategories, list);
516 } 515 }
517 516
518 } // namespace ntp_snippets 517 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698