File: rlz_tracker_delegate.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (85 lines) | stat: -rw-r--r-- 3,117 bytes parent folder | download | duplicates (6)
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
78
79
80
81
82
83
84
85
// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_RLZ_RLZ_TRACKER_DELEGATE_H_
#define COMPONENTS_RLZ_RLZ_TRACKER_DELEGATE_H_

#include <string>

#include "base/functional/callback_forward.h"
#include "base/memory/scoped_refptr.h"

namespace network {
class SharedURLLoaderFactory;
}  // namespace network

namespace rlz {

// RLZTrackerDelegate is an abstract interface that provides access to embedder
// specific singletons or gives information about the embedder environment.
class RLZTrackerDelegate {
 public:
  RLZTrackerDelegate() = default;

  RLZTrackerDelegate(const RLZTrackerDelegate&) = delete;
  RLZTrackerDelegate& operator=(const RLZTrackerDelegate&) = delete;

  virtual ~RLZTrackerDelegate() = default;

  // Invoked during RLZTracker cleanup, to request the cleanup of the delegate.
  virtual void Cleanup() = 0;

  // Returns whether the current thread is the UI thread.
  virtual bool IsOnUIThread() = 0;

  // Returns the SharedURLLoaderFactory to use for network connections.
  virtual scoped_refptr<network::SharedURLLoaderFactory>
  GetURLLoaderFactory() = 0;

  // Returns the brand code for the installation of Chrome in |brand| and a
  // boolean indicating whether the operation was a success or not.
  virtual bool GetBrand(std::string* brand) = 0;

  // Returns whether |brand| is an organic brand.
  virtual bool IsBrandOrganic(const std::string& brand) = 0;

  // Returns the reactivation brand code for Chrome in |brand| and a boolean
  // indicating whether the operation was a success or not.
  virtual bool GetReactivationBrand(std::string* brand) = 0;

  // Returns true if RLZTracker should ignore initial delay for testing.
  virtual bool ShouldEnableZeroDelayForTesting() = 0;

  // Returns the installation language in |language| and a boolean indicating
  // whether the operation was a success or not.
  virtual bool GetLanguage(std::u16string* language) = 0;

  // Returns the referral code in |referral| and a boolean indicating whether
  // the operation was a success or not. Deprecated.
  virtual bool GetReferral(std::u16string* referral) = 0;

  // Clears the referral code. Deprecated.
  virtual bool ClearReferral() = 0;

  // Registers |callback| to be invoked the next time the user performs a search
  // using Google search engine via the omnibox. Callback will invoked at most
  // once.
  virtual void SetOmniboxSearchCallback(base::OnceClosure callback) = 0;

  // Registers |callback| to be invoked the next time the user performs a search
  // using Google search engine via the homepage. Callback will invoked at most
  // once.
  virtual void SetHomepageSearchCallback(base::OnceClosure callback) = 0;

  // Invokes the homepage search callback if it is set.
  virtual void RunHomepageSearchCallback() = 0;

  // Returns true if the existing access point RLZ strings in the data file
  // should be updated.
  virtual bool ShouldUpdateExistingAccessPointRlz() = 0;
};

}  // namespace rlz

#endif  // COMPONENTS_RLZ_RLZ_TRACKER_DELEGATE_H_