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

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 11348075: [Android WebView] AwContentsClient.shouldCreate window callback part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Marcin's comments. Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/native/aw_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include "android_webview/browser/net_disk_cache_remover.h" 7 #include "android_webview/browser/net_disk_cache_remover.h"
8 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" 8 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h"
9 #include "android_webview/common/aw_hit_test_data.h" 9 #include "android_webview/common/aw_hit_test_data.h"
10 #include "android_webview/native/aw_browser_dependency_factory.h" 10 #include "android_webview/native/aw_browser_dependency_factory.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 AwContents::AwContents(JNIEnv* env, 83 AwContents::AwContents(JNIEnv* env,
84 jobject obj, 84 jobject obj,
85 jobject web_contents_delegate, 85 jobject web_contents_delegate,
86 bool private_browsing) 86 bool private_browsing)
87 : java_ref_(env, obj), 87 : java_ref_(env, obj),
88 web_contents_delegate_( 88 web_contents_delegate_(
89 new AwWebContentsDelegate(env, web_contents_delegate)) { 89 new AwWebContentsDelegate(env, web_contents_delegate)) {
90 android_webview::AwBrowserDependencyFactory* dependency_factory = 90 android_webview::AwBrowserDependencyFactory* dependency_factory =
91 android_webview::AwBrowserDependencyFactory::GetInstance(); 91 android_webview::AwBrowserDependencyFactory::GetInstance();
92 92
93 web_contents_.reset(dependency_factory->CreateWebContents(private_browsing)); 93 SetWebContents(dependency_factory->CreateWebContents(private_browsing));
94 }
94 95
95 DCHECK(!AwContents::FromWebContents(web_contents_.get())); 96 void AwContents::SetWebContents(content::WebContents* web_contents) {
97 web_contents_.reset(web_contents);
96 web_contents_->SetUserData(kAwContentsUserDataKey, 98 web_contents_->SetUserData(kAwContentsUserDataKey,
97 new AwContentsUserData(this)); 99 new AwContentsUserData(this));
98 100
99 web_contents_->SetDelegate(web_contents_delegate_.get()); 101 web_contents_->SetDelegate(web_contents_delegate_.get());
100 render_view_host_ext_.reset(new AwRenderViewHostExt(web_contents_.get())); 102 render_view_host_ext_.reset(new AwRenderViewHostExt(web_contents_.get()));
101 } 103 }
102 104
105 void AwContents::SetWebContents(JNIEnv* env, jobject obj, jint new_wc) {
106 SetWebContents(reinterpret_cast<content::WebContents*>(new_wc));
107 }
108
103 AwContents::~AwContents() { 109 AwContents::~AwContents() {
104 DCHECK(AwContents::FromWebContents(web_contents_.get()) == this); 110 DCHECK(AwContents::FromWebContents(web_contents_.get()) == this);
105 web_contents_->RemoveUserData(kAwContentsUserDataKey); 111 web_contents_->RemoveUserData(kAwContentsUserDataKey);
106 if (find_helper_.get()) 112 if (find_helper_.get())
107 find_helper_->SetListener(NULL); 113 find_helper_->SetListener(NULL);
108 } 114 }
109 115
110 void AwContents::DrawGL(AwDrawGLInfo* draw_info) { 116 void AwContents::DrawGL(AwDrawGLInfo* draw_info) {
111 // TODO(joth): Do some drawing. 117 // TODO(joth): Do some drawing.
112 } 118 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 int w, int h, int ow, int oh) { 378 int w, int h, int ow, int oh) {
373 // TODO(joth): Set Compositor size. 379 // TODO(joth): Set Compositor size.
374 } 380 }
375 381
376 void AwContents::SetWindowViewVisibility(JNIEnv* env, jobject obj, 382 void AwContents::SetWindowViewVisibility(JNIEnv* env, jobject obj,
377 bool window_visible, 383 bool window_visible,
378 bool view_visible) { 384 bool view_visible) {
379 // TODO(joth): Set the Compositor visibility. 385 // TODO(joth): Set the Compositor visibility.
380 } 386 }
381 387
388 void AwContents::SetPendingWebContentsForPopup(
389 scoped_ptr<content::WebContents> pending) {
390 if (pending_contents_.get()) {
391 // TODO(benm): Support holding multiple pop up window requests.
392 LOG(WARNING) << "Blocking popup window creation as an outstanding "
393 << " popup window still pending.";
394 return;
395 }
396 pending_contents_ = pending.Pass();
397 }
398
399 jint AwContents::ReleasePopupWebContents(JNIEnv* env, jobject obj) {
400 return reinterpret_cast<jint>(pending_contents_.release());
401 }
402
382 } // namespace android_webview 403 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698