Chromium Code Reviews| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "cc/layers/delegated_renderer_layer.h" | |
| 16 #include "cc/layers/layer.h" | 17 #include "cc/layers/layer.h" |
| 17 #include "cc/layers/solid_color_layer.h" | 18 #include "cc/layers/solid_color_layer.h" |
| 18 #include "cc/output/begin_frame_args.h" | 19 #include "cc/output/begin_frame_args.h" |
| 19 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 20 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 20 #include "content/browser/android/gesture_event_type.h" | 21 #include "content/browser/android/gesture_event_type.h" |
| 21 #include "content/browser/android/interstitial_page_delegate_android.h" | 22 #include "content/browser/android/interstitial_page_delegate_android.h" |
| 22 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" | 23 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" |
| 23 #include "content/browser/android/load_url_params.h" | 24 #include "content/browser/android/load_url_params.h" |
| 24 #include "content/browser/android/popup_touch_handle_drawable.h" | 25 #include "content/browser/android/popup_touch_handle_drawable.h" |
| 25 #include "content/browser/frame_host/interstitial_page_impl.h" | 26 #include "content/browser/frame_host/interstitial_page_impl.h" |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 638 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 639 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 639 if (!view) { | 640 if (!view) { |
| 640 result_callback.Run(false, SkBitmap()); | 641 result_callback.Run(false, SkBitmap()); |
| 641 return; | 642 return; |
| 642 } | 643 } |
| 643 | 644 |
| 644 view->GetScaledContentBitmap(scale, color_type, src_subrect, | 645 view->GetScaledContentBitmap(scale, color_type, src_subrect, |
| 645 result_callback); | 646 result_callback); |
| 646 } | 647 } |
| 647 | 648 |
| 649 scoped_refptr<cc::DelegatedRendererLayer> | |
| 650 ContentViewCoreImpl::CreateDelegatedLayerForFrameProvider() { | |
| 651 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | |
| 652 if (!view) { | |
|
aelias_OOO_until_Jul13
2014/09/03 20:12:03
nit: no braces here
| |
| 653 return scoped_refptr<cc::DelegatedRendererLayer>(); | |
| 654 } | |
| 655 | |
| 656 return view->CreateDelegatedLayerForFrameProvider(); | |
| 657 } | |
| 658 | |
| 648 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { | 659 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { |
| 649 JNIEnv* env = AttachCurrentThread(); | 660 JNIEnv* env = AttachCurrentThread(); |
| 650 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 661 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 651 if (j_obj.is_null()) | 662 if (j_obj.is_null()) |
| 652 return; | 663 return; |
| 653 ScopedJavaLocalRef<jstring> jcontent_url = | 664 ScopedJavaLocalRef<jstring> jcontent_url = |
| 654 ConvertUTF8ToJavaString(env, content_url.spec()); | 665 ConvertUTF8ToJavaString(env, content_url.spec()); |
| 655 Java_ContentViewCore_startContentIntent(env, | 666 Java_ContentViewCore_startContentIntent(env, |
| 656 j_obj.obj(), | 667 j_obj.obj(), |
| 657 jcontent_url.obj()); | 668 jcontent_url.obj()); |
| (...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1516 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1527 reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 1517 retained_objects_set); | 1528 retained_objects_set); |
| 1518 return reinterpret_cast<intptr_t>(view); | 1529 return reinterpret_cast<intptr_t>(view); |
| 1519 } | 1530 } |
| 1520 | 1531 |
| 1521 bool RegisterContentViewCore(JNIEnv* env) { | 1532 bool RegisterContentViewCore(JNIEnv* env) { |
| 1522 return RegisterNativesImpl(env); | 1533 return RegisterNativesImpl(env); |
| 1523 } | 1534 } |
| 1524 | 1535 |
| 1525 } // namespace content | 1536 } // namespace content |
| OLD | NEW |