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

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

Issue 10855171: Add a test runner for android_webview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address feedback Created 8 years, 4 months 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
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | android_webview/native/aw_contents_container.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "android_webview/native/aw_contents.h"
6
7 #include "android_webview/native/aw_browser_dependency_factory.h"
8 #include "android_webview/native/aw_contents_container.h"
9 #include "android_webview/native/aw_web_contents_delegate.h"
10 #include "base/android/jni_android.h"
11 #include "base/android/jni_string.h"
12 #include "content/public/browser/android/content_view_core.h"
13 #include "content/public/browser/web_contents.h"
14 #include "jni/AwContents_jni.h"
15
16 using base::android::AttachCurrentThread;
17 using base::android::ConvertUTF16ToJavaString;
18 using content::ContentViewCore;
19 using content::WebContents;
20
21 namespace android_webview {
22
23 AwContents::AwContents(JNIEnv* env,
24 jobject obj,
25 jobject web_contents_delegate,
26 bool private_browsing)
27 : java_ref_(env, obj),
28 web_contents_delegate_(
29 new AwWebContentsDelegate(env, web_contents_delegate)) {
30 android_webview::AwBrowserDependencyFactory* dependency_factory =
31 android_webview::AwBrowserDependencyFactory::GetInstance();
32 content::WebContents* web_contents =
33 dependency_factory->CreateWebContents(private_browsing);
34 contents_container_.reset(dependency_factory->CreateContentsContainer(
35 web_contents));
36 web_contents->SetDelegate(web_contents_delegate_.get());
37 web_contents_delegate_->SetJavaScriptDialogCreator(
38 dependency_factory->GetJavaScriptDialogCreator());
39 }
40
41 AwContents::~AwContents() {
42 }
43
44 jint AwContents::GetWebContents(JNIEnv* env, jobject obj) {
45 return reinterpret_cast<jint>(contents_container_->GetWebContents());
46 }
47
48 void AwContents::Destroy(JNIEnv* env, jobject obj) {
49 delete this;
50 }
51
52 static jint Init(JNIEnv* env,
53 jobject obj,
54 jobject web_contents_delegate,
55 jboolean private_browsing) {
56 AwContents* tab = new AwContents(env, obj, web_contents_delegate,
57 private_browsing);
58 return reinterpret_cast<jint>(tab);
59 }
60
61 bool RegisterAwContents(JNIEnv* env) {
62 return RegisterNativesImpl(env) >= 0;
63 }
64
65
66 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | android_webview/native/aw_contents_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698