| 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()); | |
| 37 } | 33 } |
| 38 | 34 |
| 39 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) { | 35 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) { |
| 40 } | 36 } |
| 41 | 37 |
| 42 void Shell::PlatformSetAddressBarURL(const GURL& url) { | 38 void Shell::PlatformSetAddressBarURL(const GURL& url) { |
| 43 JNIEnv* env = AttachCurrentThread(); | 39 JNIEnv* env = AttachCurrentThread(); |
| 44 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec()); | 40 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec()); |
| 45 Java_Shell_onUpdateUrl(env, java_object_.obj(), j_url.obj()); | 41 Java_Shell_onUpdateUrl(env, java_object_.obj(), j_url.obj()); |
| 46 } | 42 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 env, java_object_.obj(), enter_fullscreen); | 76 env, java_object_.obj(), enter_fullscreen); |
| 81 } | 77 } |
| 82 | 78 |
| 83 bool Shell::PlatformIsFullscreenForTabOrPending( | 79 bool Shell::PlatformIsFullscreenForTabOrPending( |
| 84 const WebContents* web_contents) const { | 80 const WebContents* web_contents) const { |
| 85 JNIEnv* env = AttachCurrentThread(); | 81 JNIEnv* env = AttachCurrentThread(); |
| 86 return Java_Shell_isFullscreenForTabOrPending(env, java_object_.obj()); | 82 return Java_Shell_isFullscreenForTabOrPending(env, java_object_.obj()); |
| 87 } | 83 } |
| 88 | 84 |
| 89 void Shell::Close() { | 85 void Shell::Close() { |
| 90 RemoveShellView(java_object_.obj()); | 86 CloseShellView(java_object_.obj()); |
| 87 java_object_.Reset(); |
| 91 delete this; | 88 delete this; |
| 92 } | 89 } |
| 93 | 90 |
| 94 // static | 91 // static |
| 95 bool Shell::Register(JNIEnv* env) { | 92 bool Shell::Register(JNIEnv* env) { |
| 96 return RegisterNativesImpl(env); | 93 return RegisterNativesImpl(env); |
| 97 } | 94 } |
| 98 | 95 |
| 99 // static | |
| 100 void CloseShell(JNIEnv* env, jclass clazz, jlong shellPtr) { | |
| 101 Shell* shell = reinterpret_cast<Shell*>(shellPtr); | |
| 102 shell->Close(); | |
| 103 } | |
| 104 | |
| 105 } // namespace content | 96 } // namespace content |
| OLD | NEW |