| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 16 #include "content/public/common/service_manager_connection.h" |
| 16 #include "content/shell/android/shell_manager.h" | 17 #include "content/shell/android/shell_manager.h" |
| 18 #include "content/shell/common/shell_switches.h" |
| 17 #include "jni/Shell_jni.h" | 19 #include "jni/Shell_jni.h" |
| 20 #include "services/service_manager/public/cpp/connector.h" |
| 18 | 21 |
| 19 using base::android::AttachCurrentThread; | 22 using base::android::AttachCurrentThread; |
| 20 using base::android::ConvertUTF8ToJavaString; | 23 using base::android::ConvertUTF8ToJavaString; |
| 21 using base::android::JavaParamRef; | 24 using base::android::JavaParamRef; |
| 22 using base::android::ScopedJavaLocalRef; | 25 using base::android::ScopedJavaLocalRef; |
| 23 | 26 |
| 24 namespace content { | 27 namespace content { |
| 25 | 28 |
| 26 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { | 29 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { |
| 27 } | 30 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void Shell::Close() { | 100 void Shell::Close() { |
| 98 RemoveShellView(java_object_); | 101 RemoveShellView(java_object_); |
| 99 delete this; | 102 delete this; |
| 100 } | 103 } |
| 101 | 104 |
| 102 // static | 105 // static |
| 103 bool Shell::Register(JNIEnv* env) { | 106 bool Shell::Register(JNIEnv* env) { |
| 104 return RegisterNativesImpl(env); | 107 return RegisterNativesImpl(env); |
| 105 } | 108 } |
| 106 | 109 |
| 110 void Shell::StartMusDemo(JNIEnv* env, |
| 111 const base::android::JavaParamRef<jobject>& caller) { |
| 112 DCHECK(!mus_demo_connection_); |
| 113 |
| 114 mus_demo_connection_ = |
| 115 content::ServiceManagerConnection::GetForProcess()->GetConnector() |
| 116 ->Connect("service:mus_demo"); |
| 117 } |
| 118 |
| 119 // static |
| 120 jboolean ShowMusDemoButton(JNIEnv* env, |
| 121 const base::android::JavaParamRef<jclass>& jcaller) { |
| 122 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 123 switches::kShowMusDemoButton); |
| 124 } |
| 125 |
| 107 // static | 126 // static |
| 108 void CloseShell(JNIEnv* env, | 127 void CloseShell(JNIEnv* env, |
| 109 const JavaParamRef<jclass>& clazz, | 128 const JavaParamRef<jclass>& clazz, |
| 110 jlong shellPtr) { | 129 jlong shellPtr) { |
| 111 Shell* shell = reinterpret_cast<Shell*>(shellPtr); | 130 Shell* shell = reinterpret_cast<Shell*>(shellPtr); |
| 112 shell->Close(); | 131 shell->Close(); |
| 113 } | 132 } |
| 114 | 133 |
| 115 } // namespace content | 134 } // namespace content |
| OLD | NEW |