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

Side by Side Diff: components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc

Issue 2817903003: [Remote scheduler] Make sure we fetch after EULA accepted (Closed)
Patch Set: Marc's comment 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
« 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 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/remote/remote_suggestions_scheduler_impl.h" 5 #include "components/ntp_snippets/remote/remote_suggestions_scheduler_impl.h"
6 6
7 #include <random> 7 #include <random>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 bool IsEulaAccepted() { 168 bool IsEulaAccepted() {
169 if (!eula_notifier_) { 169 if (!eula_notifier_) {
170 return true; 170 return true;
171 } 171 }
172 return eula_notifier_->IsEulaAccepted(); 172 return eula_notifier_->IsEulaAccepted();
173 } 173 }
174 174
175 // EulaAcceptedNotifier::Observer implementation. 175 // EulaAcceptedNotifier::Observer implementation.
176 void OnEulaAccepted() override { 176 void OnEulaAccepted() override {
177 // Emulate a browser foregrounded event. 177 // Emulate a persistent fetch - we really want to fetch, initially!
178 scheduler_->OnBrowserForegrounded(); 178 // TODO(jkrcal): Find a cleaner solution. This is somewhat hacky and can
179 // mess up with metrics.
180 scheduler_->OnPersistentSchedulerWakeUp();
179 } 181 }
180 182
181 private: 183 private:
182 std::unique_ptr<web_resource::EulaAcceptedNotifier> eula_notifier_; 184 std::unique_ptr<web_resource::EulaAcceptedNotifier> eula_notifier_;
183 RemoteSuggestionsScheduler* scheduler_; 185 RemoteSuggestionsScheduler* scheduler_;
184 186
185 DISALLOW_COPY_AND_ASSIGN(EulaState); 187 DISALLOW_COPY_AND_ASSIGN(EulaState);
186 }; 188 };
187 189
188 // static 190 // static
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 return enabled_types; 577 return enabled_types;
576 } 578 }
577 579
578 std::set<RemoteSuggestionsSchedulerImpl::TriggerType> 580 std::set<RemoteSuggestionsSchedulerImpl::TriggerType>
579 RemoteSuggestionsSchedulerImpl::GetDefaultEnabledTriggerTypes() { 581 RemoteSuggestionsSchedulerImpl::GetDefaultEnabledTriggerTypes() {
580 return {TriggerType::PERSISTENT_SCHEDULER_WAKE_UP, TriggerType::NTP_OPENED, 582 return {TriggerType::PERSISTENT_SCHEDULER_WAKE_UP, TriggerType::NTP_OPENED,
581 TriggerType::BROWSER_FOREGROUNDED}; 583 TriggerType::BROWSER_FOREGROUNDED};
582 } 584 }
583 585
584 } // namespace ntp_snippets 586 } // 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