screen_orientation_provider.h revision 1320f92c476a1ad9d19dba2a48c72b75566198e9
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 3// found in the LICENSE file. 4 5#ifndef CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_PROVIDER_H_ 6#define CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_PROVIDER_H_ 7 8#include "base/macros.h" 9#include "content/common/content_export.h" 10#include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" 11 12namespace content { 13 14class ScreenOrientationDispatcherHost; 15class WebContents; 16 17// Interface that needs to be implemented by any backend that wants to handle 18// screen orientation lock/unlock. 19class CONTENT_EXPORT ScreenOrientationProvider { 20 public: 21 // Lock the screen orientation to |orientations|. 22 virtual void LockOrientation( 23 int request_id, 24 blink::WebScreenOrientationLockType orientations) = 0; 25 26 // Unlock the screen orientation. 27 virtual void UnlockOrientation() = 0; 28 29 // Inform about a screen orientation update. It is called to let the provider 30 // know if a lock has been resolved. 31 virtual void OnOrientationChange() = 0; 32 33 virtual ~ScreenOrientationProvider() {} 34 35 protected: 36 friend class ScreenOrientationDispatcherHostImpl; 37 38 static ScreenOrientationProvider* Create( 39 ScreenOrientationDispatcherHost* dispatcher_host, 40 WebContents* web_contents); 41 42 ScreenOrientationProvider() {} 43 44 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProvider); 45}; 46 47#if !defined(OS_ANDROID) 48// static 49ScreenOrientationProvider* ScreenOrientationProvider::Create( 50 ScreenOrientationDispatcherHost* dispatcher_host, 51 WebContents* web_contents) { 52 return NULL; 53} 54#endif // !defined(OS_ANDROID) 55 56} // namespace content 57 58#endif // CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_PROVIDER_H_ 59