Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / rlz / chrome_rlz_tracker_delegate.h
blob0e48175f0c5ec6e880cc0114ab410790db9f414a
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 CHROME_BROWSER_RLZ_CHROME_RLZ_TRACKER_DELEGATE_H_
6 #define CHROME_BROWSER_RLZ_CHROME_RLZ_TRACKER_DELEGATE_H_
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "components/omnibox/browser/omnibox_event_global_tracker.h"
11 #include "components/rlz/rlz_tracker_delegate.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
15 class Profile;
17 // ChromeRLZTrackerDelegate implements RLZTrackerDelegate abstract interface
18 // and provides access to Chrome features.
19 class ChromeRLZTrackerDelegate : public rlz::RLZTrackerDelegate,
20 public content::NotificationObserver {
21 public:
22 ChromeRLZTrackerDelegate();
23 ~ChromeRLZTrackerDelegate() override;
25 static bool IsGoogleDefaultSearch(Profile* profile);
26 static bool IsGoogleHomepage(Profile* profile);
27 static bool IsGoogleInStartpages(Profile* profile);
29 private:
30 // RLZTrackerDelegate implementation.
31 void Cleanup() override;
32 bool IsOnUIThread() override;
33 base::SequencedWorkerPool* GetBlockingPool() override;
34 net::URLRequestContextGetter* GetRequestContext() override;
35 bool GetBrand(std::string* brand) override;
36 bool IsBrandOrganic(const std::string& brand) override;
37 bool GetReactivationBrand(std::string* brand) override;
38 bool ShouldEnableZeroDelayForTesting() override;
39 bool GetLanguage(base::string16* language) override;
40 bool GetReferral(base::string16* referral) override;
41 bool ClearReferral() override;
42 void SetOmniboxSearchCallback(const base::Closure& callback) override;
43 void SetHomepageSearchCallback(const base::Closure& callback) override;
45 // content::NotificationObserver implementation:
46 void Observe(int type,
47 const content::NotificationSource& source,
48 const content::NotificationDetails& details) override;
50 // Called when a URL is opened from the Omnibox.
51 void OnURLOpenedFromOmnibox(OmniboxLog* log);
53 content::NotificationRegistrar registrar_;
54 base::Closure on_omnibox_search_callback_;
55 base::Closure on_homepage_search_callback_;
57 // Subscription for receiving callbacks that a URL was opened from the
58 // omnibox.
59 scoped_ptr<base::CallbackList<void(OmniboxLog*)>::Subscription>
60 omnibox_url_opened_subscription_;
62 DISALLOW_COPY_AND_ASSIGN(ChromeRLZTrackerDelegate);
65 #endif // CHROME_BROWSER_RLZ_CHROME_RLZ_TRACKER_DELEGATE_H_