OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.content_shell; |
| 6 |
| 7 import android.content.Context; |
| 8 import android.util.AttributeSet; |
| 9 import android.view.LayoutInflater; |
| 10 import android.widget.FrameLayout; |
| 11 |
| 12 import org.chromium.base.CalledByNative; |
| 13 |
| 14 /** |
| 15 * Container and generator of ShellViews. |
| 16 */ |
| 17 public class ShellManager extends FrameLayout { |
| 18 |
| 19 private ShellView mActiveShellView; |
| 20 |
| 21 /** |
| 22 * Constructor for inflating via XML. |
| 23 */ |
| 24 public ShellManager(Context context, AttributeSet attrs) { |
| 25 super(context, attrs); |
| 26 nativeInit(this); |
| 27 } |
| 28 |
| 29 /** |
| 30 * @return The currently visible shell view or null if one is not showing. |
| 31 */ |
| 32 protected ShellView getActiveShellView() { |
| 33 return mActiveShellView; |
| 34 } |
| 35 |
| 36 @SuppressWarnings("unused") |
| 37 @CalledByNative |
| 38 private int createShell() { |
| 39 LayoutInflater inflater = |
| 40 (LayoutInflater) getContext().getSystemService(Context.LAYOUT_IN
FLATER_SERVICE); |
| 41 ShellView shellView = (ShellView) inflater.inflate(R.layout.shell_view,
null); |
| 42 |
| 43 removeAllViews(); |
| 44 addView(shellView, new FrameLayout.LayoutParams( |
| 45 FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.
MATCH_PARENT)); |
| 46 mActiveShellView = shellView; |
| 47 |
| 48 return shellView.getNativeShellView(); |
| 49 } |
| 50 |
| 51 private static native void nativeInit(Object shellManagerInstance); |
| 52 } |
OLD | NEW |