Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 SCOPED_WEB_FRAME_H_ | |
| 6 #define SCOPED_WEB_FRAME_H_ | |
| 7 | |
| 8 #include "third_party/WebKit/public/web/WebFrame.h" | |
| 9 #include "third_party/WebKit/public/web/WebHeap.h" | |
| 10 #include "third_party/WebKit/public/web/WebLocalFrame.h" | |
| 11 #include "third_party/WebKit/public/web/WebView.h" | |
| 12 | |
| 13 namespace extensions { | |
| 14 | |
| 15 class ScopedWebFrame { | |
|
not at google - send to devlin
2015/06/25 15:20:16
This should be split into a .h and a .cc file. The
haraken
2015/06/26 00:35:34
Done.
| |
| 16 public: | |
| 17 ScopedWebFrame() : view_(nullptr), frame_(nullptr) { | |
| 18 view_ = blink::WebView::create(nullptr); | |
| 19 frame_ = blink::WebLocalFrame::create( | |
| 20 blink::WebTreeScopeType::Document, nullptr); | |
| 21 view_->setMainFrame(frame_); | |
| 22 } | |
| 23 | |
| 24 ~ScopedWebFrame() { | |
| 25 view_->close(); | |
| 26 frame_->close(); | |
| 27 blink::WebHeap::collectAllGarbageForTesting(); | |
| 28 } | |
| 29 | |
| 30 blink::WebLocalFrame* frame() { return frame_; } | |
| 31 | |
| 32 private: | |
| 33 blink::WebView* view_; | |
|
not at google - send to devlin
2015/06/25 15:20:16
Is there a comment here you could make about the l
haraken
2015/06/26 00:35:34
Added a comment. It's not nice that the content la
| |
| 34 blink::WebLocalFrame* frame_; | |
|
not at google - send to devlin
2015/06/25 15:20:16
Also DISALLOW_COPY_AND_ASSIGN.
haraken
2015/06/26 00:35:34
Done.
| |
| 35 }; | |
| 36 | |
| 37 } // namespace extensions | |
| 38 | |
| 39 #endif // SCOPED_WEB_FRAME_H_ | |
| OLD | NEW |