Move GetSiteForExtensionId() from ExtensionService to extension_util

BUG=351891
[email protected] (c/b/sync_file_system)
[email protected] (c/b/chromeos/file_manager)
(No functional difference for either TBR)

Review URL: https://codereview.chromium.org/198053005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257297 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/data_deleter.cc b/chrome/browser/extensions/data_deleter.cc
index c3eac660..946a90ea 100644
--- a/chrome/browser/extensions/data_deleter.cc
+++ b/chrome/browser/extensions/data_deleter.cc
@@ -6,6 +6,7 @@
 
 #include "chrome/browser/extensions/extension_service.h"
 #include "chrome/browser/extensions/extension_special_storage_policy.h"
+#include "chrome/browser/extensions/extension_util.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h"
 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
@@ -15,6 +16,7 @@
 #include "content/public/browser/storage_partition.h"
 #include "extensions/browser/api/storage/storage_frontend.h"
 #include "extensions/browser/extension_prefs.h"
+#include "extensions/browser/extension_system.h"
 #include "extensions/common/constants.h"
 #include "extensions/common/extension.h"
 #include "net/url_request/url_request_context_getter.h"
@@ -24,6 +26,8 @@
 using content::BrowserThread;
 using content::StoragePartition;
 
+namespace extensions {
+
 namespace {
 
 // Helper function that deletes data of a given |storage_origin| in a given
@@ -35,7 +39,7 @@
   DCHECK(profile);
   DCHECK(partition);
 
-  if (origin.SchemeIs(extensions::kExtensionScheme)) {
+  if (origin.SchemeIs(kExtensionScheme)) {
     // TODO(ajwong): Cookies are not properly isolated for
     // chrome-extension:// scheme.  (http://crbug.com/158386).
     //
@@ -66,28 +70,26 @@
 void OnNeedsToGarbageCollectIsolatedStorage(WeakPtr<ExtensionService> es) {
   if (!es)
     return;
-  extensions::ExtensionPrefs::Get(es->profile())
-      ->SetNeedsStorageGarbageCollection(true);
+  ExtensionPrefs::Get(es->profile())->SetNeedsStorageGarbageCollection(true);
 }
 
 } // namespace
 
-namespace extensions {
-
 // static
 void DataDeleter::StartDeleting(Profile* profile, const Extension* extension) {
   DCHECK(profile);
   DCHECK(extension);
 
-  if (extensions::AppIsolationInfo::HasIsolatedStorage(extension)) {
+  if (AppIsolationInfo::HasIsolatedStorage(extension)) {
     BrowserContext::AsyncObliterateStoragePartition(
         profile,
-        profile->GetExtensionService()->GetSiteForExtensionId(extension->id()),
-        base::Bind(&OnNeedsToGarbageCollectIsolatedStorage,
-                   profile->GetExtensionService()->AsWeakPtr()));
+        util::GetSiteForExtensionId(extension->id(), profile),
+        base::Bind(
+            &OnNeedsToGarbageCollectIsolatedStorage,
+            ExtensionSystem::Get(profile)->extension_service()->AsWeakPtr()));
   } else {
     GURL launch_web_url_origin(
-      extensions::AppLaunchInfo::GetLaunchWebURL(extension).GetOrigin());
+        AppLaunchInfo::GetLaunchWebURL(extension).GetOrigin());
 
     StoragePartition* partition = BrowserContext::GetStoragePartitionForSite(
         profile,