Commit Graph

3554 Commits

Author SHA1 Message Date
Nate Fischer
0a6140d217 WebView: wrap Java literals with {@code}
Docs change only.

This wraps some Java literals (true, false, null) with {@code} blocks,
as per Android API guidelines.

This also addresses other presubmit errors:

 * fix lines that have become too long
 * fix broken import order and unused imports

Bug: 65213517
Test: make docs (and manually verify things look better)
Change-Id: Idc7fe28d40bea7bd1edcad539b75fa9c689b8d46
2017-09-05 13:37:37 -07:00
Nate Fischer
390245b09e Merge "WebView: fix setSafeBrowsingWhitelist table in docs" into oc-mr1-dev am: 0899236129
am: 6ad362b160

Change-Id: I20c3e85ed430cb23660ffbd02a2be39fdb361c59
2017-08-31 04:32:47 +00:00
TreeHugger Robot
433f7c5708 Merge "WebView: fix broken references to #onShowFileChooser" 2017-08-31 02:47:49 +00:00
Nate Fischer
c4f8f89bcc WebView: fix broken references to #onShowFileChooser
WebChromeClient#onShowFileChooser was incorrectly referred to as
"showFileChooser" in two locations. Now these locations use the correct
name and the spot using "<code>" has been fixed to use "{@link}".

This also fixes a grammar error in the docs.

Bug: 65213653
Test: make docs (and manually verify the link works)
Change-Id: I17ba8ac3f76371a8b8a12b998ce4c956b6237119
2017-08-30 15:39:32 -07:00
Nate Fischer
fbebfa9d53 WebView: fix setSafeBrowsingWhitelist table in docs
No change to logic, only docs changes.

The documentation for setSafeBrowsingWhitelist uses a table to describe
whitelist rules. However, this table was previously formatted
incorrectly (it uses <th> elements for each cell, when normal data cells
should use <td> according to Android API guidelines).

This fixes the table to conform to the guidelines, adjusts white space
for consistency, and removes an unnecessary <p> element.

Bug: 65173825
Test: make docs (and manually verify the table looks correct)
Change-Id: I5d7390a44613aaa3acb147a69f8e0ce741e817ed
2017-08-30 21:03:19 +00:00
Nate Fischer
7e4dbe65bc Merge "WebView: require APKs to target OMR1" into oc-mr1-dev am: c233f44a26
am: a97e0833d3

Change-Id: Id9c3e2c7ed292435703bc237974a9cbab6f1c355
2017-08-28 20:01:30 +00:00
Nate Fischer
220d86d142 WebView: require APKs to target OMR1
This disallows WebView/Monochrome APKs targeting O or below to be chosen
as WebView providers.

Bug: 65080651
Test: Open WebView shell with webview from system image, no crash
Test: Install Monochrome compiled for O, it's not in the webview provider list
Change-Id: I79162cedaa801ce227ad4c2eb3cbea9c08704da8
2017-08-28 12:15:56 -07:00
Nate Fischer
02e281a13d WebView: clarify docs for addJavascriptInterface
Docs change only, no change in logic.

We do not support calling #addJavascriptInterface until after JavaScript
is enabled via WebSettings#setJavaScriptEnabled. Calling these methods
in the wrong order is undefined behavior (and we've seen that it's buggy
under certain conditions, e.g. if the DOM includes an <img> element).

This clarifies the point in the docs and code example.

Bug: 64899039
Test: make -j40 docs (everything looks good)
Change-Id: I8ef9eec7f038037e6b898286e4dad8a57ecad472
(cherry picked from commit aaef6827ca)
2017-08-23 17:49:46 +00:00
TreeHugger Robot
e0ebf03ba7 Merge "WebView: clarify docs for addJavascriptInterface" 2017-08-23 15:30:54 +00:00
Nate Fischer
0d2b68bb68 Merge "WebView: rename initSafeBrowsing and remove shutdownSafeBrowsing" into oc-mr1-dev am: b2456e6194
am: 0cd12a83c6

Change-Id: I5c0529021e6bbba15090bfc500bb4610a9a4c0d7
2017-08-22 23:21:15 +00:00
Nate Fischer
aaef6827ca WebView: clarify docs for addJavascriptInterface
Docs change only, no change in logic.

We do not support calling #addJavascriptInterface until after JavaScript
is enabled via WebSettings#setJavaScriptEnabled. Calling these methods
in the wrong order is undefined behavior (and we've seen that it's buggy
under certain conditions, e.g. if the DOM includes an <img> element).

