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 "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
8 #include "content/shell/browser/shell_platform_data_aura.h" | 8 #include "content/shell/browser/shell_platform_data_aura.h" |
9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
10 #include "ui/aura/test/test_screen.h" | 10 #include "ui/aura/test/test_screen.h" |
11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
12 #include "ui/aura/window_event_dispatcher.h" | 12 #include "ui/aura/window_event_dispatcher.h" |
13 | 13 |
| 14 #if defined(OS_ANDROID) |
| 15 #include "jni/Shell_jni.h" |
| 16 #endif |
| 17 |
14 namespace content { | 18 namespace content { |
15 | 19 |
| 20 #if defined(OS_ANDROID) |
| 21 |
| 22 void CloseShell(JNIEnv* env, jclass clazz, jlong shellPtr) { |
| 23 Shell* shell = reinterpret_cast<Shell*>(shellPtr); |
| 24 shell->Close(); |
| 25 } |
| 26 |
| 27 // static |
| 28 bool Shell::Register(JNIEnv* env) { |
| 29 return RegisterNativesImpl(env); |
| 30 } |
| 31 #endif |
| 32 |
16 // static | 33 // static |
17 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { | 34 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { |
18 CHECK(!platform_); | 35 CHECK(!platform_); |
19 aura::TestScreen* screen = aura::TestScreen::Create(gfx::Size()); | 36 aura::TestScreen* screen = aura::TestScreen::Create(gfx::Size()); |
20 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen); | 37 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen); |
21 platform_ = new ShellPlatformDataAura(default_window_size); | 38 platform_ = new ShellPlatformDataAura(default_window_size); |
22 } | 39 } |
23 | 40 |
24 void Shell::PlatformExit() { | 41 void Shell::PlatformExit() { |
25 CHECK(platform_); | 42 CHECK(platform_); |
26 delete platform_; | 43 delete platform_; |
27 platform_ = NULL; | 44 platform_ = NULL; |
28 aura::Env::DeleteInstance(); | 45 aura::Env::DeleteInstance(); |
29 } | 46 } |
30 | 47 |
31 void Shell::PlatformCleanUp() { | 48 void Shell::PlatformCleanUp() { |
| 49 #if defined(OS_ANDROID) |
| 50 JNIEnv* env = base::android::AttachCurrentThread(); |
| 51 if (java_object_.is_null()) |
| 52 return; |
| 53 |
| 54 Java_Shell_onNativeDestroyed(env, java_object_.obj()); |
| 55 #endif |
32 } | 56 } |
33 | 57 |
34 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) { | 58 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) { |
35 } | 59 } |
36 | 60 |
37 void Shell::PlatformSetAddressBarURL(const GURL& url) { | 61 void Shell::PlatformSetAddressBarURL(const GURL& url) { |
38 } | 62 } |
39 | 63 |
40 void Shell::PlatformSetIsLoading(bool loading) { | 64 void Shell::PlatformSetIsLoading(bool loading) { |
41 } | 65 } |
(...skipping 24 matching lines...) Expand all Loading... |
66 | 90 |
67 void Shell::PlatformSetTitle(const base::string16& title) { | 91 void Shell::PlatformSetTitle(const base::string16& title) { |
68 } | 92 } |
69 | 93 |
70 bool Shell::PlatformHandleContextMenu( | 94 bool Shell::PlatformHandleContextMenu( |
71 const content::ContextMenuParams& params) { | 95 const content::ContextMenuParams& params) { |
72 return false; | 96 return false; |
73 } | 97 } |
74 | 98 |
75 } // namespace content | 99 } // namespace content |
OLD | NEW |