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

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

Issue 2688383002: [ScreenOrientation] Merge mojo interface ScreenOrientationListener into ScreenOrientation
Patch Set: Created 3 years, 10 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_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_PROVIDER_H_ 5 #ifndef CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_PROVIDER_H_
6 #define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_PROVIDER_H_ 6 #define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_PROVIDER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 17 matching lines...) Expand all
28 public WebContentsObserver { 28 public WebContentsObserver {
29 public: 29 public:
30 ScreenOrientationProvider(WebContents* web_contents); 30 ScreenOrientationProvider(WebContents* web_contents);
31 31
32 ~ScreenOrientationProvider() override; 32 ~ScreenOrientationProvider() override;
33 33
34 // device::mojom::ScreenOrientation: 34 // device::mojom::ScreenOrientation:
35 void LockOrientation(blink::WebScreenOrientationLockType orientation, 35 void LockOrientation(blink::WebScreenOrientationLockType orientation,
36 const LockOrientationCallback& callback) override; 36 const LockOrientationCallback& callback) override;
37 void UnlockOrientation() override; 37 void UnlockOrientation() override;
38 void StartAccurateListen() override;
39 void StopAccurateListen() override;
38 40
39 // Inform about a screen orientation update. It is called to let the provider 41 // Inform about a screen orientation update. It is called to let the provider
40 // know if a lock has been resolved. 42 // know if a lock has been resolved.
41 void OnOrientationChange(); 43 void OnOrientationChange();
42 44
43 // Provide a delegate which creates delegates for platform implementations. 45 // Provide a delegate which creates delegates for platform implementations.
44 // The delegate is not owned by ScreenOrientationProvider. 46 // The delegate is not owned by ScreenOrientationProvider.
45 static void SetDelegate(ScreenOrientationDelegate* delegate_); 47 static void SetDelegate(ScreenOrientationDelegate* delegate_);
46 48
47 // WebContentsObserver 49 // WebContentsObserver
(...skipping 11 matching lines...) Expand all
59 // found. 61 // found.
60 blink::WebScreenOrientationLockType GetNaturalLockType() const; 62 blink::WebScreenOrientationLockType GetNaturalLockType() const;
61 63
62 // Whether the passed |lock| matches the current orientation. In other words, 64 // Whether the passed |lock| matches the current orientation. In other words,
63 // whether the orientation will need to change to match the |lock|. 65 // whether the orientation will need to change to match the |lock|.
64 bool LockMatchesCurrentOrientation(blink::WebScreenOrientationLockType lock); 66 bool LockMatchesCurrentOrientation(blink::WebScreenOrientationLockType lock);
65 67
66 // Not owned, responsible for platform implementations. 68 // Not owned, responsible for platform implementations.
67 static ScreenOrientationDelegate* delegate_; 69 static ScreenOrientationDelegate* delegate_;
68 70
71 #if defined(OS_ANDROID)
72 int accurate_listen_count_ = 0;
mlamouri (slow - plz ping) 2017/02/15 10:58:41 nit: `accurate_listener_count_`? feel free to igno
leonhsl(Using Gerrit) 2017/02/16 05:00:05 Done.
73 #endif
74
69 // Whether the ScreenOrientationProvider currently has a lock applied. 75 // Whether the ScreenOrientationProvider currently has a lock applied.
70 bool lock_applied_; 76 bool lock_applied_;
71 77
72 // Lock that require orientation changes are not completed until 78 // Lock that require orientation changes are not completed until
73 // OnOrientationChange. 79 // OnOrientationChange.
74 base::Optional<blink::WebScreenOrientationLockType> pending_lock_orientation_; 80 base::Optional<blink::WebScreenOrientationLockType> pending_lock_orientation_;
75 81
76 LockOrientationCallback pending_callback_; 82 LockOrientationCallback pending_callback_;
77 83
78 WebContentsFrameBindingSet<device::mojom::ScreenOrientation> bindings_; 84 WebContentsFrameBindingSet<device::mojom::ScreenOrientation> bindings_;
79 85
80 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProvider); 86 DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProvider);
81 }; 87 };
82 88
83 } // namespace content 89 } // namespace content
84 90
85 #endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_PROVIDER_H_ 91 #endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698