This clarifies the point in the docs and code example.

Bug: 64899039
Test: make -j40 docs (everything looks good)
Change-Id: I8ef9eec7f038037e6b898286e4dad8a57ecad472
2017-08-22 01:06:07 +00:00
Nate Fischer
2b108d8609 WebView: rename initSafeBrowsing and remove shutdownSafeBrowsing
This renames the method as follows:

 * initSafeBrowsing -> startSafeBrowsing

This also updates documentation to fix javadoc references, and to
clarify that Safe Browsing checks are not guaranteed until after
startSafeBrowsing() invokes its callback.

This does not change the method name in WebViewFactoryProvider, because
changing this would break CTS tests (since the WebView APK implements
this under the old name).

This also removes shutdownSafeBrowsing, because we found there was no
good use for this (it's meaningless for AOSP, and we were recommended to
avoid calling the underlying GMSCore API for GoogleWebView). More
significantly, there's no good place for an application to call it from.

Bug: 64331900
Test: make update-api (docs are correct)
Change-Id: Idf2b9390306052f5c5dfb92909fca4cfeec74aef
2017-08-21 18:04:28 -07:00
Felipe Leme
eb6a0c2560 Merge "Merge "Additional documentation about Autofill / WebView security." into oc-dev am: 36cbdef880 am: 7e9f379b50 am: 82e7dfcae8" into oc-mr1-dev-plus-aosp
am: 11435f8153

Change-Id: Id3b356d237d0758180c227c7d452236487eb18aa
2017-08-15 22:42:54 +00:00
Felipe Leme
262966aad1 Merge "Additional documentation about Autofill / WebView security." into oc-dev am: 36cbdef880 am: 7e9f379b50
am: 82e7dfcae8

Change-Id: I47c263e196b9cfa3e664ec6a968eeb2cffcffc58
2017-08-15 22:13:39 +00:00
Felipe Leme
2220049d58 Merge "Additional documentation about Autofill / WebView security." into oc-dev am: 36cbdef880
am: a3c2cee055

Change-Id: Ie107dd462a47009a34ee3768183dfda2e36107c3
2017-08-15 21:48:32 +00:00
Felipe Leme
82e7dfcae8 Merge "Additional documentation about Autofill / WebView security." into oc-dev am: 36cbdef880
am: 7e9f379b50

Change-Id: I1eceb903fed2c46db35c9270769bb0f8cc44150f
2017-08-15 21:42:40 +00:00
Felipe Leme
a3c2cee055 Merge "Additional documentation about Autofill / WebView security." into oc-dev
am: 36cbdef880

Change-Id: Ie198dbbdc7ab4ea1089c7363f1b1d2df333c1d8f
2017-08-15 21:33:01 +00:00
Nate Fischer
cf08be26fa Merge "WebView: switch to OMR1 FactoryProvider" into oc-mr1-dev am: 417944624b
am: c5731e7c85

Change-Id: If5b5fb05f3d22bd3fa9be32aea7336099184f489
2017-08-14 21:53:19 +00:00
Nate Fischer
7b00b32216 WebView: switch to OMR1 FactoryProvider
We now fetch the *ForOMR1 class instead of *ForO, which enables
OMR1-specific code in the WebView APK.

Bug: 63687088
Test: N/A
Change-Id: Ia36a00cd26aff8b87d7aeae859c72cb2fb364d2c
2017-08-14 18:43:28 +00:00
Felipe Leme
303b609eaa Additional documentation about Autofill / WebView security.
Test: ran 'm -j doc-comment-check-docs' and checked resulting HTML

Fixes: 64114048
Fixes: 64337380
Fixes: 64125551

Change-Id: I375bb4712af875251fea4f3e572d92165643409a
2017-08-14 08:49:47 -07:00
Nate Fischer
f332e96c66 Merge "WebView: remove unused DATA_REDUCTION_PROXY_SETTING_CHANGED API" into oc-mr1-dev am: a9732da1f3
am: e1a8030fc9

Change-Id: Ic6af76454398ab9934e635759f7271ad28313e08
2017-08-11 18:10:52 +00:00
Nate Fischer
333398f085 Merge "WebView: add WebView#getSafeBrowsingPrivacyPolicyUrl() API" into oc-mr1-dev am: 070e3c0c7f
am: 56a9c82325

