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.
5 #ifndef COMPONENTS_RLZ_RLZ_TRACKER_DELEGATE_H_
6 #define COMPONENTS_RLZ_RLZ_TRACKER_DELEGATE_H_
10 #include "base/callback_forward.h"
11 #include "base/macros.h"
12 #include "base/strings/string16.h"
15 class URLRequestContextGetter;
20 // RLZTrackerDelegate is an abstract interface that provides access to embedder
21 // specific singletons or gives information about the embedder environment.
22 class RLZTrackerDelegate {
24 RLZTrackerDelegate() {}
25 virtual ~RLZTrackerDelegate() {}
27 // Invoked during RLZTracker cleanup, to request the cleanup of the delegate.
28 virtual void Cleanup() = 0;
30 // Returns whether the current thread is the UI thread.
31 virtual bool IsOnUIThread() = 0;
33 // Returns the URLRequestContextGetter to use for network connections.
34 virtual net::URLRequestContextGetter* GetRequestContext() = 0;
36 // Returns the brand code for the installation of Chrome in |brand| and a
37 // boolean indicating whether the operation was a success or not.
38 virtual bool GetBrand(std::string* brand) = 0;
40 // Returns whether |brand| is an organic brand.
41 virtual bool IsBrandOrganic(const std::string& brand) = 0;
43 // Returns the reactivation brand code for Chrome in |brand| and a boolean
44 // indicating whether the operation was a success or not.
45 virtual bool GetReactivationBrand(std::string* brand) = 0;
47 // Returns true if RLZTracker should ignore initial delay for testing.
48 virtual bool ShouldEnableZeroDelayForTesting() = 0;
50 // Returns the installation language in |language| and a boolean indicating
51 // whether the operation was a success or not.
52 virtual bool GetLanguage(base::string16* language) = 0;
54 // Returns the referral code in |referral| and a boolean indicating whether
55 // the operation was a success or not. Deprecated.
56 virtual bool GetReferral(base::string16* referral) = 0;
58 // Clears the referral code. Deprecated.
59 virtual bool ClearReferral() = 0;
61 // Registers |callback| to be invoked the next time the user perform a search
62 // using Google search engine via the omnibox. Callback will invoked at most
64 virtual void SetOmniboxSearchCallback(const base::Closure& callback) = 0;
66 // Registers |callback| to be invoked the next time the user perform a search
67 // using Google search engine via the homepage. Callback will invoked at most
69 virtual void SetHomepageSearchCallback(const base::Closure& callback) = 0;
72 DISALLOW_COPY_AND_ASSIGN(RLZTrackerDelegate);
77 #endif // COMPONENTS_RLZ_RLZ_TRACKER_DELEGATE_H_