OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 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 CHROME_BROWSER_DEVICE_ORIENTATION_DISPATCHER_HOST_H_ | |
6 #define CHROME_BROWSER_DEVICE_ORIENTATION_DISPATCHER_HOST_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/ref_counted.h" | |
11 #include "chrome/browser/device_orientation/provider.h" | |
12 | |
13 namespace IPC { class Message; } | |
14 | |
15 namespace device_orientation { | |
16 | |
17 class Orientation; | |
18 | |
19 class DispatcherHost : public base::RefCounted<DispatcherHost> { | |
20 public: | |
21 explicit DispatcherHost(int process_id); | |
22 bool OnMessageReceived(const IPC::Message& msg, bool* msg_was_ok); | |
23 | |
24 private: | |
25 virtual ~DispatcherHost(); | |
26 friend class base::RefCounted<DispatcherHost>; | |
27 | |
28 void OnStartUpdating(int render_view_id); | |
29 void OnStopUpdating(int render_view_id); | |
30 | |
31 // Helper class that observes a Provider and forwards updates to a RenderView. | |
32 class ObserverDelegate; | |
33 | |
34 int process_id_; | |
35 | |
36 // map from render_view_id to ObserverDelegate. | |
37 std::map<int, scoped_refptr<ObserverDelegate> > observers_map_; | |
38 | |
39 scoped_refptr<Provider> provider_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(DispatcherHost); | |
42 }; | |
43 | |
44 } // namespace device_orientation | |
45 | |
46 #endif // CHROME_BROWSER_DEVICE_ORIENTATION_DISPATCHER_HOST_H_ | |
OLD | NEW |