OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |