1 // Copyright (c) 2012 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 CONTENT_BROWSER_DEVICE_ORIENTATION_OBSERVER_DELEGATE_H_
6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_OBSERVER_DELEGATE_H_
8 #include "content/browser/device_orientation/device_data.h"
9 #include "content/browser/device_orientation/provider.h"
17 class ObserverDelegate
18 : public base::RefCounted
<ObserverDelegate
>, public Provider::Observer
{
20 // Create ObserverDelegate that observes provider and forwards updates to
22 // Will stop observing provider when destructed.
23 ObserverDelegate(DeviceData::Type device_data_type
, Provider
* provider
,
24 int render_view_id
, IPC::Sender
* sender
);
26 // From Provider::Observer.
27 virtual void OnDeviceDataUpdate(const DeviceData
* device_data
,
28 DeviceData::Type device_data_type
) OVERRIDE
;
31 static DeviceData
* EmptyDeviceData(DeviceData::Type type
);
33 friend class base::RefCounted
<ObserverDelegate
>;
34 virtual ~ObserverDelegate();
36 scoped_refptr
<Provider
> provider_
;
38 IPC::Sender
* sender_
; // Weak pointer.
40 DISALLOW_COPY_AND_ASSIGN(ObserverDelegate
);
43 } // namespace content
45 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_OBSERVER_DELEGATE_H_