summaryrefslogtreecommitdiff
path: root/chromium/components/optimization_guide/optimization_guide_service_observer.h
blob: 6dcadf6c1380d32e0e58853da511b2dd2cd7c9c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// 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 COMPONENTS_OPTIMIZATION_GUIDE_OPTIMIZATION_GUIDE_SERVICE_OBSERVER_H_
#define COMPONENTS_OPTIMIZATION_GUIDE_OPTIMIZATION_GUIDE_SERVICE_OBSERVER_H_

#include "components/optimization_guide/proto/hints.pb.h"

namespace optimization_guide {

// Encapsulates information about a version of optimization hints data received
// from the components server.
struct ComponentInfo {
  ComponentInfo(const base::Version& hints_version,
                const base::FilePath& hints_path);
  ~ComponentInfo();

  // The version of the hints content.
  const base::Version hints_version;

  // The path to the file containing the hints protobuf file.
  const base::FilePath hints_path;
};

// Interface for objects that wish to be notified of changes in the Optimization
// Guide Service.
//
// All calls will be made on the IO thread.
class OptimizationGuideServiceObserver {
 public:
  // Called when the hints have been processed.
  virtual void OnHintsProcessed(
      const proto::Configuration& config,
      const optimization_guide::ComponentInfo& component_info) = 0;

 protected:
  virtual ~OptimizationGuideServiceObserver() {}
};

}  // namespace optimization_guide

#endif  // COMPONENTS_OPTIMIZATION_GUIDE_OPTIMIZATION_GUIDE_SERVICE_OBSERVER_H_