Commit 5c23b37e authored by mtomasz's avatar mtomasz Committed by Commit bot

Enable file_system_provider::Service in incognito.

There is no need to limit the FSP API to non-incognito only. Especially, such
limitation was causing crashes in Files app running in incognito, which
assumed the service exists, but it didn't.

With this CL the service is created for both non-incognito and incognito pages.
Both instances are *same*, so mounted providers will be shared between incognito
and non-incognito windows.

TEST=Tested manually by launching with --incognito
BUG=487901

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

Cr-Commit-Position: refs/heads/master@{#329792}
parent bd674422
......@@ -6,6 +6,7 @@
#include "chrome/browser/chromeos/file_system_provider/service.h"
#include "chrome/browser/extensions/extension_system_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_factory.h"
......@@ -48,5 +49,10 @@ KeyedService* ServiceFactory::BuildServiceInstanceFor(
bool ServiceFactory::ServiceIsCreatedWithBrowserContext() const { return true; }
content::BrowserContext* ServiceFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
return chrome::GetBrowserContextRedirectedInIncognito(context);
}
} // namespace file_system_provider
} // namespace chromeos
......@@ -41,6 +41,8 @@ class ServiceFactory : public BrowserContextKeyedServiceFactory {
KeyedService* BuildServiceInstanceFor(
content::BrowserContext* profile) const override;
bool ServiceIsCreatedWithBrowserContext() const override;
content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override;
DISALLOW_COPY_AND_ASSIGN(ServiceFactory);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment