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

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

Issue 2315273002: Measure usage metrics to prepare for adaptive fetching rates in M55 (Closed)
Patch Set: Bernhard's comments Created 4 years, 3 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 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/location.h" 13 #include "base/location.h"
13 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
14 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
15 #include "ui/gfx/image/image.h" 16 #include "ui/gfx/image/image.h"
16 17
17 namespace ntp_snippets { 18 namespace ntp_snippets {
18 19
19 ContentSuggestionsService::ContentSuggestionsService( 20 ContentSuggestionsService::ContentSuggestionsService(
20 State state, 21 State state,
21 history::HistoryService* history_service) 22 history::HistoryService* history_service,
22 : state_(state), history_service_observer_(this) { 23 PrefService* pref_service)
24 : state_(state),
25 history_service_observer_(this),
26 user_classifier_(pref_service) {
23 // Can be null in tests. 27 // Can be null in tests.
24 if (history_service) 28 if (history_service)
25 history_service_observer_.Add(history_service); 29 history_service_observer_.Add(history_service);
26 } 30 }
27 31
28 ContentSuggestionsService::~ContentSuggestionsService() {} 32 ContentSuggestionsService::~ContentSuggestionsService() {}
29 33
30 void ContentSuggestionsService::Shutdown() { 34 void ContentSuggestionsService::Shutdown() {
31 ntp_snippets_service_ = nullptr; 35 ntp_snippets_service_ = nullptr;
32 id_category_map_.clear(); 36 id_category_map_.clear();
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 if (left.IsKnownCategory(KnownCategories::BOOKMARKS)) 349 if (left.IsKnownCategory(KnownCategories::BOOKMARKS))
346 return false; 350 return false;
347 if (right.IsKnownCategory(KnownCategories::BOOKMARKS)) 351 if (right.IsKnownCategory(KnownCategories::BOOKMARKS))
348 return true; 352 return true;
349 } 353 }
350 return category_factory_.CompareCategories(left, right); 354 return category_factory_.CompareCategories(left, right);
351 }); 355 });
352 } 356 }
353 357
354 } // namespace ntp_snippets 358 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/content_suggestions_service.h ('k') | components/ntp_snippets/content_suggestions_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698