OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 package org.chromium.content_shell; | 5 package org.chromium.content_shell; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.util.AttributeSet; | 8 import android.util.AttributeSet; |
9 import android.view.LayoutInflater; | 9 import android.view.LayoutInflater; |
10 import android.widget.FrameLayout; | 10 import android.widget.FrameLayout; |
(...skipping 17 matching lines...) Expand all Loading... |
28 nativeInit(this); | 28 nativeInit(this); |
29 } | 29 } |
30 | 30 |
31 /** | 31 /** |
32 * @return The currently visible shell view or null if one is not showing. | 32 * @return The currently visible shell view or null if one is not showing. |
33 */ | 33 */ |
34 protected Shell getActiveShell() { | 34 protected Shell getActiveShell() { |
35 return mActiveShell; | 35 return mActiveShell; |
36 } | 36 } |
37 | 37 |
| 38 /** |
| 39 * Creates a new shell pointing to the specified URL. |
| 40 * @param url The URL the shell should load upon creation. |
| 41 */ |
| 42 public void launchShell(String url) { |
| 43 nativeLaunchShell(url); |
| 44 } |
| 45 |
38 @SuppressWarnings("unused") | 46 @SuppressWarnings("unused") |
39 @CalledByNative | 47 @CalledByNative |
40 private Object createShell() { | 48 private Object createShell() { |
41 LayoutInflater inflater = | 49 LayoutInflater inflater = |
42 (LayoutInflater) getContext().getSystemService(Context.LAYOUT_IN
FLATER_SERVICE); | 50 (LayoutInflater) getContext().getSystemService(Context.LAYOUT_IN
FLATER_SERVICE); |
43 Shell shellView = (Shell) inflater.inflate(R.layout.shell_view, null); | 51 Shell shellView = (Shell) inflater.inflate(R.layout.shell_view, null); |
44 | 52 |
45 removeAllViews(); | 53 removeAllViews(); |
46 addView(shellView, new FrameLayout.LayoutParams( | 54 addView(shellView, new FrameLayout.LayoutParams( |
47 FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.
MATCH_PARENT)); | 55 FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.
MATCH_PARENT)); |
48 mActiveShell = shellView; | 56 mActiveShell = shellView; |
49 | 57 |
50 return shellView; | 58 return shellView; |
51 } | 59 } |
52 | 60 |
53 private static native void nativeInit(Object shellManagerInstance); | 61 private static native void nativeInit(Object shellManagerInstance); |
| 62 private static native void nativeLaunchShell(String url); |
54 } | 63 } |
OLD | NEW |