diff options
Diffstat (limited to 'chromium/ui/base/prediction/empty_predictor.cc')
-rw-r--r-- | chromium/ui/base/prediction/empty_predictor.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/chromium/ui/base/prediction/empty_predictor.cc b/chromium/ui/base/prediction/empty_predictor.cc new file mode 100644 index 00000000000..98598808b49 --- /dev/null +++ b/chromium/ui/base/prediction/empty_predictor.cc @@ -0,0 +1,43 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/prediction/empty_predictor.h" +#include "ui/base/ui_base_features.h" + +namespace ui { + +EmptyPredictor::EmptyPredictor() { + Reset(); +} + +EmptyPredictor::~EmptyPredictor() = default; + +const char* EmptyPredictor::GetName() const { + return features::kPredictorNameEmpty; +} + +void EmptyPredictor::Reset() { + last_input_ = base::nullopt; +} + +void EmptyPredictor::Update(const InputData& cur_input) { + last_input_ = cur_input; +} + +bool EmptyPredictor::HasPrediction() const { + return last_input_.has_value(); +} + +std::unique_ptr<InputPredictor::InputData> EmptyPredictor::GeneratePrediction( + base::TimeTicks predict_time) const { + if (!HasPrediction()) + return nullptr; + return std::make_unique<InputData>(last_input_.value()); +} + +base::TimeDelta EmptyPredictor::TimeInterval() const { + return kTimeInterval; +} + +} // namespace ui |