summaryrefslogtreecommitdiff
path: root/chromium/extensions/browser/offscreen_document_host.cc
blob: 0da3f13589d8c08603061752a0895b5e535773c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/browser/offscreen_document_host.h"

#include "base/check.h"
#include "base/feature_list.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_features.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace extensions {

OffscreenDocumentHost::OffscreenDocumentHost(
    const Extension& extension,
    content::SiteInstance* site_instance,
    const GURL& url)
    : ExtensionHost(&extension,
                    site_instance,
                    url,
                    mojom::ViewType::kOffscreenDocument) {
  DCHECK(base::FeatureList::IsEnabled(
      extensions_features::kExtensionsOffscreenDocuments));
  DCHECK_EQ(url::Origin::Create(url), extension.origin());
  DCHECK_GE(extension.manifest_version(), 3);
}

OffscreenDocumentHost::~OffscreenDocumentHost() = default;

void OffscreenDocumentHost::OnDidStopFirstLoad() {
  // Nothing to do for offscreen documents.
}

bool OffscreenDocumentHost::IsBackgroundPage() const {
  return false;
}

}  // namespace extensions