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

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

Issue 378233002: [Android] Extend smart clip to return html along with text (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avoid build breakage Created 6 years, 5 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
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 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 JNIEnv* env = AttachCurrentThread(); 1613 JNIEnv* env = AttachCurrentThread();
1614 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 1614 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1615 if (obj.is_null()) 1615 if (obj.is_null())
1616 return false; 1616 return false;
1617 1617
1618 return Java_ContentViewCore_willHandleDeferAfterResponseStarted(env, 1618 return Java_ContentViewCore_willHandleDeferAfterResponseStarted(env,
1619 obj.obj()); 1619 obj.obj());
1620 } 1620 }
1621 1621
1622 void ContentViewCoreImpl::OnSmartClipDataExtracted( 1622 void ContentViewCoreImpl::OnSmartClipDataExtracted(
1623 const gfx::Rect& clip_rect, 1623 const base::string16& text,
1624 const base::string16& result) { 1624 const base::string16& html,
1625 const gfx::Rect& clip_rect) {
1625 JNIEnv* env = AttachCurrentThread(); 1626 JNIEnv* env = AttachCurrentThread();
1626 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 1627 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1627 if (obj.is_null()) 1628 if (obj.is_null())
1628 return; 1629 return;
1630 ScopedJavaLocalRef<jstring> jtext = ConvertUTF16ToJavaString(env, text);
1631 ScopedJavaLocalRef<jstring> jhtml = ConvertUTF16ToJavaString(env, html);
1629 ScopedJavaLocalRef<jobject> clip_rect_object(CreateJavaRect(env, clip_rect)); 1632 ScopedJavaLocalRef<jobject> clip_rect_object(CreateJavaRect(env, clip_rect));
1630 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result);
1631 Java_ContentViewCore_onSmartClipDataExtracted( 1633 Java_ContentViewCore_onSmartClipDataExtracted(
1632 env, obj.obj(), jresult.obj(), clip_rect_object.obj()); 1634 env, obj.obj(), jtext.obj(), jhtml.obj(), clip_rect_object.obj());
1633 } 1635 }
1634 1636
1635 void ContentViewCoreImpl::WebContentsDestroyed() { 1637 void ContentViewCoreImpl::WebContentsDestroyed() {
1636 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( 1638 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>(
1637 static_cast<WebContentsImpl*>(web_contents())->GetView()); 1639 static_cast<WebContentsImpl*>(web_contents())->GetView());
1638 DCHECK(wcva); 1640 DCHECK(wcva);
1639 wcva->SetContentViewCore(NULL); 1641 wcva->SetContentViewCore(NULL);
1640 } 1642 }
1641 1643
1642 // This is called for each ContentView. 1644 // This is called for each ContentView.
(...skipping 10 matching lines...) Expand all
1653 reinterpret_cast<ui::WindowAndroid*>(window_android), 1655 reinterpret_cast<ui::WindowAndroid*>(window_android),
1654 retained_objects_set); 1656 retained_objects_set);
1655 return reinterpret_cast<intptr_t>(view); 1657 return reinterpret_cast<intptr_t>(view);
1656 } 1658 }
1657 1659
1658 bool RegisterContentViewCore(JNIEnv* env) { 1660 bool RegisterContentViewCore(JNIEnv* env) {
1659 return RegisterNativesImpl(env); 1661 return RegisterNativesImpl(env);
1660 } 1662 }
1661 1663
1662 } // namespace content 1664 } // 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