Chromium Code Reviews| Index: chrome/browser/predictors/glowplug_predictor.h | 
| diff --git a/chrome/browser/predictors/glowplug_predictor.h b/chrome/browser/predictors/glowplug_predictor.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..0307f31b2061d15071f5fbab3f0f4d1b8fe05771 | 
| --- /dev/null | 
| +++ b/chrome/browser/predictors/glowplug_predictor.h | 
| @@ -0,0 +1,56 @@ | 
| +// Copyright 2017 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. | 
| + | 
| +#ifndef CHROME_BROWSER_PREDICTORS_GLOWPLUG_PREDICTOR_H_ | 
| +#define CHROME_BROWSER_PREDICTORS_GLOWPLUG_PREDICTOR_H_ | 
| + | 
| +#include <memory> | 
| + | 
| +#include "base/memory/weak_ptr.h" | 
| +#include "chrome/browser/predictors/resource_prefetch_common.h" | 
| +#include "chrome/browser/predictors/resource_prefetch_predictor.h" | 
| +#include "components/keyed_service/core/keyed_service.h" | 
| + | 
| +class Profile; | 
| + | 
| +namespace predictors { | 
| + | 
| +class ResourcePrefetchPredictor; | 
| + | 
| +// Entry point for the Glowplug predictor. | 
| +// From a high-level request (GURL and motivation) and a database of historical | 
| +// data, initiates predictive actions to speed up page loads. | 
| +// | 
| +// See ResourcePrefetchPredictor for a description of the resource prefetch | 
| +// predictor. | 
| +// | 
| +// All methods must be called from the UI thread. | 
| +class GlowplugPredictor : public KeyedService, | 
| + public base::SupportsWeakPtr<GlowplugPredictor> { | 
| + public: | 
| + GlowplugPredictor(const GlowplugPredictorConfig& config, Profile* profile); | 
| + ~GlowplugPredictor() override; | 
| + | 
| + // Hints that a page load is expected for |url|, with the hint coming from a | 
| + // given |origin|. May trigger actions, such as prefetch and/or preconnect. | 
| + void PrepareForPageLoad(const GURL& url, HintOrigin origin); | 
| + | 
| + // Indicates that a page load hint is no longer active. | 
| + void CancelPageLoadHint(const GURL& url); | 
| + | 
| + // Don't use, internal only. | 
| + ResourcePrefetchPredictor* resource_prefetch_predictor() const; | 
| + | 
| + // KeyedService methods override. | 
| 
 
alexilin
2017/05/12 14:26:45
silly nit:
/KeyedService methods override./KeyedSe
 
Benoit L
2017/05/12 15:13:11
Done.
 
 | 
| + void Shutdown() override; | 
| + | 
| + private: | 
| + std::unique_ptr<ResourcePrefetchPredictor> resource_prefetch_predictor_; | 
| + | 
| + DISALLOW_COPY_AND_ASSIGN(GlowplugPredictor); | 
| +}; | 
| + | 
| +} // namespace predictors | 
| + | 
| +#endif // CHROME_BROWSER_PREDICTORS_GLOWPLUG_PREDICTOR_H_ |