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 IOS_CHROME_BROWSER_RLZ_RLZ_TRACKER_DELEGATE_IMPL_H_
6 #define IOS_CHROME_BROWSER_RLZ_RLZ_TRACKER_DELEGATE_IMPL_H_
8 #include "base/callback.h"
9 #include "base/callback_list.h"
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "components/rlz/rlz_tracker_delegate.h"
17 class ChromeBrowserState
;
20 // RLZTrackerDelegateImpl implements RLZTrackerDelegate abstract interface
21 // and provides access to Chrome on iOS features.
22 class RLZTrackerDelegateImpl
: public rlz::RLZTrackerDelegate
{
24 RLZTrackerDelegateImpl();
25 ~RLZTrackerDelegateImpl() override
;
27 static bool IsGoogleDefaultSearch(ios::ChromeBrowserState
* browser_state
);
28 static bool IsGoogleHomepage(ios::ChromeBrowserState
* browser_state
);
29 static bool IsGoogleInStartpages(ios::ChromeBrowserState
* browser_state
);
32 // RLZTrackerDelegate implementation.
33 void Cleanup() override
;
34 bool IsOnUIThread() override
;
35 base::SequencedWorkerPool
* GetBlockingPool() override
;
36 net::URLRequestContextGetter
* GetRequestContext() override
;
37 bool GetBrand(std::string
* brand
) override
;
38 bool IsBrandOrganic(const std::string
& brand
) override
;
39 bool GetReactivationBrand(std::string
* brand
) override
;
40 bool ShouldEnableZeroDelayForTesting() override
;
41 bool GetLanguage(base::string16
* language
) override
;
42 bool GetReferral(base::string16
* referral
) override
;
43 bool ClearReferral() override
;
44 void SetOmniboxSearchCallback(const base::Closure
& callback
) override
;
45 void SetHomepageSearchCallback(const base::Closure
& callback
) override
;
47 // Called when user open an URL from the Omnibox.
48 void OnURLOpenedFromOmnibox(OmniboxLog
* log
);
50 base::Closure on_omnibox_search_callback_
;
51 scoped_ptr
<base::CallbackList
<void(OmniboxLog
*)>::Subscription
>
52 on_omnibox_url_opened_subscription_
;
54 DISALLOW_COPY_AND_ASSIGN(RLZTrackerDelegateImpl
);
57 #endif // IOS_CHROME_BROWSER_RLZ_RLZ_TRACKER_DELEGATE_IMPL_H_