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