summaryrefslogtreecommitdiff
path: root/chromium/extensions/renderer/scoped_web_frame.cc
blob: 2a7e37a220d9f2571911fd2297fea9148bd03b72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/renderer/scoped_web_frame.h"

#include "third_party/WebKit/public/web/WebHeap.h"

namespace extensions {

ScopedWebFrame::ScopedWebFrame() : view_(nullptr), frame_(nullptr) {
  view_ = blink::WebView::create(nullptr, blink::WebPageVisibilityStateVisible);
  frame_ = blink::WebLocalFrame::create(blink::WebTreeScopeType::Document,
                                        &frame_client_, nullptr, nullptr);
  view_->setMainFrame(frame_);
}

ScopedWebFrame::~ScopedWebFrame() {
  view_->close();
  blink::WebHeap::collectAllGarbageForTesting();
}

}  // namespace extensions