feat: [extensions] background pages (#21591)

This commit is contained in:
Jeremy Apthorp 2020-01-13 14:55:58 -08:00 committed by GitHub
parent cf497ea478
commit 8bc0c92137
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 477 additions and 11 deletions

View file

@ -0,0 +1,41 @@
// Copyright 2019 Slack Technologies, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_PROCESS_MANAGER_DELEGATE_H_
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_PROCESS_MANAGER_DELEGATE_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/process_manager_delegate.h"
class Browser;
class Profile;
namespace extensions {
// Support for ProcessManager. Controls cases where Electron wishes to disallow
// extension background pages or defer their creation.
class ElectronProcessManagerDelegate : public ProcessManagerDelegate {
public:
ElectronProcessManagerDelegate();
~ElectronProcessManagerDelegate() override;
// ProcessManagerDelegate implementation:
bool AreBackgroundPagesAllowedForContext(
content::BrowserContext* context) const override;
bool IsExtensionBackgroundPageAllowed(
content::BrowserContext* context,
const Extension& extension) const override;
bool DeferCreatingStartupBackgroundHosts(
content::BrowserContext* context) const override;
private:
DISALLOW_COPY_AND_ASSIGN(ElectronProcessManagerDelegate);
};
} // namespace extensions
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_PROCESS_MANAGER_DELEGATE_H_