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

Side by Side Diff: content/browser/device_orientation/provider_impl.h

Issue 10698046: Implements part of Device Motion in the Renderer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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
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 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_
6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_ 6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 15 matching lines...) Expand all
26 26
27 class ProviderImpl : public Provider { 27 class ProviderImpl : public Provider {
28 public: 28 public:
29 typedef DataFetcher* (*DataFetcherFactory)(); 29 typedef DataFetcher* (*DataFetcherFactory)();
30 30
31 // Create a ProviderImpl that uses the NULL-terminated factories array to find 31 // Create a ProviderImpl that uses the NULL-terminated factories array to find
32 // a DataFetcher that can provide orientation data. 32 // a DataFetcher that can provide orientation data.
33 CONTENT_EXPORT ProviderImpl(const DataFetcherFactory factories[]); 33 CONTENT_EXPORT ProviderImpl(const DataFetcherFactory factories[]);
34 34
35 // From Provider. 35 // From Provider.
36 virtual void AddObserver(Observer* observer) OVERRIDE; 36 virtual void AddMotionObserver(MotionObserver* observer) OVERRIDE {
37 virtual void RemoveObserver(Observer* observer) OVERRIDE; 37 // TODO(aousterh): implement this
38 }
39 virtual void AddOrientationObserver(OrientationObserver* observer) OVERRIDE;
40 virtual void RemoveMotionObserver(MotionObserver* observer) OVERRIDE {
41 // TODO(aousterh): implement this
42 }
43 virtual void RemoveOrientationObserver(
44 OrientationObserver* observer) OVERRIDE;
bulach 2012/07/02 12:47:56 nit: indent +2
aousterh 2012/07/04 13:31:55 Done.
38 45
39 private: 46 private:
40 virtual ~ProviderImpl(); 47 virtual ~ProviderImpl();
41 48
42 // Starts or Stops the provider. Called from creator_loop_. 49 // Starts or Stops the provider. Called from creator_loop_.
43 void Start(); 50 void Start();
44 void Stop(); 51 void Stop();
45 52
46 // Method for finding a suitable DataFetcher and starting the polling. 53 // Method for finding a suitable DataFetcher and starting the polling.
47 // Runs on the polling_thread_. 54 // Runs on the polling_thread_.
(...skipping 15 matching lines...) Expand all
63 70
64 enum { kDesiredSamplingIntervalMs = 100 }; 71 enum { kDesiredSamplingIntervalMs = 100 };
65 base::TimeDelta SamplingInterval() const; 72 base::TimeDelta SamplingInterval() const;
66 73
67 // The Message Loop on which this object was created. 74 // The Message Loop on which this object was created.
68 // Typically the I/O loop, but may be something else during testing. 75 // Typically the I/O loop, but may be something else during testing.
69 MessageLoop* creator_loop_; 76 MessageLoop* creator_loop_;
70 77
71 // Members below are only to be used from the creator_loop_. 78 // Members below are only to be used from the creator_loop_.
72 std::vector<DataFetcherFactory> factories_; 79 std::vector<DataFetcherFactory> factories_;
73 std::set<Observer*> observers_; 80 std::set<OrientationObserver*> observers_;
74 Orientation last_notification_; 81 Orientation last_notification_;
75 82
76 // When polling_thread_ is running, members below are only to be used 83 // When polling_thread_ is running, members below are only to be used
77 // from that thread. 84 // from that thread.
78 scoped_ptr<DataFetcher> data_fetcher_; 85 scoped_ptr<DataFetcher> data_fetcher_;
79 Orientation last_orientation_; 86 Orientation last_orientation_;
80 base::WeakPtrFactory<ProviderImpl> weak_factory_; 87 base::WeakPtrFactory<ProviderImpl> weak_factory_;
81 88
82 // Polling is done on this background thread. 89 // Polling is done on this background thread.
83 scoped_ptr<base::Thread> polling_thread_; 90 scoped_ptr<base::Thread> polling_thread_;
84 }; 91 };
85 92
86 } // namespace device_orientation 93 } // namespace device_orientation
87 94
88 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_ 95 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698