| 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 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 accessibility_state->ResetAccessibilityMode(); | 1531 accessibility_state->ResetAccessibilityMode(); |
| 1532 if (host_impl) | 1532 if (host_impl) |
| 1533 host_impl->ResetAccessibilityMode(); | 1533 host_impl->ResetAccessibilityMode(); |
| 1534 } | 1534 } |
| 1535 } | 1535 } |
| 1536 | 1536 |
| 1537 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1537 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
| 1538 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1538 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1539 if (rwhv) | 1539 if (rwhv) |
| 1540 rwhv->UpdateScreenInfo(GetViewAndroid()); | 1540 rwhv->UpdateScreenInfo(GetViewAndroid()); |
| 1541 | |
| 1542 // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change | |
| 1543 // in the future. The OnResize IPC message sent from UpdateScreenInfo() will | |
| 1544 // propagate the information. | |
| 1545 blink::WebScreenOrientationType orientation = | |
| 1546 blink::WebScreenOrientationPortraitPrimary; | |
| 1547 | |
| 1548 switch (device_orientation_) { | |
| 1549 case 0: | |
| 1550 orientation = blink::WebScreenOrientationPortraitPrimary; | |
| 1551 break; | |
| 1552 case 90: | |
| 1553 orientation = blink::WebScreenOrientationLandscapePrimary; | |
| 1554 break; | |
| 1555 case -90: | |
| 1556 orientation = blink::WebScreenOrientationLandscapeSecondary; | |
| 1557 break; | |
| 1558 case 180: | |
| 1559 orientation = blink::WebScreenOrientationPortraitSecondary; | |
| 1560 break; | |
| 1561 default: | |
| 1562 NOTREACHED(); | |
| 1563 } | |
| 1564 | |
| 1565 ScreenOrientationDispatcherHost* sodh = | |
| 1566 static_cast<RenderProcessHostImpl*>(web_contents_-> | |
| 1567 GetRenderProcessHost())->screen_orientation_dispatcher_host(); | |
| 1568 | |
| 1569 // sodh can be null if the RenderProcessHost is in the process of being | |
| 1570 // destroyed or not yet initialized. | |
| 1571 if (sodh) | |
| 1572 sodh->OnOrientationChange(orientation); | |
| 1573 } | 1541 } |
| 1574 | 1542 |
| 1575 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, | 1543 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, |
| 1576 jobject obj, | 1544 jobject obj, |
| 1577 jint x, | 1545 jint x, |
| 1578 jint y, | 1546 jint y, |
| 1579 jint width, | 1547 jint width, |
| 1580 jint height) { | 1548 jint height) { |
| 1581 gfx::Rect rect( | 1549 gfx::Rect rect( |
| 1582 static_cast<int>(x / dpi_scale()), | 1550 static_cast<int>(x / dpi_scale()), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1632 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1600 reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 1633 retained_objects_set); | 1601 retained_objects_set); |
| 1634 return reinterpret_cast<intptr_t>(view); | 1602 return reinterpret_cast<intptr_t>(view); |
| 1635 } | 1603 } |
| 1636 | 1604 |
| 1637 bool RegisterContentViewCore(JNIEnv* env) { | 1605 bool RegisterContentViewCore(JNIEnv* env) { |
| 1638 return RegisterNativesImpl(env); | 1606 return RegisterNativesImpl(env); |
| 1639 } | 1607 } |
| 1640 | 1608 |
| 1641 } // namespace content | 1609 } // namespace content |
| OLD | NEW |