Chromium Code Reviews| Index: content/browser/device_orientation/observer_delegate.h |
| diff --git a/content/browser/device_orientation/observer_delegate.h b/content/browser/device_orientation/observer_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6ee954b01f2ece5cee552374fe8b2c93e1aa0f48 |
| --- /dev/null |
| +++ b/content/browser/device_orientation/observer_delegate.h |
| @@ -0,0 +1,41 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_OBSERVER_DELEGATE_H_ |
| +#define CONTENT_BROWSER_DEVICE_ORIENTATION_OBSERVER_DELEGATE_H_ |
| + |
| +#include "content/browser/device_orientation/device_data.h" |
| +#include "content/browser/device_orientation/provider.h" |
| + |
| +namespace device_orientation { |
| + |
| +class ObserverDelegate |
| + : public base::RefCounted<ObserverDelegate>, public Provider::Observer { |
| + public: |
| + // Create ObserverDelegate that observes provider and forwards updates to |
|
hans
2012/07/18 17:21:02
this and the lines below are indented too much
aousterh
2012/07/20 11:18:52
Done.
|
| + // render_view_id in process_id. |
| + // Will stop observing provider when destructed. |
| + ObserverDelegate(DeviceData::Type device_data_type, Provider* provider, |
| + int render_view_id, IPC::Sender* sender); |
| + |
| + // From Provider::Observer. |
| + virtual void OnDeviceDataUpdate(const DeviceData* device_data, |
| + DeviceData::Type device_data_type) OVERRIDE; |
| + |
| + private: |
| + static DeviceData* EmptyDeviceData(DeviceData::Type type); |
| + |
| + friend class base::RefCounted<ObserverDelegate>; |
| + virtual ~ObserverDelegate(); |
| + |
| + scoped_refptr<Provider> provider_; |
| + int render_view_id_; |
| + IPC::Sender* sender_; // Weak pointer. |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ObserverDelegate); |
| +}; |
| + |
| +} // namespace device_orientation |
| + |
| +#endif // CONTENT_BROWSER_DEVICE_ORIENTATION_OBSERVER_DELEGATE_H_ |