| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_H | 5 #ifndef CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_H |
| 6 #define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_H | 6 #define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_H |
| 7 | 7 |
| 8 #include "base/callback.h" | |
| 9 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 10 #include "content/public/browser/web_contents_binding_set.h" | 9 #include "content/public/browser/web_contents_binding_set.h" |
| 11 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| 12 #include "device/screen_orientation/public/interfaces/screen_orientation.mojom.h
" | 11 #include "device/screen_orientation/public/interfaces/screen_orientation.mojom.h
" |
| 13 | 12 |
| 14 namespace content { | 13 namespace content { |
| 15 | 14 |
| 16 class ScreenOrientationProvider; | 15 class ScreenOrientationProvider; |
| 17 class WebContents; | 16 class WebContents; |
| 18 | 17 |
| 19 class ScreenOrientation : public device::mojom::ScreenOrientation, | 18 class ScreenOrientation : public device::mojom::ScreenOrientation, |
| 20 public WebContentsObserver { | 19 public WebContentsObserver { |
| 21 public: | 20 public: |
| 22 explicit ScreenOrientation(WebContents* web_contents); | 21 explicit ScreenOrientation(WebContents* web_contents); |
| 23 ~ScreenOrientation() override; | 22 ~ScreenOrientation() override; |
| 24 | 23 |
| 25 ScreenOrientationProvider* GetScreenOrientationProvider(); | 24 ScreenOrientationProvider* GetScreenOrientationProvider(); |
| 26 | 25 |
| 27 private: | 26 private: |
| 28 // ScreenOrientation: | 27 // ScreenOrientation: |
| 29 void LockOrientation(blink::WebScreenOrientationLockType orientation, | 28 void LockOrientation(blink::WebScreenOrientationLockType orientation, |
| 30 const LockOrientationCallback& callback) override; | 29 const LockOrientationCallback& callback) override; |
| 31 void UnlockOrientation() override; | 30 void UnlockOrientation() override; |
| 32 | 31 |
| 33 // WebContentsObserver: | 32 // WebContentsObserver: |
| 34 void DidNavigateMainFrame(const LoadCommittedDetails& details, | 33 void DidNavigateMainFrame(const LoadCommittedDetails& details, |
| 35 const FrameNavigateParams& params) override; | 34 const FrameNavigateParams& params) override; |
| 36 | 35 |
| 37 void NotifyLockResult(device::mojom::ScreenOrientationLockResult result); | |
| 38 | |
| 39 std::unique_ptr<ScreenOrientationProvider> provider_; | 36 std::unique_ptr<ScreenOrientationProvider> provider_; |
| 40 LockOrientationCallback on_result_callback_; | |
| 41 WebContentsFrameBindingSet<device::mojom::ScreenOrientation> bindings_; | 37 WebContentsFrameBindingSet<device::mojom::ScreenOrientation> bindings_; |
| 42 base::WeakPtrFactory<ScreenOrientation> weak_factory_; | 38 base::WeakPtrFactory<ScreenOrientation> weak_factory_; |
| 43 }; | 39 }; |
| 44 | 40 |
| 45 } // namespace content | 41 } // namespace content |
| 46 | 42 |
| 47 #endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_H | 43 #endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_H |
| OLD | NEW |