+void ComponentLoader::EnableFileSystemInGuestMode(const std::string& id) {
+#if defined(OS_CHROMEOS)
+ const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(chromeos::switches::kGuestSession)) {
+ // TODO(dpolukhin): Hack to enable HTML5 temporary file system for
+ // the extension. Some component extensions don't work without temporary
+ // file system access. Make sure temporary file system is enabled in the off
+ // the record browser context (as that is the one used in guest session).
+ content::BrowserContext* off_the_record_context =
+ ExtensionsBrowserClient::Get()->GetOffTheRecordContext(
+ browser_context_);
+ GURL site = content::SiteInstance::GetSiteForURL(
+ off_the_record_context, Extension::GetBaseURLFromExtensionId(id));
+ fileapi::FileSystemContext* file_system_context =
+ content::BrowserContext::GetStoragePartitionForSite(
+ off_the_record_context, site)->GetFileSystemContext();
+ file_system_context->EnableTemporaryFileSystemInIncognito();
+ }
+#endif
+}
+