Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |