Home | History | Annotate | Download | only in device_orientation
      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 #include "content/browser/device_orientation/message_filter.h"
      6 
      7 #include "content/browser/device_orientation/observer_delegate.h"
      8 #include "content/browser/device_orientation/provider.h"
      9 #include "content/public/browser/browser_thread.h"
     10 
     11 namespace content {
     12 
     13 DeviceOrientationMessageFilterOld::DeviceOrientationMessageFilterOld(
     14     DeviceData::Type device_data_type)
     15     : provider_(NULL),
     16       device_data_type_(device_data_type) {
     17 }
     18 
     19 DeviceOrientationMessageFilterOld::~DeviceOrientationMessageFilterOld() {
     20 }
     21 
     22 void DeviceOrientationMessageFilterOld::OnStartUpdating(int render_view_id) {
     23   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
     24 
     25   if (!provider_.get())
     26     provider_ = Provider::GetInstance();
     27 
     28   observers_map_[render_view_id] = new ObserverDelegate(
     29       device_data_type_, provider_.get(), render_view_id, this);
     30 }
     31 
     32 void DeviceOrientationMessageFilterOld::OnStopUpdating(int render_view_id) {
     33   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
     34 
     35   observers_map_.erase(render_view_id);
     36 }
     37 
     38 }  // namespace content
     39