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

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

Issue 473253002: Merge 283159 "[Android] Extend smart clip to return html along w..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2062/src/
Patch Set: Created 6 years, 4 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
OLDNEW
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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 return; 1605 return;
1606 if (GetRenderWidgetHostViewAndroid()) { 1606 if (GetRenderWidgetHostViewAndroid()) {
1607 GetRenderWidgetHostViewAndroid()->SetTextSurroundingSelectionCallback( 1607 GetRenderWidgetHostViewAndroid()->SetTextSurroundingSelectionCallback(
1608 callback); 1608 callback);
1609 focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest( 1609 focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest(
1610 focused_frame->GetRoutingID(), max_length)); 1610 focused_frame->GetRoutingID(), max_length));
1611 } 1611 }
1612 } 1612 }
1613 1613
1614 void ContentViewCoreImpl::OnSmartClipDataExtracted( 1614 void ContentViewCoreImpl::OnSmartClipDataExtracted(
1615 const gfx::Rect& clip_rect, 1615 const base::string16& text,
1616 const base::string16& result) { 1616 const base::string16& html,
1617 const gfx::Rect& clip_rect) {
1617 JNIEnv* env = AttachCurrentThread(); 1618 JNIEnv* env = AttachCurrentThread();
1618 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 1619 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1619 if (obj.is_null()) 1620 if (obj.is_null())
1620 return; 1621 return;
1622 ScopedJavaLocalRef<jstring> jtext = ConvertUTF16ToJavaString(env, text);
1623 ScopedJavaLocalRef<jstring> jhtml = ConvertUTF16ToJavaString(env, html);
1621 ScopedJavaLocalRef<jobject> clip_rect_object(CreateJavaRect(env, clip_rect)); 1624 ScopedJavaLocalRef<jobject> clip_rect_object(CreateJavaRect(env, clip_rect));
1622 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result);
1623 Java_ContentViewCore_onSmartClipDataExtracted( 1625 Java_ContentViewCore_onSmartClipDataExtracted(
1624 env, obj.obj(), jresult.obj(), clip_rect_object.obj()); 1626 env, obj.obj(), jtext.obj(), jhtml.obj(), clip_rect_object.obj());
1625 } 1627 }
1626 1628
1627 void ContentViewCoreImpl::WebContentsDestroyed() { 1629 void ContentViewCoreImpl::WebContentsDestroyed() {
1628 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( 1630 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>(
1629 static_cast<WebContentsImpl*>(web_contents())->GetView()); 1631 static_cast<WebContentsImpl*>(web_contents())->GetView());
1630 DCHECK(wcva); 1632 DCHECK(wcva);
1631 wcva->SetContentViewCore(NULL); 1633 wcva->SetContentViewCore(NULL);
1632 } 1634 }
1633 1635
1634 // This is called for each ContentView. 1636 // This is called for each ContentView.
(...skipping 10 matching lines...) Expand all
1645 reinterpret_cast<ui::WindowAndroid*>(window_android), 1647 reinterpret_cast<ui::WindowAndroid*>(window_android),
1646 retained_objects_set); 1648 retained_objects_set);
1647 return reinterpret_cast<intptr_t>(view); 1649 return reinterpret_cast<intptr_t>(view);
1648 } 1650 }
1649 1651
1650 bool RegisterContentViewCore(JNIEnv* env) { 1652 bool RegisterContentViewCore(JNIEnv* env) {
1651 return RegisterNativesImpl(env); 1653 return RegisterNativesImpl(env);
1652 } 1654 }
1653 1655
1654 } // namespace content 1656 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698