Change-Id: If3247f4b91fc4b8d3dce2d8c77a3976260a69f34
2017-08-11 18:04:45 +00:00
TreeHugger Robot
a9732da1f3 Merge "WebView: remove unused DATA_REDUCTION_PROXY_SETTING_CHANGED API" into oc-mr1-dev 2017-08-11 17:38:11 +00:00
Nate Fischer
3898ac12e4 WebView: add WebView#getSafeBrowsingPrivacyPolicyUrl() API
This adds a dedicated API for fetching a URL for the Safe Browsing
reporting privacy policy.

This URL should be displayed by applications on custom Safe Browsing
interstitials.

Bug: 64077668
Test: make update-api (it compiles and javadocs look good)
Change-Id: I2873260edcaa924e68517c8679079e147b9995f4
2017-08-10 18:33:21 -07:00
Nate Fischer
064b1d5ae0 Merge "WebView: fix SafeBrowsingResponse javadocs" into oc-mr1-dev am: a9fd746ec6
am: f93765fc45

Change-Id: I2c507d1e0746125fa77627d9ea5808224f1c865d
2017-08-09 03:12:24 +00:00
Nate Fischer
bc1da9e2b4 WebView: fix SafeBrowsingResponse javadocs
Docs change only.

This fixes javadoc errors in SafeBrowsingResponse.java:

 * Typo: capital "B" in "onSafeBrowsingHit"
 * Add full package names
 * Add parameter lists to all linked methods

Bug: 64077668
Test: make update-api and check javadocs manually
Change-Id: I5e7b0e59ba865619b252f7e9e431ffac6e1bab1f
2017-08-08 15:43:44 -07:00
Nate Fischer
0c8eab49c8 Merge "WebView: update SafeBrowsing documentation" into oc-mr1-dev am: 2ddac82335
am: 650bae9c45

Change-Id: Ia4a5dc3fd03c2ecf9b7747d255380559e8955607
2017-08-08 21:38:54 +00:00
Nate Fischer
2ddac82335 Merge "WebView: update SafeBrowsing documentation" into oc-mr1-dev 2017-08-08 21:00:59 +00:00
Nate Fischer
07ea436685 WebView: remove unused DATA_REDUCTION_PROXY_SETTING_CHANGED API
This API was unused. We're removing this under recommendation from the
API council.

Bug: 62425491
Test: make -j40 update-api
Change-Id: If869305b46b2dd2c5c4ab269e3544d4e2156ddd7
2017-08-07 12:21:06 -07:00
Jeff Sharkey
1fb3a312e7 Merge "Fix broken javadocs." into oc-mr1-dev am: b79eb54d36
am: 1ad38fe278

Change-Id: I21266d20be036196dbeddb9c4366d641ab1b68a8
2017-08-06 17:00:09 +00:00
Jeff Sharkey
67f9d5070a Fix broken javadocs.
Bug: 64337634
Test: make -j32 doc-comment-check-docs
Change-Id: I20fdd3dcddef09111d35946c41c596c7689effa6
2017-08-06 07:37:08 -06:00
Selim Gurun
b988a6e8c8 Merge "Update documentation for Whitelist API" into oc-mr1-dev am: a30ec5ff4c
am: e8315ab4d7

Change-Id: Id982c9ee88065576bd73ae7ec3e91efea8963fe9
2017-07-31 14:46:30 +00:00
Selim Gurun
a30ec5ff4c Merge "Update documentation for Whitelist API" into oc-mr1-dev 2017-07-31 14:27:52 +00:00
Selim Gurun
89e935904a Update documentation for Whitelist API
Bug: 64144913
Test: compile documentation and visually confirm

Change-Id: Ia19ca9b6cf4f8a0802835d597a30e10c498dbd81
2017-07-28 12:06:42 -07:00
Nate Fischer
471891df02 WebView: update SafeBrowsing documentation
No change in logic, only docs changes:

 * Docs about Safe Browsing feature as a whole.
 * Expand the docs for initSafeBrowsing/shutdownSafeBrowsing

Bug: 63660204
Bug: 62192626
Test: make update-api and manually check javadocs
Change-Id: I6526a0f1ce1327f6eff416c27ded89866587f173
2017-07-27 21:43:59 +00:00
Tima Vaisburd
07fa454431 Merge "Merge "Unhide get/setTextClassifier in WebView" into oc-mr1-dev am: 2ebddfc398" into oc-mr1-dev-plus-aosp
am: 6a6275a802

