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

Side by Side Diff: components/ntp_snippets/category_rankers/click_based_category_ranker.cc

Issue 2744253004: NTP: clang-format (Closed)
Patch Set: rebase Created 3 years, 8 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/category_rankers/click_based_category_ranker.h " 5 #include "components/ntp_snippets/category_rankers/click_based_category_ranker.h "
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 AppendKnownCategory(known_category); 377 AppendKnownCategory(known_category);
378 } 378 }
379 379
380 StoreOrderToPrefs(ordered_categories_); 380 StoreOrderToPrefs(ordered_categories_);
381 } 381 }
382 382
383 void ClickBasedCategoryRanker::AppendKnownCategory( 383 void ClickBasedCategoryRanker::AppendKnownCategory(
384 KnownCategories known_category) { 384 KnownCategories known_category) {
385 Category category = Category::FromKnownCategory(known_category); 385 Category category = Category::FromKnownCategory(known_category);
386 DCHECK(!ContainsCategory(category)); 386 DCHECK(!ContainsCategory(category));
387 ordered_categories_.push_back(RankedCategory( 387 ordered_categories_.push_back(
388 category, /*clicks=*/0, /*last_dismissed=*/base::Time())); 388 RankedCategory(category, /*clicks=*/0, /*last_dismissed=*/base::Time()));
389 } 389 }
390 390
391 namespace { 391 namespace {
392 392
393 base::Time ParseLastDismissedDate(const base::DictionaryValue& value) { 393 base::Time ParseLastDismissedDate(const base::DictionaryValue& value) {
394 // We don't expect the last-dismissed value to be present in all cases (we 394 // We don't expect the last-dismissed value to be present in all cases (we
395 // added this after the fact). 395 // added this after the fact).
396 std::string serialized_value; 396 std::string serialized_value;
397 int64_t parsed_value; 397 int64_t parsed_value;
398 if (value.GetString(kLastDismissedKey, &serialized_value) && 398 if (value.GetString(kLastDismissedKey, &serialized_value) &&
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 num_pending_decays * GetTimeBetweenDecays()); 519 num_pending_decays * GetTimeBetweenDecays());
520 520
521 if (executed_decays > 0) { 521 if (executed_decays > 0) {
522 StoreOrderToPrefs(ordered_categories_); 522 StoreOrderToPrefs(ordered_categories_);
523 return true; 523 return true;
524 } 524 }
525 return false; 525 return false;
526 } 526 }
527 527
528 } // namespace ntp_snippets 528 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/category.cc ('k') | components/ntp_snippets/content_suggestions_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698