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

Side by Side Diff: content/browser/screen_orientation/screen_orientation.cc

Issue 2685513002: [For trybots test] [ScreenOrientation] Hide ScreenOrientationProvider inside WebContentsImpl. (Closed)
Patch Set: Fix android bots 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
(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_handle.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::DidFinishNavigation(
33 NavigationHandle* navigation_handle) {
34 if (!navigation_handle->IsInMainFrame() ||
35 !navigation_handle->HasCommitted() ||
36 navigation_handle->IsSamePage()) {
37 return;
38 }
39 provider_->UnlockOrientation();
40 }
41
42 ScreenOrientationProvider* ScreenOrientation::GetScreenOrientationProvider() {
43 return provider_.get();
44 }
45
46 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698