linux_aura: Disable the plugin install infobar.
[chromium-blink-merge.git] / content / shell / browser / shell_android.cc
blob4033b479a9580d131624322bc62b69e9f6f27254
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
3 // found in the LICENSE file.
5 #include "content/shell/browser/shell.h"
7 #include <jni.h>
9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h"
11 #include "base/command_line.h"
12 #include "base/logging.h"
13 #include "base/strings/string_piece.h"
14 #include "content/public/common/content_switches.h"
15 #include "content/shell/android/shell_manager.h"
16 #include "jni/Shell_jni.h"
18 using base::android::AttachCurrentThread;
19 using base::android::ConvertUTF8ToJavaString;
21 namespace content {
23 void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
24 CommandLine* command_line = CommandLine::ForCurrentProcess();
25 DCHECK(command_line->HasSwitch(switches::kEnableThreadedCompositing));
28 void Shell::PlatformExit() {
31 void Shell::PlatformCleanUp() {
32 JNIEnv* env = AttachCurrentThread();
33 if (java_object_.is_null())
34 return;
35 Java_Shell_onNativeDestroyed(env, java_object_.obj());
38 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
39 JNIEnv* env = AttachCurrentThread();
40 if (java_object_.is_null())
41 return;
42 Java_Shell_enableUiControl(env, java_object_.obj(), control, is_enabled);
45 void Shell::PlatformSetAddressBarURL(const GURL& url) {
46 JNIEnv* env = AttachCurrentThread();
47 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec());
48 Java_Shell_onUpdateUrl(env, java_object_.obj(), j_url.obj());
51 void Shell::PlatformSetIsLoading(bool loading) {
52 JNIEnv* env = AttachCurrentThread();
53 Java_Shell_setIsLoading(env, java_object_.obj(), loading);
56 void Shell::PlatformCreateWindow(int width, int height) {
57 java_object_.Reset(AttachCurrentThread(), CreateShellView(this));
60 void Shell::PlatformSetContents() {
61 JNIEnv* env = AttachCurrentThread();
62 Java_Shell_initFromNativeTabContents(
63 env, java_object_.obj(), reinterpret_cast<intptr_t>(web_contents()));
66 void Shell::PlatformResizeSubViews() {
67 // Not needed; subviews are bound.
70 void Shell::PlatformSetTitle(const base::string16& title) {
71 NOTIMPLEMENTED();
74 void Shell::LoadProgressChanged(WebContents* source, double progress) {
75 JNIEnv* env = AttachCurrentThread();
76 Java_Shell_onLoadProgressChanged(env, java_object_.obj(), progress);
79 void Shell::PlatformToggleFullscreenModeForTab(WebContents* web_contents,
80 bool enter_fullscreen) {
81 JNIEnv* env = AttachCurrentThread();
82 Java_Shell_toggleFullscreenModeForTab(
83 env, java_object_.obj(), enter_fullscreen);
86 bool Shell::PlatformIsFullscreenForTabOrPending(
87 const WebContents* web_contents) const {
88 JNIEnv* env = AttachCurrentThread();
89 return Java_Shell_isFullscreenForTabOrPending(env, java_object_.obj());
92 bool Shell::PlatformHandleContextMenu(
93 const content::ContextMenuParams& params) {
94 return false;
97 void Shell::Close() {
98 RemoveShellView(java_object_.obj());
99 delete this;
102 // static
103 bool Shell::Register(JNIEnv* env) {
104 return RegisterNativesImpl(env);
107 // static
108 void CloseShell(JNIEnv* env, jclass clazz, jlong shellPtr) {
109 Shell* shell = reinterpret_cast<Shell*>(shellPtr);
110 shell->Close();
113 } // namespace content