| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/screen_orientation/screen_orientation.h" | |
| 6 | |
| 7 #include "content/public/browser/navigation_details.h" | |
| 8 #include "content/public/browser/screen_orientation_provider.h" | |
| 9 #include "content/public/browser/web_contents.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 ScreenOrientation::ScreenOrientation(WebContents* web_contents) | |
| 14 : WebContentsObserver(web_contents), | |
| 15 bindings_(web_contents, this), | |
| 16 weak_factory_(this) { | |
| 17 provider_.reset(new ScreenOrientationProvider(web_contents)); | |
| 18 } | |
| 19 | |
| 20 ScreenOrientation::~ScreenOrientation() = default; | |
| 21 | |
| 22 void ScreenOrientation::LockOrientation( | |
| 23 blink::WebScreenOrientationLockType orientation, | |
| 24 const LockOrientationCallback& callback) { | |
| 25 provider_->LockOrientation(orientation, callback); | |
| 26 } | |
| 27 | |
| 28 void ScreenOrientation::UnlockOrientation() { | |
| 29 provider_->UnlockOrientation(); | |
| 30 } | |
| 31 | |
| 32 void ScreenOrientation::DidNavigateMainFrame( | |
| 33 const LoadCommittedDetails& details, | |
| 34 const FrameNavigateParams& params) { | |
| 35 if (details.is_in_page) | |
| 36 return; | |
| 37 provider_->UnlockOrientation(); | |
| 38 } | |
| 39 | |
| 40 ScreenOrientationProvider* ScreenOrientation::GetScreenOrientationProvider() { | |
| 41 return provider_.get(); | |
| 42 } | |
| 43 | |
| 44 } // namespace content | |
| OLD | NEW |