Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: ios/chrome/browser/omnibox/omnibox_event_global_tracker.h

Issue 1245683002: Implements N:M forwarding of OmniboxEditModel events on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments by blundell Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ios/chrome/browser/omnibox/omnibox_event_global_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 IOS_CHROME_BROWSER_OMNIBOX_OMNIBOX_EVENT_GLOBAL_TRACKER_H_
6 #define IOS_CHROME_BROWSER_OMNIBOX_OMNIBOX_EVENT_GLOBAL_TRACKER_H_
7
8 #include "base/callback_list.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11
12 template <typename T>
13 struct DefaultSingletonTraits;
14
15 struct OmniboxLog;
16
17 // Omnibox code tracks events on a per-BrowserState basis, but there are
18 // several clients who need to observe these events for all BrowserStates.
19 // This class serves as an intermediary to bridge the gap: omnibox code calls
20 // the OmniboxEventGlobalTracker singleton on an event of interest, and it
21 // then forwards the event to its registered observers.
22 class OmniboxEventGlobalTracker {
23 public:
24 typedef base::Callback<void(OmniboxLog*)> OnURLOpenedCallback;
25
26 // Returns the instance of OmniboxEventGlobalTracker.
27 static OmniboxEventGlobalTracker* GetInstance();
28
29 // Registers |cb| to be invoked when user open an URL from the omnibox.
30 scoped_ptr<base::CallbackList<void(OmniboxLog*)>::Subscription>
31 RegisterCallback(const OnURLOpenedCallback& cb);
32
33 // Called to notify all registered callbacks that an URL was opened from
34 // the omnibox.
35 void OnURLOpened(OmniboxLog* log);
36
37 private:
38 friend struct DefaultSingletonTraits<OmniboxEventGlobalTracker>;
39
40 OmniboxEventGlobalTracker();
41 ~OmniboxEventGlobalTracker();
42
43 base::CallbackList<void(OmniboxLog*)> on_url_opened_callback_list_;
44
45 DISALLOW_COPY_AND_ASSIGN(OmniboxEventGlobalTracker);
46 };
47
48 #endif // IOS_CHROME_BROWSER_OMNIBOX_OMNIBOX_EVENT_GLOBAL_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/omnibox/omnibox_event_global_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698