Pull GetInstalledPwaForUrl() function into extension_util

This is a simple refactor CL that has no changes to behaviour.
We wish to use this function in a couple more places in the future
so bringing it up to this util file will avoid further duplication.

Change-Id: I448ddc47001e9755d514de16e1b2c056e0346886
Reviewed-on: https://chromium-review.googlesource.com/961567
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Ben Wells <[email protected]>
Reviewed-by: Giovanni Ortuño Urquidi <[email protected]>
Commit-Queue: Alan Cutter <[email protected]>
Cr-Commit-Position: refs/heads/master@{#544924}
diff --git a/chrome/browser/extensions/extension_util.h b/chrome/browser/extensions/extension_util.h
index 544a641..ba9e713 100644
--- a/chrome/browser/extensions/extension_util.h
+++ b/chrome/browser/extensions/extension_util.h
@@ -8,6 +8,9 @@
 #include <memory>
 #include <string>
 
+#include "base/optional.h"
+#include "extensions/common/constants.h"
+
 namespace base {
 class DictionaryValue;
 }
@@ -20,6 +23,7 @@
 class ImageSkia;
 }
 
+class GURL;
 class Profile;
 
 namespace extensions {
@@ -109,6 +113,13 @@
 // Returns true for custodian-installed extensions in a supervised profile.
 bool IsExtensionSupervised(const Extension* extension, Profile* profile);
 
+// Finds the first PWA with |url| in its scope, returns nullptr if there are
+// none.
+const Extension* GetInstalledPwaForUrl(
+    content::BrowserContext* context,
+    const GURL& url,
+    base::Optional<LaunchContainer> launch_container_filter = base::nullopt);
+
 }  // namespace util
 }  // namespace extensions