summaryrefslogtreecommitdiffstats
path: root/chrome/browser/rlz/rlz_extension_api.h
blob: 47c79402551eb7841ae043aa2629ccb33038bd74 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) 2012 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_RLZ_RLZ_EXTENSION_API_H_
#define CHROME_BROWSER_RLZ_RLZ_EXTENSION_API_H_

#include "build/build_config.h"

#if defined(ENABLE_RLZ)

#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/extension_function.h"
#include "rlz/lib/lib_values.h"

class RlzRecordProductEventFunction : public SyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.recordProductEvent")

 protected:
  virtual ~RlzRecordProductEventFunction() {}

  // ExtensionFunction:
  virtual bool RunImpl() OVERRIDE;
};

class RlzGetAccessPointRlzFunction : public SyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.getAccessPointRlz")

 protected:
  virtual ~RlzGetAccessPointRlzFunction() {}

  // ExtensionFunction:
  virtual bool RunImpl() OVERRIDE;
};

class RlzSendFinancialPingFunction : public AsyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.sendFinancialPing")

  RlzSendFinancialPingFunction();

 protected:
  friend class MockRlzSendFinancialPingFunction;
  virtual ~RlzSendFinancialPingFunction();

  // ExtensionFunction:
  virtual bool RunImpl() OVERRIDE;

 private:
  void WorkOnWorkerThread();
  void RespondOnUIThread();

  rlz_lib::Product product_;
  scoped_array<rlz_lib::AccessPoint> access_points_;
  std::string signature_;
  std::string brand_;
  std::string id_;
  std::string lang_;
  bool exclude_machine_id_;
};

class RlzClearProductStateFunction : public SyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.rlz.clearProductState")

 protected:
  virtual ~RlzClearProductStateFunction() {}

  // ExtensionFunction:
  virtual bool RunImpl() OVERRIDE;
};

#endif  // defined(ENABLE_RLZ)

#endif  // CHROME_BROWSER_RLZ_RLZ_EXTENSION_API_H_