Refactors checking whether a url is in app to be more efficient.

Previously this check was O(num_extensions*num_url_handlers)
and we were repeating this check for the initial, last committed
and visible urls.

This improves the check be O(num_url_handlers) for hosted apps
and O(1) for other AppBrowserControllers.

This also renames IsSameScope to IsURLInApp, as different
AppBrowserControllers do not have a concept of 'Scope'.

Bug: 964167
Change-Id: Ie36a6c2176faf649524c529dba4ff359e48b91f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1687331
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: Alan Cutter <alancutter@chromium.org>
Commit-Queue: Jay Harris <harrisjay@chromium.org>
Cr-Commit-Position: refs/heads/master@{#675409}
7 files changed