Change-Id: I46dab838a4c5a0150f6773dee482f75c9ecf237f
2017-07-27 02:02:35 +00:00
TreeHugger Robot
5d3ff609e3 Merge "Remove a couple of unused android.webkit methods." 2017-07-21 15:19:59 +00:00
Tima Vaisburd
e8c611f04d Unhide get/setTextClassifier in WebView
We can unhide the methods etTextClassifier and getTextClassifier since
the WebView M61 that is shipping with O-MR1 has the corresponding
implementation.

Bug: 63903071
Test: CTS test in a ceparate CL
Change-Id: I72df0d34a0fccd2c213ed10ca8993a7d786ff835
2017-07-20 16:05:26 -07:00
Gustav Sennton
1dd0a4997d Remove a couple of unused android.webkit methods.
Test: build angler system image.

Change-Id: I09d7f955bd86facca4e4c9fb8ecc243f70346978
2017-07-20 16:56:15 +01:00
Nate Fischer
c5ec745135 WebView: remove @Nullable from SB whitelist
This removes the @Nullable annotation from
WebView#setSafeBrowsingWhitelist's List parameter. This does not need to
be Nullable, since the whitelist can be unset just as easily by passing
an empty list.

Bug: 63084528
Test: N/A
Change-Id: Ica9d67bc907b16e89d0a1b6a15d91e21f74cc4c9
2017-07-18 16:32:19 -07:00
TreeHugger Robot
8e82f01280 Merge "WebView: change setSafeBrowsingWhiteList signature" 2017-07-18 00:54:41 +00:00
Nate Fischer
d6385d326b WebView: change setSafeBrowsingWhiteList signature
* Renames WhiteList -> Whitelist
 * Adds a callback to indicate malformed URLs to the application

Bug: 63660204
Bug: 63084528
Bug: 63765158
Test: N/A
Change-Id: Ia12f0822c5d3a339633a820c40bdbff4137f510b
2017-07-17 23:32:22 +00:00
Nate Fischer
5ab00b31ee WebView: add IntDef for SafeBrowsingThreat
This adds an @IntDef for WebViewClient#onSafeBrowsingHit()'s threatType
argument.

Bug: 62723291, 63655766
Test: N/A
Change-Id: I71fb51753c461d1efa9de123bde977721c8da515
2017-07-13 15:28:21 -07:00
TreeHugger Robot
953daa0a78 Merge "WebView: update docs for WebView#initSafeBrowsing" 2017-07-13 06:35:00 +00:00
Nate Fischer
465104817d Merge "WebView: Fix SafeBrowsingResponse API" 2017-07-13 05:17:39 +00:00
Nate Fischer
3ca196a12d WebView: update docs for WebView#initSafeBrowsing
This fixes the documentation to specify that an application Context will
be used instead of an Activity Context (since only application Context
is needed).

Bug: 62192626, 63616213
Test: N/A
Change-Id: Ia34d2172be8cca7cb0751286c6c2388ff34d3f4a
2017-07-12 18:46:50 -07:00
Nate Fischer
520a8ba279 WebView: fix WebView#setSafeBrowsingWhiteList
This corrects the WebView#setSafeBrowsingWhiteList method to accept a
List<String> instead of a String[], as per API council recommendation.

Bug: 63084528, 63615148
Test: N/A
Change-Id: I53f490c6ab9c10fffe6c89010d7509747ac8f95f
2017-07-12 17:37:07 -07:00
Nate Fischer
6aabdc4dbc WebView: Fix SafeBrowsingResponse API
The methods were previously package-private by mistake. This fixes them
to be public.

Bug: 63615582, 62723291
Test: N/A
Change-Id: Ie9095f861213a70fd655561f911385bdd06632b3
2017-07-12 17:20:55 -07:00
Nate Fischer
2f7af06efb Add SafeBrowsingResponse abstract class
This adds a new class called SafeBrowsingResponse to replace the
ValueCallback parameter for WebViewClient#onSafeBrowsingHit. This
class contains specific methods for each of the available actions.

This also removes the SAFE_BROWSING_ACTION_* constants from the
WebViewClient class.

Bug: 62723291
Test: N/A
Change-Id: Ie4fe878ea470f7aea7a716ae9edb80b53b73e172
2017-07-11 20:32:04 +00:00
Nate Fischer
bf158ec3d8 WebView: add APIs for setSafeBrowsingWhiteList
This adds the APIs for the static method
WebView#setSafeBrowsingWhiteList().

BUG: 63084528
Test: N/A
Change-Id: I6eff32d9f8356e8c1a2c631782e07d52ba9b6ad5
2017-06-27 23:25:15 -07:00