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

Side by Side Diff: content/browser/device_orientation/observer_delegate.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/device_orientation/observer_delegate.h" 5 #include "content/browser/device_orientation/observer_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/device_orientation/device_data.h" 8 #include "content/browser/device_orientation/device_data.h"
9 #include "content/browser/device_orientation/motion.h" 9 #include "content/browser/device_orientation/motion.h"
10 #include "content/browser/device_orientation/orientation.h" 10 #include "content/browser/device_orientation/orientation.h"
(...skipping 11 matching lines...) Expand all
22 provider_->AddObserver(this); 22 provider_->AddObserver(this);
23 } 23 }
24 24
25 ObserverDelegate::~ObserverDelegate() { 25 ObserverDelegate::~ObserverDelegate() {
26 provider_->RemoveObserver(this); 26 provider_->RemoveObserver(this);
27 } 27 }
28 28
29 void ObserverDelegate::OnDeviceDataUpdate( 29 void ObserverDelegate::OnDeviceDataUpdate(
30 const DeviceData* device_data, DeviceData::Type device_data_type) { 30 const DeviceData* device_data, DeviceData::Type device_data_type) {
31 scoped_refptr<const DeviceData> new_device_data(device_data); 31 scoped_refptr<const DeviceData> new_device_data(device_data);
32 if (!new_device_data) 32 if (!new_device_data.get())
33 new_device_data = EmptyDeviceData(device_data_type); 33 new_device_data = EmptyDeviceData(device_data_type);
34 34
35 sender_->Send(new_device_data->CreateIPCMessage(render_view_id_)); 35 sender_->Send(new_device_data->CreateIPCMessage(render_view_id_));
36 } 36 }
37 37
38 DeviceData* ObserverDelegate::EmptyDeviceData(DeviceData::Type type) { 38 DeviceData* ObserverDelegate::EmptyDeviceData(DeviceData::Type type) {
39 switch (type) { 39 switch (type) {
40 case DeviceData::kTypeMotion: 40 case DeviceData::kTypeMotion:
41 return new Motion(); 41 return new Motion();
42 case DeviceData::kTypeOrientation: 42 case DeviceData::kTypeOrientation:
43 return new Orientation(); 43 return new Orientation();
44 case DeviceData::kTypeTest: 44 case DeviceData::kTypeTest:
45 NOTREACHED(); 45 NOTREACHED();
46 } 46 }
47 NOTREACHED(); 47 NOTREACHED();
48 return NULL; 48 return NULL;
49 } 49 }
50 50
51 } // namespace content 51 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/device_orientation/message_filter.cc ('k') | content/browser/device_orientation/provider_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698