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 IOS_CHROME_BROWSER_OMNIBOX_OMNIBOX_EDIT_MODEL_OBSERVER_RELAY_H_ | |
6 #define IOS_CHROME_BROWSER_OMNIBOX_OMNIBOX_EDIT_MODEL_OBSERVER_RELAY_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 // OmniboxEditModelObserverRelay does N:M matching between all OmniboxEditModel | |
blundell
2015/07/21 09:11:57
How about something like:
"Omnibox code tracks ev
sdefresne
2015/07/21 12:05:31
Sounds better, done.
| |
18 // and all clients interested in the events independently of the source. | |
19 class OmniboxEditModelObserverRelay { | |
sdefresne
2015/07/21 08:26:22
I don't like this name, what do you think of "Omni
blundell
2015/07/21 09:11:57
How about "OmniboxEventGlobalTracker"?
sdefresne
2015/07/21 12:05:31
SGTM.
| |
20 public: | |
21 typedef base::Callback<void(OmniboxLog*)> OnURLOpenedCallback; | |
22 | |
23 // Returns the instance of OmniboxEditModelObserverRelay. | |
24 static OmniboxEditModelObserverRelay* GetInstance(); | |
25 | |
26 // Registers |cb| to be invoked when user open an URL from the omnibox. | |
blundell
2015/07/21 09:11:57
nit: s/an URL/a URL
sdefresne
2015/07/21 12:05:31
As discussed offline, both are correct and depends
| |
27 scoped_ptr<base::CallbackList<void(OmniboxLog*)>::Subscription> | |
28 RegisterCallback(const OnURLOpenedCallback& cb); | |
29 | |
30 // Called to notify all registered callbacks that an URL was opened from | |
31 // the omnibox. | |
32 void OnURLOpened(OmniboxLog* log); | |
33 | |
34 private: | |
35 friend struct DefaultSingletonTraits<OmniboxEditModelObserverRelay>; | |
36 | |
37 OmniboxEditModelObserverRelay(); | |
38 ~OmniboxEditModelObserverRelay(); | |
39 | |
40 base::CallbackList<void(OmniboxLog*)> on_url_opened_callback_list_; | |
41 | |
42 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModelObserverRelay); | |
43 }; | |
44 | |
45 #endif // IOS_CHROME_BROWSER_OMNIBOX_OMNIBOX_EDIT_MODEL_OBSERVER_RELAY_H_ | |
OLD | NEW |