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. 4 5#ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_MESSAGE_FILTER_H_ 6#define CONTENT_BROWSER_DEVICE_ORIENTATION_MESSAGE_FILTER_H_ 7 8#include <map> 9 10#include "content/browser/device_orientation/device_data.h" 11#include "content/public/browser/browser_message_filter.h" 12 13namespace content { 14 15// Helper class that observes a Provider and forwards updates to a RenderView. 16class ObserverDelegate; 17 18class Provider; 19 20class DeviceOrientationMessageFilterOld : public BrowserMessageFilter { 21 public: 22 // BrowserMessageFilter implementation. 23 virtual bool OnMessageReceived(const IPC::Message& message, 24 bool* message_was_ok) OVERRIDE = 0; 25 26 protected: 27 DeviceOrientationMessageFilterOld(DeviceData::Type device_data_type); 28 virtual ~DeviceOrientationMessageFilterOld(); 29 30 void OnStartUpdating(int render_view_id); 31 void OnStopUpdating(int render_view_id); 32 33 private: 34 35 // map from render_view_id to ObserverDelegate. 36 std::map<int, scoped_refptr<ObserverDelegate> > observers_map_; 37 38 scoped_refptr<Provider> provider_; 39 DeviceData::Type device_data_type_; 40}; 41 42} // namespace content 43 44#endif // CONTENT_BROWSER_DEVICE_ORIENTATION_MESSAGE_FILTER_H_ 45