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

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

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

Powered by Google App Engine
This is Rietveld 408576698