Remove use of GetDefaultStoragePartition from chromeos/extensions

This should fix the most of issues for v2 app file manager in bug 158837, but not all of them (specifically, file browser handlers different from file manager won't work on drive).

This should not change the behaviour for non isolated apps.

BUG=158837
TEST=None

(mechanical change in chrome/browser/ui/views/select_file_dialog_extension.cc)
[email protected]


Review URL: https://chromiumcodereview.appspot.com/11367032

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176290 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 726959e9..a0c3ef90 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1162,9 +1162,13 @@
       profile_, extension->GetChromeURLOverrides());
 
 #if defined(OS_CHROMEOS)
-  // Revoke external file access to third party extensions.
+  // Revoke external file access for the extension from its file system context.
+  // It is safe to access the extension's storage partition at this point. The
+  // storage partition may get destroyed only after the extension gets unloaded.
+  GURL site = extensions::ExtensionSystem::Get(profile_)->extension_service()->
+      GetSiteForExtensionId(extension->id());
   fileapi::FileSystemContext* filesystem_context =
-      BrowserContext::GetDefaultStoragePartition(profile_)->
+      BrowserContext::GetStoragePartitionForSite(profile_, site)->
           GetFileSystemContext();
   if (filesystem_context && filesystem_context->external_provider()) {
     filesystem_context->external_provider()->