• Colin Blundell's avatar
    [WebLayer] Use Activity instead of ApplicationContext to launch Intents · 8ce966f6
    Colin Blundell authored
    This CL implements the feedback from boliu@ that the Activity is more
    suitable than the ApplicationContext for launching external Intents.
    This change should also make it easier to add an integration test of
    launching external Intents in WebLayer.
    
    A couple notes on the implementation changes:
    - I explored various ways to change the API but ended up just passing
      the Java Tab from content_browser_client_impl.cc to the static Java
      method that implements intent launching. Given the fact that the
      content_browser_client_impl.cc callsite needs to interact with the
      JNIEnv object after making the call, this seemed like the most
      straightforward change.
    - It's debatable what action to take if the Activity is not available:
      bail out or use the ApplicationContext? In this CL I decided on the
      former; if we find any evidence that there are user flows for this
      use case we could change it to the latter.
    
    Bug: 1031465, 1029710
    Change-Id: I23f3006422d47818e3873678fa936b3350cd4b35
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2054864Reviewed-by: default avatarBo <boliu@chromium.org>
    Commit-Queue: Colin Blundell <blundell@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#741388}
    8ce966f6
content_browser_client_impl.cc 20.5 KB