OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_RLZ_RLZ_TRACKER_DELEGATE_H_ | |
6 #define COMPONENTS_RLZ_RLZ_TRACKER_DELEGATE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/callback_forward.h" | |
11 #include "base/macros.h" | |
12 #include "base/strings/string16.h" | |
13 #include "base/threading/sequenced_worker_pool.h" | |
14 | |
15 namespace base { | |
16 class SequencedWorkerPool; | |
17 } | |
18 | |
19 namespace net { | |
20 class URLRequestContextGetter; | |
21 } | |
22 | |
23 namespace rlz { | |
24 | |
25 // RLZTrackerDelegate is an abstract interface that provides access to embedder | |
26 // specific singletons or gives information about the embedder environment. | |
27 class RLZTrackerDelegate { | |
28 public: | |
29 RLZTrackerDelegate() {} | |
30 virtual ~RLZTrackerDelegate() {} | |
31 | |
32 // Invoked during RLZTracker cleanup, to request the cleanup of the delegate. | |
33 virtual void Cleanup() = 0; | |
34 | |
35 // Returns whether the current thread is the UI thread. | |
36 virtual bool IsOnUIThread() = 0; | |
37 | |
38 // Returns the SequencedWorkerPool where the RLZTracker will post its tasks | |
39 // that should be executed in the background. | |
40 virtual base::SequencedWorkerPool* GetBlockingPool() = 0; | |
41 | |
42 // Returns the URLRequestContextGetter to use for network connections. | |
43 virtual net::URLRequestContextGetter* GetRequestContext() = 0; | |
44 | |
45 // Returns the brand code for the installation of Chrome in |brand| and a | |
46 // boolean indicating whether the operation was a success or not. | |
47 virtual bool GetBrand(std::string* brand) = 0; | |
48 | |
49 // Returns whether |brand| is an organic brand. | |
50 virtual bool IsBrandOrganic(const std::string& brand) = 0; | |
51 | |
52 // Returns the reactivation brand code for Chrome in |brand| and a boolean | |
53 // indicating whether the operation was a success or not. | |
54 virtual bool GetReactivationBrand(std::string* brand) = 0; | |
55 | |
56 // Returns true if RLZTracker should ignore initial delay for testing. | |
57 virtual bool ShouldEnableZeroDelayForTesting() = 0; | |
58 | |
59 // Returns the installation language in |language| and a boolean indicating | |
60 // whether the operation was a success or not. | |
61 virtual bool GetLanguage(base::string16* language) = 0; | |
62 | |
63 // Returns the referral code in |referral| and a boolean indicating whether | |
64 // the operation was a success or not. Deprecated. | |
65 virtual bool GetReferral(base::string16* referral) = 0; | |
66 | |
67 // Clears the referral code. Deprecated. | |
68 virtual bool ClearReferral() = 0; | |
69 | |
70 // Registers |callback| to be invoked the next time the user perform a search | |
71 // using Google search engine via the omnibox. Callback will invoked at most | |
72 // once. | |
73 virtual void SetOmniboxSearchCallback(const base::Closure& callback) = 0; | |
74 | |
75 // Registers |callback| to be invoked the next time the user perform a search | |
76 // using Google search engine via the homepage. Callback will invoked at most | |
77 // once. | |
78 virtual void SetHomepageSearchCallback(const base::Closure& callback) = 0; | |
79 | |
80 private: | |
81 DISALLOW_COPY_AND_ASSIGN(RLZTrackerDelegate); | |
82 }; | |
83 | |
84 } // namespace rlz | |
85 | |
86 #endif // COMPONENTS_RLZ_RLZ_TRACKER_DELEGATE_H_ | |
OLD | NEW |