| 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/callback.h" | 
| 8 #include "base/macros.h" | 9 #include "base/macros.h" | 
| 9 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" | 
| 10 #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" | 11 #include "content/public/common/screen_orientation.mojom.h" | 
| 11 | 12 | 
| 12 namespace content { | 13 namespace content { | 
| 13 | 14 | 
| 14 class ScreenOrientationDispatcherHost; |  | 
| 15 class WebContents; | 15 class WebContents; | 
| 16 | 16 | 
|  | 17 typedef base::Callback<void(ScreenOrientationLockResult)> | 
|  | 18     ScreenOrientationLockCallback; | 
|  | 19 | 
| 17 // Interface that needs to be implemented by any backend that wants to handle | 20 // Interface that needs to be implemented by any backend that wants to handle | 
| 18 // screen orientation lock/unlock. | 21 // screen orientation lock/unlock. | 
| 19 class CONTENT_EXPORT ScreenOrientationProvider { | 22 class CONTENT_EXPORT ScreenOrientationProvider { | 
| 20  public: | 23  public: | 
| 21   // Lock the screen orientation to |orientations|. | 24   // Lock the screen orientation to |lock_type|. | 
| 22   virtual void LockOrientation( | 25   virtual void LockOrientation(ScreenOrientationLockType lock_type) = 0; | 
| 23       int request_id, |  | 
| 24       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 | 
| 35  protected: | 36  protected: | 
| 36   friend class ScreenOrientationDispatcherHostImpl; | 37   friend class ScreenOrientationServiceImpl; | 
| 37 | 38 | 
| 38   static ScreenOrientationProvider* Create( | 39   static ScreenOrientationProvider* Create( | 
| 39       ScreenOrientationDispatcherHost* dispatcher_host, | 40       // The callback that should be invoked when a lock request receives a | 
|  | 41       // result. | 
|  | 42       const ScreenOrientationLockCallback& on_result_callback, | 
| 40       WebContents* web_contents); | 43       WebContents* web_contents); | 
| 41 |  | 
| 42   ScreenOrientationProvider() {} | 44   ScreenOrientationProvider() {} | 
| 43 | 45 | 
| 44   DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProvider); | 46   DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProvider); | 
| 45 }; | 47 }; | 
| 46 | 48 | 
| 47 #if !defined(OS_ANDROID) | 49 #if !defined(OS_ANDROID) | 
| 48 // static | 50 // static | 
| 49 ScreenOrientationProvider* ScreenOrientationProvider::Create( | 51 ScreenOrientationProvider* ScreenOrientationProvider::Create( | 
| 50     ScreenOrientationDispatcherHost* dispatcher_host, | 52     const ScreenOrientationLockCallback& on_result_callback, | 
| 51     WebContents* web_contents) { | 53     WebContents* web_contents) { | 
| 52   return NULL; | 54   return NULL; | 
| 53 } | 55 } | 
| 54 #endif // !defined(OS_ANDROID) | 56 #endif  // !defined(OS_ANDROID) | 
| 55 | 57 | 
| 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 | 
|---|