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

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

Issue 10383262: RefCounted types should not have public destructors, delegate cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make win bot happy 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_H_ 5 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_H_
6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_H_ 6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 10
11 namespace device_orientation { 11 namespace device_orientation {
12 12
13 class Orientation; 13 class Orientation;
14 14
15 class CONTENT_EXPORT Provider : public base::RefCountedThreadSafe<Provider> { 15 class CONTENT_EXPORT Provider : public base::RefCountedThreadSafe<Provider> {
16 public: 16 public:
17 class Observer { 17 class Observer {
18 public: 18 public:
19 // Called when the orientation changes. 19 // Called when the orientation changes.
20 // An Observer must not synchronously call Provider::RemoveObserver 20 // An Observer must not synchronously call Provider::RemoveObserver
21 // or Provider::AddObserver when this is called. 21 // or Provider::AddObserver when this is called.
22 virtual void OnOrientationUpdate(const Orientation& orientation) = 0; 22 virtual void OnOrientationUpdate(const Orientation& orientation) = 0;
23
24 protected:
25 virtual ~Observer() {}
23 }; 26 };
24 27
25 // Returns a pointer to the singleton instance of this class. 28 // Returns a pointer to the singleton instance of this class.
26 // The caller should store the returned pointer in a scoped_refptr. 29 // The caller should store the returned pointer in a scoped_refptr.
27 // The Provider instance is lazily constructed when GetInstance() is called, 30 // The Provider instance is lazily constructed when GetInstance() is called,
28 // and destructed when the last scoped_refptr referring to it is destructed. 31 // and destructed when the last scoped_refptr referring to it is destructed.
29 static Provider* GetInstance(); 32 static Provider* GetInstance();
30 33
31 // Inject a mock Provider for testing. Only a weak pointer to the injected 34 // Inject a mock Provider for testing. Only a weak pointer to the injected
32 // object will be held by Provider, i.e. it does not itself contribute to the 35 // object will be held by Provider, i.e. it does not itself contribute to the
(...skipping 15 matching lines...) Expand all
48 private: 51 private:
49 friend class base::RefCountedThreadSafe<Provider>; 52 friend class base::RefCountedThreadSafe<Provider>;
50 static Provider* instance_; 53 static Provider* instance_;
51 54
52 DISALLOW_COPY_AND_ASSIGN(Provider); 55 DISALLOW_COPY_AND_ASSIGN(Provider);
53 }; 56 };
54 57
55 } // namespace device_orientation 58 } // namespace device_orientation
56 59
57 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_H_ 60 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/test/automation/javascript_execution_controller.cc ('k') | content/browser/download/download_item_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698