Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
external_chromium_org
Commits
77df67ac
Commit
77df67ac
authored
10 years ago
by
Ben Murdoch
Browse files
Options
Download
Email Patches
Plain Diff
Implement support for SmartClip in AwContents.
Bug: 18222974 Change-Id: I42e787b6205ec3c3764ec5076e2391e4ec4e4deb
parent
d010f491
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
3 deletions
+27
-3
android_webview/java/src/org/chromium/android_webview/AwContents.java
...iew/java/src/org/chromium/android_webview/AwContents.java
+27
-3
No files found.
android_webview/java/src/org/chromium/android_webview/AwContents.java
View file @
77df67ac
...
...
@@ -20,6 +20,7 @@ import android.net.http.SslCertificate;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.text.TextUtils
;
import
android.util.Log
;
...
...
@@ -52,6 +53,7 @@ import org.chromium.content.browser.ContentViewStatics;
import
org.chromium.content.browser.LoadUrlParams
;
import
org.chromium.content.browser.NavigationHistory
;
import
org.chromium.content.browser.PageTransitionTypes
;
import
org.chromium.content.browser.SmartClipProvider
;
import
org.chromium.content.common.CleanupReference
;
import
org.chromium.content_public.Referrer
;
import
org.chromium.content_public.browser.GestureStateListener
;
...
...
@@ -77,7 +79,7 @@ import java.util.concurrent.Callable;
* continuous build & test in the open source SDK-based tree).
*/
@JNINamespace
(
"android_webview"
)
public
class
AwContents
{
public
class
AwContents
implements
SmartClipProvider
{
private
static
final
String
TAG
=
"AwContents"
;
private
static
final
String
WEB_ARCHIVE_EXTENSION
=
".mht"
;
...
...
@@ -2167,12 +2169,34 @@ public class AwContents {
return
null
;
}
@Override
public
void
extractSmartClipData
(
int
x
,
int
y
,
int
width
,
int
height
)
{
mContentViewCore
.
extractSmartClipData
(
x
,
y
,
width
,
height
);
}
public
void
setSmartClipDataListener
(
ContentViewCore
.
SmartClipDataListener
listener
)
{
mContentViewCore
.
setSmartClipDataListener
(
listener
);
@Override
public
void
setSmartClipResultHandler
(
final
Handler
resultHandler
)
{
if
(
resultHandler
==
null
)
{
mContentViewCore
.
setSmartClipDataListener
(
null
);
return
;
}
mContentViewCore
.
setSmartClipDataListener
(
new
ContentViewCore
.
SmartClipDataListener
()
{
public
void
onSmartClipDataExtracted
(
String
text
,
String
html
,
Rect
clipRect
)
{
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"url"
,
mContentViewCore
.
getWebContents
().
getVisibleUrl
());
bundle
.
putString
(
"title"
,
mContentViewCore
.
getWebContents
().
getTitle
());
bundle
.
putParcelable
(
"rect"
,
clipRect
);
bundle
.
putString
(
"text"
,
text
);
bundle
.
putString
(
"html"
,
html
);
try
{
Message
msg
=
Message
.
obtain
(
resultHandler
,
0
);
msg
.
setData
(
bundle
);
msg
.
sendToTarget
();
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"Error calling handler for smart clip data: "
,
e
);
}
}
});
}
// --------------------------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment