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

Side by Side Diff: content/public/browser/screen_orientation_provider.h

Issue 549603003: Create Mojo service for locking/unlocking screen orientation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 6 years, 3 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 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 class WebContentsImpl;
17
18 typedef base::Callback<void(ScreenOrientationLockResult)>
19 ScreenOrientationLockCallback;
16 20
17 // Interface that needs to be implemented by any backend that wants to handle 21 // Interface that needs to be implemented by any backend that wants to handle
18 // screen orientation lock/unlock. 22 // screen orientation lock/unlock.
19 class CONTENT_EXPORT ScreenOrientationProvider { 23 class CONTENT_EXPORT ScreenOrientationProvider {
20 public: 24 public:
21 // Lock the screen orientation to |orientations|. 25 // Lock the screen orientation to |lock_type|. |callback| is the callback
26 // that should be invoked when this request receives a result.
22 virtual void LockOrientation( 27 virtual void LockOrientation(
23 int request_id, 28 ScreenOrientationLockType lock_type,
24 blink::WebScreenOrientationLockType orientations) = 0; 29 const ScreenOrientationLockCallback& callback) = 0;
25 30
26 // Unlock the screen orientation. 31 // Unlock the screen orientation.
27 virtual void UnlockOrientation() = 0; 32 virtual void UnlockOrientation() = 0;
28 33
29 // Inform about a screen orientation update. It is called to let the provider 34 // Inform about a screen orientation update. It is called to let the provider
30 // know if a lock has been resolved. 35 // know if a lock has been resolved.
31 virtual void OnOrientationChange() = 0; 36 virtual void OnOrientationChange() = 0;
32 37
33 virtual ~ScreenOrientationProvider() {} 38 virtual ~ScreenOrientationProvider() {}
34 39
35 protected: 40 protected:
36 friend class ScreenOrientationDispatcherHostImpl; 41 friend class WebContentsImpl;
37 42
38 static ScreenOrientationProvider* Create( 43 static ScreenOrientationProvider* Create(
39 ScreenOrientationDispatcherHost* dispatcher_host,
40 WebContents* web_contents); 44 WebContents* web_contents);
41
42 ScreenOrientationProvider() {} 45 ScreenOrientationProvider() {}
43 46
44 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProvider); 47 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProvider);
45 }; 48 };
46 49
47 #if !defined(OS_ANDROID) 50 #if !defined(OS_ANDROID)
48 // static 51 // static
49 ScreenOrientationProvider* ScreenOrientationProvider::Create( 52 ScreenOrientationProvider* ScreenOrientationProvider::Create(
50 ScreenOrientationDispatcherHost* dispatcher_host,
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698