Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: content/renderer/proxy_view_host.cc

Issue 8760024: Cross-process postMessage (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2011 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
6 #include "proxy_view_host.h"
7 #include "base/logging.h"
8 #include "content/renderer/dom_proxy_listener.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h"
13
14 namespace content {
15
16 ProxyViewHost::ProxyViewHost(RenderView* owner,
17 int64 opener_browsing_instance_frame_id)
18 : RenderViewObserver(owner),
19 opener_browsing_instance_frame_id_(opener_browsing_instance_frame_id) {
20 webview_ = WebView::create(this);
21 webview_->settings()->setJavaScriptEnabled(true);
22 webview_->initializeMainFrame(this);
23
24 WebFrame* frame = webview_->mainFrame();
25
26 frame->loadHTMLString(std::string(), GURL("about:swappedout"),
27 GURL("about:swappedout"), false);
28 }
29
30 void ProxyViewHost::didFinishDocumentLoad(WebFrame* frame) {
31 DCHECK_EQ(frame, webview_->mainFrame());
32 dom_proxy_listener_ = new DOMProxyListener(
33 frame, opener_browsing_instance_frame_id_);
34 }
35
36 void ProxyViewHost::Navigate(const GURL& url) {
37 // TODO(supersat): Does window.opener get reset on navigations?
38 }
39
40 void ProxyViewHost::ClosePage() {
41 // If the owner frame closes, the opener proxy is no longer needed.
42 delete this;
43 }
44
45 WebFrame* ProxyViewHost::mainFrame() {
46 return webview_->mainFrame();
47 }
48
49 ProxyViewHost::~ProxyViewHost() {
50 delete dom_proxy_listener_;
51 webview_->close();
52 }
53
54 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698