OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 accessibility_state->ResetAccessibilityMode(); | 1535 accessibility_state->ResetAccessibilityMode(); |
1536 if (host_impl) | 1536 if (host_impl) |
1537 host_impl->ResetAccessibilityMode(); | 1537 host_impl->ResetAccessibilityMode(); |
1538 } | 1538 } |
1539 } | 1539 } |
1540 | 1540 |
1541 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1541 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
1542 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1542 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
1543 if (rwhv) | 1543 if (rwhv) |
1544 rwhv->UpdateScreenInfo(GetViewAndroid()); | 1544 rwhv->UpdateScreenInfo(GetViewAndroid()); |
1545 | |
1546 // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change | |
1547 // in the future. The OnResize IPC message sent from UpdateScreenInfo() will | |
1548 // propagate the information. | |
1549 blink::WebScreenOrientationType orientation = | |
1550 blink::WebScreenOrientationPortraitPrimary; | |
1551 | |
1552 switch (device_orientation_) { | |
1553 case 0: | |
1554 orientation = blink::WebScreenOrientationPortraitPrimary; | |
1555 break; | |
1556 case 90: | |
1557 orientation = blink::WebScreenOrientationLandscapePrimary; | |
1558 break; | |
1559 case -90: | |
1560 orientation = blink::WebScreenOrientationLandscapeSecondary; | |
1561 break; | |
1562 case 180: | |
1563 orientation = blink::WebScreenOrientationPortraitSecondary; | |
1564 break; | |
1565 default: | |
1566 NOTREACHED(); | |
1567 } | |
1568 | |
1569 ScreenOrientationDispatcherHost* sodh = | |
1570 static_cast<RenderProcessHostImpl*>(web_contents_-> | |
1571 GetRenderProcessHost())->screen_orientation_dispatcher_host(); | |
1572 | |
1573 // sodh can be null if the RenderProcessHost is in the process of being | |
1574 // destroyed or not yet initialized. | |
1575 if (sodh) | |
1576 sodh->OnOrientationChange(orientation); | |
1577 } | 1545 } |
1578 | 1546 |
1579 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, | 1547 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, |
1580 jobject obj, | 1548 jobject obj, |
1581 jint x, | 1549 jint x, |
1582 jint y, | 1550 jint y, |
1583 jint width, | 1551 jint width, |
1584 jint height) { | 1552 jint height) { |
1585 gfx::Rect rect( | 1553 gfx::Rect rect( |
1586 static_cast<int>(x / dpi_scale()), | 1554 static_cast<int>(x / dpi_scale()), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1604 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1637 retained_objects_set); | 1605 retained_objects_set); |
1638 return reinterpret_cast<intptr_t>(view); | 1606 return reinterpret_cast<intptr_t>(view); |
1639 } | 1607 } |
1640 | 1608 |
1641 bool RegisterContentViewCore(JNIEnv* env) { | 1609 bool RegisterContentViewCore(JNIEnv* env) { |
1642 return RegisterNativesImpl(env); | 1610 return RegisterNativesImpl(env); |
1643 } | 1611 } |
1644 | 1612 |
1645 } // namespace content | 1613 } // namespace content |
OLD | NEW |