IndexedDBFactory now ForceCloses databases.
[chromium-blink-merge.git] / content / shell / browser / shell_android.cc
blobb11ba37abaa1d3c7eba35fbc76ddf17159853ba2
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::kForceCompositingMode));
26 DCHECK(command_line->HasSwitch(switches::kEnableThreadedCompositing));
29 void Shell::PlatformExit() {
32 void Shell::PlatformCleanUp() {
35 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
38 void Shell::PlatformSetAddressBarURL(const GURL& url) {
39 JNIEnv* env = AttachCurrentThread();
40 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec());
41 Java_Shell_onUpdateUrl(env, java_object_.obj(), j_url.obj());
44 void Shell::PlatformSetIsLoading(bool loading) {
45 JNIEnv* env = AttachCurrentThread();
46 Java_Shell_setIsLoading(env, java_object_.obj(), loading);
49 void Shell::PlatformCreateWindow(int width, int height) {
50 java_object_.Reset(AttachCurrentThread(), CreateShellView(this));
53 void Shell::PlatformSetContents() {
54 JNIEnv* env = AttachCurrentThread();
55 Java_Shell_initFromNativeTabContents(
56 env, java_object_.obj(), reinterpret_cast<intptr_t>(web_contents()));
59 void Shell::PlatformResizeSubViews() {
60 // Not needed; subviews are bound.
63 void Shell::PlatformSetTitle(const base::string16& title) {
64 NOTIMPLEMENTED();
67 void Shell::LoadProgressChanged(WebContents* source, double progress) {
68 JNIEnv* env = AttachCurrentThread();
69 Java_Shell_onLoadProgressChanged(env, java_object_.obj(), progress);
72 void Shell::PlatformToggleFullscreenModeForTab(WebContents* web_contents,
73 bool enter_fullscreen) {
74 JNIEnv* env = AttachCurrentThread();
75 Java_Shell_toggleFullscreenModeForTab(
76 env, java_object_.obj(), enter_fullscreen);
79 bool Shell::PlatformIsFullscreenForTabOrPending(
80 const WebContents* web_contents) const {
81 JNIEnv* env = AttachCurrentThread();
82 return Java_Shell_isFullscreenForTabOrPending(env, java_object_.obj());
85 void Shell::Close() {
86 CloseShellView(java_object_.obj());
87 java_object_.Reset();
88 delete this;
91 // static
92 bool Shell::Register(JNIEnv* env) {
93 return RegisterNativesImpl(env);
96 } // namespace content