• Colin Blundell's avatar
    WebLayer: Initial implementation of intent handling · a6b8cc0f
    Colin Blundell authored
    This CL provides an initial implementation of intent handling in
    WebLayer. Specifically, it matches Android WebView's implementation. To
    do so, it brings in WebView's default behavior as implemented by
    aw_content_browser_client.cc::ShouldOverrideUrlLoading() and
    AwContentsClient.java:sendBrowsingIntent(), augmenting that default
    behavior with the Android WebView shell's internal handling of
    browser-specific URIs as implemented in
    WebViewBrowserActivity.java:startBrowsingIntent().
    
    One exception to the above is that unlike WebView, this implementation
    starts the activity with the FLAG_ACTIVITY_NEW_TASK flag set. It is
    necessary to set this flag because the application context, which is
    used here to start the activity for the intent, isn't an Activity.
    Setting this flag also matches Chrome's behavior for launching external
    intents.
    
    We explored an alternative implementation wherein we would plumb the
    Activity that is available in BrowserFragmentImpl.java all the way to
    TabImpl.java via BrowserViewController.java, and then have
    TabImpl.java implement the handling of external intents. However, we
    preferred going with this implementation as it's simpler.
    
    To test, install the Alipay app, go to alipay.com in WebLayer Shell,
    tap "Open", and verify that the Alipay app is opened.
    
    I tried to add instrumentation tests but ran into blockers described
    at crbug.com/1029710.
    
    Change-Id: Ibc5ea1ce22875e85bc8f915856d754f52ed760e2
    Bug: 1028745
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1942337
    Commit-Queue: Colin Blundell <blundell@chromium.org>
    Reviewed-by: default avatarTobias Sargeant <tobiasjs@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#720468}
    a6b8cc0f
BUILD.gn 7.02 KB