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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 11081003: Upstream scrollFocusedNodeIntoRect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "content/browser/android/load_url_params.h" 14 #include "content/browser/android/load_url_params.h"
15 #include "content/browser/android/touch_point.h" 15 #include "content/browser/android/touch_point.h"
16 #include "content/browser/renderer_host/java/java_bound_object.h" 16 #include "content/browser/renderer_host/java/java_bound_object.h"
17 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h" 17 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h"
18 #include "content/browser/renderer_host/render_view_host_impl.h" 18 #include "content/browser/renderer_host/render_view_host_impl.h"
19 #include "content/browser/renderer_host/render_widget_host_impl.h" 19 #include "content/browser/renderer_host/render_widget_host_impl.h"
20 #include "content/browser/renderer_host/render_widget_host_view_android.h" 20 #include "content/browser/renderer_host/render_widget_host_view_android.h"
21 #include "content/browser/web_contents/navigation_controller_impl.h" 21 #include "content/browser/web_contents/navigation_controller_impl.h"
22 #include "content/browser/web_contents/navigation_entry_impl.h" 22 #include "content/browser/web_contents/navigation_entry_impl.h"
23 #include "content/browser/web_contents/web_contents_view_android.h" 23 #include "content/browser/web_contents/web_contents_view_android.h"
24 #include "content/common/view_messages.h"
24 #include "content/public/browser/browser_context.h" 25 #include "content/public/browser/browser_context.h"
25 #include "content/public/browser/favicon_status.h" 26 #include "content/public/browser/favicon_status.h"
26 #include "content/public/browser/interstitial_page.h" 27 #include "content/public/browser/interstitial_page.h"
27 #include "content/public/browser/notification_details.h" 28 #include "content/public/browser/notification_details.h"
28 #include "content/public/browser/notification_service.h" 29 #include "content/public/browser/notification_service.h"
29 #include "content/public/browser/notification_source.h" 30 #include "content/public/browser/notification_source.h"
30 #include "content/public/browser/notification_types.h" 31 #include "content/public/browser/notification_types.h"
31 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
32 #include "content/public/common/content_client.h" 33 #include "content/public/common/content_client.h"
33 #include "content/public/common/page_transition_types.h" 34 #include "content/public/common/page_transition_types.h"
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 WebKit::WebBindings::releaseObject(bound_object); 720 WebKit::WebBindings::releaseObject(bound_object);
720 } 721 }
721 722
722 void ContentViewCoreImpl::RemoveJavascriptInterface(JNIEnv* env, 723 void ContentViewCoreImpl::RemoveJavascriptInterface(JNIEnv* env,
723 jobject /* obj */, 724 jobject /* obj */,
724 jstring name) { 725 jstring name) {
725 web_contents_->java_bridge_dispatcher_host_manager()->RemoveNamedObject( 726 web_contents_->java_bridge_dispatcher_host_manager()->RemoveNamedObject(
726 ConvertJavaStringToUTF16(env, name)); 727 ConvertJavaStringToUTF16(env, name));
727 } 728 }
728 729
730 void ContentViewCoreImpl::ScrollFocusedEditableNodeIntoView(JNIEnv* env,
731 jobject obj) {
Yaron 2012/10/06 01:36:40 nit: indentation
Yusuf 2012/10/08 16:49:21 Done.
732 RenderViewHost* host = web_contents_->GetRenderViewHost();
733 gfx::Rect rect;
734 host->Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(host->GetRoutingID(),
735 rect));
736 }
737
729 int ContentViewCoreImpl::GetNavigationHistory(JNIEnv* env, 738 int ContentViewCoreImpl::GetNavigationHistory(JNIEnv* env,
730 jobject obj, 739 jobject obj,
731 jobject context) { 740 jobject context) {
732 // Iterate through navigation entries to populate the list 741 // Iterate through navigation entries to populate the list
733 const NavigationController& controller = web_contents_->GetController(); 742 const NavigationController& controller = web_contents_->GetController();
734 int count = controller.GetEntryCount(); 743 int count = controller.GetEntryCount();
735 for (int i = 0; i < count; ++i) { 744 for (int i = 0; i < count; ++i) {
736 NavigationEntry* entry = controller.GetEntryAtIndex(i); 745 NavigationEntry* entry = controller.GetEntryAtIndex(i);
737 746
738 // Get the details of the current entry 747 // Get the details of the current entry
(...skipping 24 matching lines...) Expand all
763 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); 772 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid();
764 if (!rwhva) 773 if (!rwhva)
765 return 0; 774 return 0;
766 return rwhva->GetNativeImeAdapter(); 775 return rwhva->GetNativeImeAdapter();
767 } 776 }
768 777
769 jboolean ContentViewCoreImpl::NeedsReload(JNIEnv* env, jobject obj) { 778 jboolean ContentViewCoreImpl::NeedsReload(JNIEnv* env, jobject obj) {
770 return web_contents_->GetController().NeedsReload(); 779 return web_contents_->GetController().NeedsReload();
771 } 780 }
772 781
782 void ContentViewCoreImpl::UndoScrollFocusedEditableNodeIntoView(
783 JNIEnv* env,
784 jobject obj) {
785 RenderViewHost* host = web_contents_->GetRenderViewHost();
786 host->Send(
787 new ViewMsg_UndoScrollFocusedEditableNodeIntoView(host->GetRoutingID()));
788 }
789
773 jint ContentViewCoreImpl::EvaluateJavaScript(JNIEnv* env, 790 jint ContentViewCoreImpl::EvaluateJavaScript(JNIEnv* env,
774 jobject obj, 791 jobject obj,
775 jstring script) { 792 jstring script) {
776 RenderViewHost* host = web_contents_->GetRenderViewHost(); 793 RenderViewHost* host = web_contents_->GetRenderViewHost();
777 DCHECK(host); 794 DCHECK(host);
778 795
779 string16 script_utf16 = ConvertJavaStringToUTF16(env, script); 796 string16 script_utf16 = ConvertJavaStringToUTF16(env, script);
780 return host->ExecuteJavascriptInWebFrameNotifyResult(string16(), 797 return host->ExecuteJavascriptInWebFrameNotifyResult(string16(),
781 script_utf16); 798 script_utf16);
782 } 799 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { 881 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) {
865 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; 882 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!";
866 return false; 883 return false;
867 } 884 }
868 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); 885 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I");
869 886
870 return RegisterNativesImpl(env) >= 0; 887 return RegisterNativesImpl(env) >= 0;
871 } 888 }
872 889
873 } // namespace content 890 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698