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

Side by Side Diff: content/shell/browser/shell_android.cc

Issue 117403003: Add support for closing Android Shell instances from Java. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed to allow full closing of Shells from java. Created 6 years, 11 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/shell_manager.cc ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/shell.h" 5 #include "content/shell/browser/shell.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 8
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 12 matching lines...) Expand all
23 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { 23 void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
24 CommandLine* command_line = CommandLine::ForCurrentProcess(); 24 CommandLine* command_line = CommandLine::ForCurrentProcess();
25 DCHECK(command_line->HasSwitch(switches::kForceCompositingMode)); 25 DCHECK(command_line->HasSwitch(switches::kForceCompositingMode));
26 DCHECK(command_line->HasSwitch(switches::kEnableThreadedCompositing)); 26 DCHECK(command_line->HasSwitch(switches::kEnableThreadedCompositing));
27 } 27 }
28 28
29 void Shell::PlatformExit() { 29 void Shell::PlatformExit() {
30 } 30 }
31 31
32 void Shell::PlatformCleanUp() { 32 void Shell::PlatformCleanUp() {
33 JNIEnv* env = AttachCurrentThread();
34 if (java_object_.is_null())
35 return;
36 Java_Shell_onNativeDestroyed(env, java_object_.obj());
33 } 37 }
34 38
35 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) { 39 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
36 } 40 }
37 41
38 void Shell::PlatformSetAddressBarURL(const GURL& url) { 42 void Shell::PlatformSetAddressBarURL(const GURL& url) {
39 JNIEnv* env = AttachCurrentThread(); 43 JNIEnv* env = AttachCurrentThread();
40 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec()); 44 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec());
41 Java_Shell_onUpdateUrl(env, java_object_.obj(), j_url.obj()); 45 Java_Shell_onUpdateUrl(env, java_object_.obj(), j_url.obj());
42 } 46 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 env, java_object_.obj(), enter_fullscreen); 80 env, java_object_.obj(), enter_fullscreen);
77 } 81 }
78 82
79 bool Shell::PlatformIsFullscreenForTabOrPending( 83 bool Shell::PlatformIsFullscreenForTabOrPending(
80 const WebContents* web_contents) const { 84 const WebContents* web_contents) const {
81 JNIEnv* env = AttachCurrentThread(); 85 JNIEnv* env = AttachCurrentThread();
82 return Java_Shell_isFullscreenForTabOrPending(env, java_object_.obj()); 86 return Java_Shell_isFullscreenForTabOrPending(env, java_object_.obj());
83 } 87 }
84 88
85 void Shell::Close() { 89 void Shell::Close() {
86 CloseShellView(java_object_.obj()); 90 RemoveShellView(java_object_.obj());
87 java_object_.Reset();
88 delete this; 91 delete this;
89 } 92 }
90 93
91 // static 94 // static
92 bool Shell::Register(JNIEnv* env) { 95 bool Shell::Register(JNIEnv* env) {
93 return RegisterNativesImpl(env); 96 return RegisterNativesImpl(env);
94 } 97 }
95 98
99 // static
100 void CloseShell(JNIEnv* env, jclass clazz, jlong nativeShell) {
cjhopman 2014/01/09 02:12:44 This function should be generated by the jni gener
Ted C 2014/01/09 02:46:32 Oh Chris, how you got my hopes and dashed them so
101 Shell* shell = reinterpret_cast<Shell*>(nativeShell);
102 shell->Close();
103 }
104
96 } // namespace content 105 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/android/shell_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698