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

Unified Diff: chrome/browser/device_orientation/dispatcher_host.h

Issue 3152043: device_orientation::DispatcherHost: one Provider observer per render_view_id. (Closed)
Patch Set: Patch Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/device_orientation/dispatcher_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/device_orientation/dispatcher_host.h
diff --git a/chrome/browser/device_orientation/dispatcher_host.h b/chrome/browser/device_orientation/dispatcher_host.h
index f43a68bcd5dae84cb996f563b8d0f007bc4cb705..d30e8201aed65ad055fa8d47fb1365a4c2222f8c 100644
--- a/chrome/browser/device_orientation/dispatcher_host.h
+++ b/chrome/browser/device_orientation/dispatcher_host.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_DEVICE_ORIENTATION_DISPATCHER_HOST_H_
#define CHROME_BROWSER_DEVICE_ORIENTATION_DISPATCHER_HOST_H_
-#include <set>
+#include <map>
#include "base/ref_counted.h"
#include "chrome/browser/device_orientation/provider.h"
@@ -16,24 +16,26 @@ namespace device_orientation {
class Orientation;
-class DispatcherHost : public base::RefCountedThreadSafe<DispatcherHost>,
- public Provider::Observer {
+class DispatcherHost : public base::RefCounted<DispatcherHost> {
public:
explicit DispatcherHost(int process_id);
bool OnMessageReceived(const IPC::Message& msg, bool* msg_was_ok);
- // From Provider::Observer.
- virtual void OnOrientationUpdate(const Orientation& orientation);
-
private:
virtual ~DispatcherHost();
- friend class base::RefCountedThreadSafe<DispatcherHost>;
+ friend class base::RefCounted<DispatcherHost>;
void OnStartUpdating(int render_view_id);
void OnStopUpdating(int render_view_id);
+ // Helper class that observes a Provider and forwards updates to a RenderView.
+ class ObserverDelegate;
+
int process_id_;
- std::set<int> render_view_ids_;
+
+ // map from render_view_id to ObserverDelegate.
+ std::map<int, scoped_refptr<ObserverDelegate> > observers_map_;
+
scoped_refptr<Provider> provider_;
DISALLOW_COPY_AND_ASSIGN(DispatcherHost);
« no previous file with comments | « no previous file | chrome/browser/device_orientation/dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698