Chromium Code Reviews| 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/scheduling_remote_suggestions_provider. h" | 5 #include "components/ntp_snippets/remote/scheduling_remote_suggestions_provider. h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 underlying_provider_ = underlying_provider.get(); | 139 underlying_provider_ = underlying_provider.get(); |
| 140 | 140 |
| 141 auto test_clock = base::MakeUnique<base::SimpleTestClock>(); | 141 auto test_clock = base::MakeUnique<base::SimpleTestClock>(); |
| 142 test_clock_ = test_clock.get(); | 142 test_clock_ = test_clock.get(); |
| 143 test_clock_->SetNow(base::Time::Now()); | 143 test_clock_->SetNow(base::Time::Now()); |
| 144 | 144 |
| 145 scheduling_provider_ = | 145 scheduling_provider_ = |
| 146 base::MakeUnique<SchedulingRemoteSuggestionsProvider>( | 146 base::MakeUnique<SchedulingRemoteSuggestionsProvider>( |
| 147 /*observer=*/nullptr, std::move(underlying_provider), | 147 /*observer=*/nullptr, std::move(underlying_provider), |
| 148 &persistent_scheduler_, &user_classifier_, utils_.pref_service(), | 148 &persistent_scheduler_, &user_classifier_, utils_.pref_service(), |
| 149 std::move(test_clock)); | 149 utils_.pref_service(), std::move(test_clock)); |
| 150 } | 150 } |
| 151 | 151 |
|
tschumann
2017/03/22 09:47:02
(I could have sworn I wrote this comment yesterday
jkrcal
2017/03/22 16:48:01
Done.
| |
| 152 void SetVariationParameter(const std::string& param_name, | 152 void SetVariationParameter(const std::string& param_name, |
| 153 const std::string& param_value) { | 153 const std::string& param_value) { |
| 154 std::map<std::string, std::string> params = default_variation_params_; | 154 std::map<std::string, std::string> params = default_variation_params_; |
| 155 params[param_name] = param_value; | 155 params[param_name] = param_value; |
| 156 | 156 |
| 157 params_manager_.ClearAllVariationParams(); | 157 params_manager_.ClearAllVariationParams(); |
| 158 params_manager_.SetVariationParamsWithFeatureAssociations( | 158 params_manager_.SetVariationParamsWithFeatureAssociations( |
| 159 ntp_snippets::kStudyName, params, | 159 ntp_snippets::kStudyName, params, |
| 160 {ntp_snippets::kArticleSuggestionsFeature.name}); | 160 {ntp_snippets::kArticleSuggestionsFeature.name}); |
| 161 } | 161 } |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 759 for (int x = 0; x < 5; ++x) { | 759 for (int x = 0; x < 5; ++x) { |
| 760 scheduling_provider_->OnPersistentSchedulerWakeUp(); | 760 scheduling_provider_->OnPersistentSchedulerWakeUp(); |
| 761 signal_fetch_done.Run(Status::Success()); | 761 signal_fetch_done.Run(Status::Success()); |
| 762 } | 762 } |
| 763 | 763 |
| 764 // For the 6th time, it is blocked by the scheduling provider. | 764 // For the 6th time, it is blocked by the scheduling provider. |
| 765 scheduling_provider_->OnPersistentSchedulerWakeUp(); | 765 scheduling_provider_->OnPersistentSchedulerWakeUp(); |
| 766 } | 766 } |
| 767 | 767 |
| 768 } // namespace ntp_snippets | 768 } // namespace ntp_snippets |
| OLD | NEW |