OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PUBLIC_BROWSER_SCREEN_ORIENTATION_PROVIDER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_PROVIDER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_PROVIDER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_PROVIDER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" | 10 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 class ScreenOrientationDispatcherHost; | 14 class ScreenOrientationDispatcherHost; |
15 class ScreenOrientationProviderFactory; | |
15 class WebContents; | 16 class WebContents; |
16 | 17 |
17 // Interface that needs to be implemented by any backend that wants to handle | 18 // Interface that needs to be implemented by any backend that wants to handle |
18 // screen orientation lock/unlock. | 19 // screen orientation lock/unlock. |
19 class CONTENT_EXPORT ScreenOrientationProvider { | 20 class CONTENT_EXPORT ScreenOrientationProvider { |
20 public: | 21 public: |
21 // Lock the screen orientation to |orientations|. | 22 // Lock the screen orientation to |orientations|. |
22 virtual void LockOrientation( | 23 virtual void LockOrientation( |
23 int request_id, | 24 int request_id, |
24 blink::WebScreenOrientationLockType orientations) = 0; | 25 blink::WebScreenOrientationLockType orientations) = 0; |
25 | 26 |
26 // Unlock the screen orientation. | 27 // Unlock the screen orientation. |
27 virtual void UnlockOrientation() = 0; | 28 virtual void UnlockOrientation() = 0; |
28 | 29 |
29 // Inform about a screen orientation update. It is called to let the provider | 30 // Inform about a screen orientation update. It is called to let the provider |
30 // know if a lock has been resolved. | 31 // know if a lock has been resolved. |
31 virtual void OnOrientationChange() = 0; | 32 virtual void OnOrientationChange() = 0; |
32 | 33 |
33 virtual ~ScreenOrientationProvider() {} | 34 virtual ~ScreenOrientationProvider() {} |
34 | 35 |
36 // Creates a ScreenOrientationProvider for a ScreenOrientationDispatcherHost | |
37 // to notify. SetFactory can be used to override. | |
38 static ScreenOrientationProvider* Create( | |
mlamouri (slow - plz ping)
2014/09/16 20:21:04
Should that be an own ptr?
jonross
2014/09/16 21:48:13
Doing a code search for 'own ptr' points me to wtf
mlamouri (slow - plz ping)
2014/09/16 22:00:45
Sorry about that. I got confused with WebKit indee
| |
39 ScreenOrientationDispatcherHost* dispatcher_host, | |
40 WebContents* web_contents); | |
41 | |
42 // Provide a factory to override the creation in Create(). The factory is not | |
43 // owned by ScreenOrientationProvider. | |
44 static void SetFactory(ScreenOrientationProviderFactory* factory); | |
45 | |
35 protected: | 46 protected: |
36 friend class ScreenOrientationDispatcherHostImpl; | 47 friend class ScreenOrientationDispatcherHostImpl; |
37 | 48 |
38 static ScreenOrientationProvider* Create( | 49 ScreenOrientationProvider() {} |
39 ScreenOrientationDispatcherHost* dispatcher_host, | |
40 WebContents* web_contents); | |
41 | 50 |
42 ScreenOrientationProvider() {} | 51 private: |
52 // Not owned, overrides behaviour in Create(). | |
53 static ScreenOrientationProviderFactory* factory_; | |
43 | 54 |
44 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProvider); | 55 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProvider); |
45 }; | 56 }; |
46 | 57 |
47 #if !defined(OS_ANDROID) | |
48 // static | |
49 ScreenOrientationProvider* ScreenOrientationProvider::Create( | |
50 ScreenOrientationDispatcherHost* dispatcher_host, | |
51 WebContents* web_contents) { | |
52 return NULL; | |
53 } | |
54 #endif // !defined(OS_ANDROID) | |
55 | |
56 } // namespace content | 58 } // namespace content |
57 | 59 |
58 #endif // CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_PROVIDER_H_ | 60 #endif // CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_PROVIDER_H_ |
OLD | NEW |