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

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

Issue 2431753002: Mus experiment in content shell on Android.
Patch Set: Addressed comments, fixed browser tests and deps. Created 4 years, 2 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
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"
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"
18 20
19 using base::android::AttachCurrentThread; 21 using base::android::AttachCurrentThread;
20 using base::android::ConvertUTF8ToJavaString; 22 using base::android::ConvertUTF8ToJavaString;
21 using base::android::JavaParamRef; 23 using base::android::JavaParamRef;
22 using base::android::ScopedJavaLocalRef; 24 using base::android::ScopedJavaLocalRef;
23 25
24 namespace content { 26 namespace content {
25 27
26 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { 28 void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void Shell::Close() { 99 void Shell::Close() {
98 RemoveShellView(java_object_); 100 RemoveShellView(java_object_);
99 delete this; 101 delete this;
100 } 102 }
101 103
102 // static 104 // static
103 bool Shell::Register(JNIEnv* env) { 105 bool Shell::Register(JNIEnv* env) {
104 return RegisterNativesImpl(env); 106 return RegisterNativesImpl(env);
105 } 107 }
106 108
109 void Shell::StartMusDemo(JNIEnv* env,
110 const base::android::JavaParamRef<jobject>& caller) {
111 DCHECK(!mus_demo_);
112
113 mus_demo_.reset(new ui::demo::MusDemo());
114
115 service_manager::Connector* connector =
116 content::ServiceManagerConnection::GetForProcess()->GetConnector();
117 mus_demo_->Start(connector);
118 }
119
120 // static
121 jboolean ShowMusDemoButton(JNIEnv* env,
122 const base::android::JavaParamRef<jclass>& jcaller) {
123 return base::CommandLine::ForCurrentProcess()->HasSwitch(
124 switches::kShowMusDemoButton);
125 }
126
107 // static 127 // static
108 void CloseShell(JNIEnv* env, 128 void CloseShell(JNIEnv* env,
109 const JavaParamRef<jclass>& clazz, 129 const JavaParamRef<jclass>& clazz,
110 jlong shellPtr) { 130 jlong shellPtr) {
111 Shell* shell = reinterpret_cast<Shell*>(shellPtr); 131 Shell* shell = reinterpret_cast<Shell*>(shellPtr);
112 shell->Close(); 132 shell->Close();
113 } 133 }
114 134
115 } // namespace content 135 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698