1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef FUCHSIA_ENGINE_BROWSER_WEB_ENGINE_BROWSER_CONTEXT_H_ 6 #define FUCHSIA_ENGINE_BROWSER_WEB_ENGINE_BROWSER_CONTEXT_H_ 7 8 #include <memory> 9 10 #include "base/files/file_path.h" 11 #include "base/macros.h" 12 #include "components/keyed_service/core/simple_factory_key.h" 13 #include "content/public/browser/browser_context.h" 14 15 class WebEngineNetLogObserver; 16 class WebEnginePermissionDelegate; 17 18 class WebEngineBrowserContext : public content::BrowserContext { 19 public: 20 // |force_incognito|: If set, then this BrowserContext will run in incognito 21 // mode even if /data is available. 22 explicit WebEngineBrowserContext(bool force_incognito); 23 ~WebEngineBrowserContext() override; 24 25 // BrowserContext implementation. 26 std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( 27 const base::FilePath& partition_path) override; 28 base::FilePath GetPath() override; 29 bool IsOffTheRecord() override; 30 content::ResourceContext* GetResourceContext() override; 31 content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; 32 content::BrowserPluginGuestManager* GetGuestManager() override; 33 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; 34 content::PushMessagingService* GetPushMessagingService() override; 35 content::StorageNotificationService* GetStorageNotificationService() override; 36 content::SSLHostStateDelegate* GetSSLHostStateDelegate() override; 37 content::PermissionControllerDelegate* GetPermissionControllerDelegate() 38 override; 39 content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate() 40 override; 41 content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override; 42 content::BackgroundSyncController* GetBackgroundSyncController() override; 43 content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate() 44 override; 45 46 private: 47 // Contains URLRequestContextGetter required for resource loading. 48 class ResourceContext; 49 50 base::FilePath data_dir_path_; 51 52 std::unique_ptr<WebEngineNetLogObserver> net_log_observer_; 53 std::unique_ptr<SimpleFactoryKey> simple_factory_key_; 54 std::unique_ptr<ResourceContext> resource_context_; 55 std::unique_ptr<WebEnginePermissionDelegate> permission_delegate_; 56 57 DISALLOW_COPY_AND_ASSIGN(WebEngineBrowserContext); 58 }; 59 60 #endif // FUCHSIA_ENGINE_BROWSER_WEB_ENGINE_BROWSER_CONTEXT_H_ 61