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

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

Issue 2277223002: [NTP Snippets] Safe(r) defaults for background fetching intervals (Closed)
Patch Set: . 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ntp_snippets_service.h" 5 #include "components/ntp_snippets/ntp_snippets_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 using suggestions::SuggestionsService; 43 using suggestions::SuggestionsService;
44 44
45 namespace ntp_snippets { 45 namespace ntp_snippets {
46 46
47 namespace { 47 namespace {
48 48
49 // Number of snippets requested to the server. Consider replacing sparse UMA 49 // Number of snippets requested to the server. Consider replacing sparse UMA
50 // histograms with COUNTS() if this number increases beyond 50. 50 // histograms with COUNTS() if this number increases beyond 50.
51 const int kMaxSnippetCount = 10; 51 const int kMaxSnippetCount = 10;
52 52
53 // Default values for snippets fetching intervals. 53 // Default values for snippets fetching intervals - once per day only.
54 const int kDefaultFetchingIntervalWifiChargingSeconds = 30 * 60; 54 const int kDefaultFetchingIntervalWifiChargingSeconds = 0;
tschumann 2016/08/25 20:28:52 it would be really good to document this behavior
Marc Treib 2016/08/26 08:24:49 A value of "0" disables the fetching, correct. Tha
tschumann 2016/08/29 12:38:41 yes, cause when choosing these values you rely on
55 const int kDefaultFetchingIntervalWifiSeconds = 2 * 60 * 60; 55 const int kDefaultFetchingIntervalWifiSeconds = 0;
56 const int kDefaultFetchingIntervalFallbackSeconds = 24 * 60 * 60; 56 const int kDefaultFetchingIntervalFallbackSeconds = 24 * 60 * 60;
57 57
58 // Variation parameters than can override the default fetching intervals. 58 // Variation parameters than can override the default fetching intervals.
59 const char kFetchingIntervalWifiChargingParamName[] = 59 const char kFetchingIntervalWifiChargingParamName[] =
60 "fetching_interval_wifi_charging_seconds"; 60 "fetching_interval_wifi_charging_seconds";
61 const char kFetchingIntervalWifiParamName[] = 61 const char kFetchingIntervalWifiParamName[] =
62 "fetching_interval_wifi_seconds"; 62 "fetching_interval_wifi_seconds";
63 const char kFetchingIntervalFallbackParamName[] = 63 const char kFetchingIntervalFallbackParamName[] =
64 "fetching_interval_fallback_seconds"; 64 "fetching_interval_fallback_seconds";
65 65
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { 887 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) {
888 if (status == category_status_) 888 if (status == category_status_)
889 return; 889 return;
890 890
891 category_status_ = status; 891 category_status_ = status;
892 observer()->OnCategoryStatusChanged(this, provided_category_, 892 observer()->OnCategoryStatusChanged(this, provided_category_,
893 category_status_); 893 category_status_);
894 } 894 }
895 895
896 } // namespace ntp_snippets 896 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698