blob: f4bac25c72e33fdd25d0f21446ac5b542d2cc37b [file] [log] [blame]
[email protected]6b54fda2014-07-22 02:13:471// Copyright 2014 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 CHROME_BROWSER_EXTENSIONS_CHROME_PROCESS_MANAGER_DELEGATE_H_
6#define CHROME_BROWSER_EXTENSIONS_CHROME_PROCESS_MANAGER_DELEGATE_H_
7
8#include "base/compiler_specific.h"
9#include "base/macros.h"
Evan Stadee55e6b92019-07-25 18:59:2210#include "chrome/browser/ui/browser_list_observer.h"
[email protected]6b54fda2014-07-22 02:13:4711#include "content/public/browser/notification_observer.h"
12#include "content/public/browser/notification_registrar.h"
13#include "extensions/browser/process_manager_delegate.h"
14
15class Browser;
16class Profile;
17
18namespace extensions {
19
20// Support for ProcessManager. Controls cases where Chrome wishes to disallow
21// extension background pages or defer their creation.
22class ChromeProcessManagerDelegate : public ProcessManagerDelegate,
Evan Stadee55e6b92019-07-25 18:59:2223 public content::NotificationObserver,
24 public BrowserListObserver {
[email protected]6b54fda2014-07-22 02:13:4725 public:
26 ChromeProcessManagerDelegate();
dchengae36a4a2014-10-21 12:36:3627 ~ChromeProcessManagerDelegate() override;
[email protected]6b54fda2014-07-22 02:13:4728
Evan Stadee55e6b92019-07-25 18:59:2229 // ProcessManagerDelegate:
achuithd3da4f02017-03-23 20:05:2930 bool AreBackgroundPagesAllowedForContext(
31 content::BrowserContext* context) const override;
32 bool IsExtensionBackgroundPageAllowed(
33 content::BrowserContext* context,
34 const Extension& extension) const override;
dchengae36a4a2014-10-21 12:36:3635 bool DeferCreatingStartupBackgroundHosts(
mostynba15bee12014-10-04 00:40:3236 content::BrowserContext* context) const override;
[email protected]6b54fda2014-07-22 02:13:4737
Evan Stadee55e6b92019-07-25 18:59:2238 // content::NotificationObserver:
dchengae36a4a2014-10-21 12:36:3639 void Observe(int type,
40 const content::NotificationSource& source,
41 const content::NotificationDetails& details) override;
[email protected]6b54fda2014-07-22 02:13:4742
Evan Stadee55e6b92019-07-25 18:59:2243 // BrowserListObserver:
44 void OnBrowserAdded(Browser* browser) override;
45
[email protected]6b54fda2014-07-22 02:13:4746 private:
47 // Notification handlers.
[email protected]6b54fda2014-07-22 02:13:4748 void OnProfileCreated(Profile* profile);
[email protected]9602db42014-07-25 05:24:3749 void OnProfileDestroyed(Profile* profile);
[email protected]6b54fda2014-07-22 02:13:4750
51 content::NotificationRegistrar registrar_;
52
53 DISALLOW_COPY_AND_ASSIGN(ChromeProcessManagerDelegate);
54};
55
56} // namespace extensions
57
58#endif // CHROME_BROWSER_EXTENSIONS_CHROME_PROCESS_MANAGER_DELEGATE_H_