| OLD | NEW |
| 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 #include "content/browser/screen_orientation/screen_orientation_delegate_android
.h" | 5 #include "content/browser/screen_orientation/screen_orientation_delegate_android
.h" |
| 6 | 6 |
| 7 #include "content/browser/android/content_view_core_impl.h" | 7 #include "content/browser/android/content_view_core_impl.h" |
| 8 #include "content/browser/screen_orientation/screen_orientation_provider.h" |
| 8 #include "jni/ScreenOrientationProvider_jni.h" | 9 #include "jni/ScreenOrientationProvider_jni.h" |
| 9 #include "ui/android/window_android.h" | 10 #include "ui/android/window_android.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 11 | 12 |
| 12 namespace content { | 13 namespace content { |
| 13 | 14 |
| 14 ScreenOrientationDelegateAndroid::ScreenOrientationDelegateAndroid() { | 15 ScreenOrientationDelegateAndroid::ScreenOrientationDelegateAndroid() { |
| 16 ScreenOrientationProvider::SetDelegate(this); |
| 15 } | 17 } |
| 16 | 18 |
| 17 ScreenOrientationDelegateAndroid::~ScreenOrientationDelegateAndroid() { | 19 ScreenOrientationDelegateAndroid::~ScreenOrientationDelegateAndroid() { |
| 20 ScreenOrientationProvider::SetDelegate(nullptr); |
| 18 } | 21 } |
| 19 | 22 |
| 20 // static | 23 // static |
| 21 void ScreenOrientationDelegateAndroid::StartAccurateListening() { | 24 void ScreenOrientationDelegateAndroid::StartAccurateListening() { |
| 22 Java_ScreenOrientationProvider_startAccurateListening( | 25 Java_ScreenOrientationProvider_startAccurateListening( |
| 23 base::android::AttachCurrentThread()); | 26 base::android::AttachCurrentThread()); |
| 24 } | 27 } |
| 25 | 28 |
| 26 // static | 29 // static |
| 27 void ScreenOrientationDelegateAndroid::StopAccurateListening() { | 30 void ScreenOrientationDelegateAndroid::StopAccurateListening() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 54 } | 57 } |
| 55 | 58 |
| 56 void ScreenOrientationDelegateAndroid::Unlock(WebContents* web_contents) { | 59 void ScreenOrientationDelegateAndroid::Unlock(WebContents* web_contents) { |
| 57 gfx::NativeWindow window = web_contents->GetTopLevelNativeWindow(); | 60 gfx::NativeWindow window = web_contents->GetTopLevelNativeWindow(); |
| 58 Java_ScreenOrientationProvider_unlockOrientation( | 61 Java_ScreenOrientationProvider_unlockOrientation( |
| 59 base::android::AttachCurrentThread(), | 62 base::android::AttachCurrentThread(), |
| 60 window ? window->GetJavaObject() : nullptr); | 63 window ? window->GetJavaObject() : nullptr); |
| 61 } | 64 } |
| 62 | 65 |
| 63 } // namespace content | 66 } // namespace content |
| OLD | NEW |