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

Side by Side Diff: content/shell/android/shell_manager.cc

Issue 10701177: Make content shell on android support relaunching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and removed unnecessary content:: namespacing. Created 8 years, 5 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 | « content/shell/android/java/src/org/chromium/content_shell/ShellManager.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/shell/android/shell_manager.h" 5 #include "content/shell/android/shell_manager.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h"
8 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
9 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "content/shell/shell.h"
12 #include "content/shell/shell_browser_context.h"
13 #include "content/shell/shell_content_browser_client.h"
14 #include "googleurl/src/gurl.h"
10 #include "jni/ShellManager_jni.h" 15 #include "jni/ShellManager_jni.h"
11 16
12 using base::android::ScopedJavaLocalRef; 17 using base::android::ScopedJavaLocalRef;
13 18
14 base::LazyInstance<base::android::ScopedJavaGlobalRef<jobject> > 19 base::LazyInstance<base::android::ScopedJavaGlobalRef<jobject> >
15 g_content_shell_manager = LAZY_INSTANCE_INITIALIZER; 20 g_content_shell_manager = LAZY_INSTANCE_INITIALIZER;
16 21
17 namespace content { 22 namespace content {
18 23
19 jobject CreateShellView() { 24 jobject CreateShellView() {
20 JNIEnv* env = base::android::AttachCurrentThread(); 25 JNIEnv* env = base::android::AttachCurrentThread();
21 return Java_ShellManager_createShell( 26 return Java_ShellManager_createShell(
22 env, g_content_shell_manager.Get().obj()).Release(); 27 env, g_content_shell_manager.Get().obj()).Release();
23 } 28 }
24 29
25 // Register native methods 30 // Register native methods
26 bool RegisterShellManager(JNIEnv* env) { 31 bool RegisterShellManager(JNIEnv* env) {
27 return RegisterNativesImpl(env); 32 return RegisterNativesImpl(env);
28 } 33 }
29 34
30 static void Init(JNIEnv* env, jclass clazz, jobject obj) { 35 static void Init(JNIEnv* env, jclass clazz, jobject obj) {
31 g_content_shell_manager.Get().Reset( 36 g_content_shell_manager.Get().Reset(
32 base::android::ScopedJavaLocalRef<jobject>(env, obj)); 37 base::android::ScopedJavaLocalRef<jobject>(env, obj));
33 } 38 }
34 39
40 void LaunchShell(JNIEnv* env, jclass clazz, jstring jurl) {
41 ShellBrowserContext* browserContext =
42 static_cast<ShellContentBrowserClient*>(
43 GetContentClient()->browser())->browser_context();
44 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl));
45 Shell::CreateNewWindow(browserContext,
46 url,
47 NULL,
48 MSG_ROUTING_NONE,
49 NULL);
50 }
51
35 } // namespace content 52 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/android/java/src/org/chromium/content_shell/ShellManager.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698