OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.chrome.browser; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
10 import android.graphics.Color; | 10 import android.graphics.Color; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 private ContentViewCore mContentViewCore; | 92 private ContentViewCore mContentViewCore; |
93 | 93 |
94 /** | 94 /** |
95 * A list of TabBase observers. These are used to broadcast TabBase events
to listeners. | 95 * A list of TabBase observers. These are used to broadcast TabBase events
to listeners. |
96 */ | 96 */ |
97 private final ObserverList<TabObserver> mObservers = new ObserverList<TabObs
erver>(); | 97 private final ObserverList<TabObserver> mObservers = new ObserverList<TabObs
erver>(); |
98 | 98 |
99 // Content layer Observers and Delegates | 99 // Content layer Observers and Delegates |
100 private ContentViewClient mContentViewClient; | 100 private ContentViewClient mContentViewClient; |
101 private WebContentsObserverAndroid mWebContentsObserver; | 101 private WebContentsObserverAndroid mWebContentsObserver; |
102 private VoiceSearchTabHelper mVoiceSearchTabHelper; | |
103 private TabBaseChromeWebContentsDelegateAndroid mWebContentsDelegate; | 102 private TabBaseChromeWebContentsDelegateAndroid mWebContentsDelegate; |
104 | 103 |
105 /** | 104 /** |
106 * A default {@link ChromeContextMenuItemDelegate} that supports some of the
context menu | 105 * A default {@link ChromeContextMenuItemDelegate} that supports some of the
context menu |
107 * functionality. | 106 * functionality. |
108 */ | 107 */ |
109 protected class TabBaseChromeContextMenuItemDelegate | 108 protected class TabBaseChromeContextMenuItemDelegate |
110 extends EmptyChromeContextMenuItemDelegate { | 109 extends EmptyChromeContextMenuItemDelegate { |
111 private final Clipboard mClipboard; | 110 private final Clipboard mClipboard; |
112 | 111 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 protected void initContentView(long nativeWebContents) { | 607 protected void initContentView(long nativeWebContents) { |
609 NativePage previousNativePage = mNativePage; | 608 NativePage previousNativePage = mNativePage; |
610 mNativePage = null; | 609 mNativePage = null; |
611 destroyNativePageInternal(previousNativePage); | 610 destroyNativePageInternal(previousNativePage); |
612 | 611 |
613 mContentView = ContentView.newInstance(mContext, nativeWebContents, getW
indowAndroid()); | 612 mContentView = ContentView.newInstance(mContext, nativeWebContents, getW
indowAndroid()); |
614 | 613 |
615 mContentViewCore = mContentView.getContentViewCore(); | 614 mContentViewCore = mContentView.getContentViewCore(); |
616 mWebContentsDelegate = createWebContentsDelegate(); | 615 mWebContentsDelegate = createWebContentsDelegate(); |
617 mWebContentsObserver = new TabBaseWebContentsObserverAndroid(mContentVie
wCore); | 616 mWebContentsObserver = new TabBaseWebContentsObserverAndroid(mContentVie
wCore); |
618 mVoiceSearchTabHelper = new VoiceSearchTabHelper(mContentViewCore); | |
619 | 617 |
620 if (mContentViewClient != null) mContentViewCore.setContentViewClient(mC
ontentViewClient); | 618 if (mContentViewClient != null) mContentViewCore.setContentViewClient(mC
ontentViewClient); |
621 | 619 |
622 assert mNativeTabAndroid != 0; | 620 assert mNativeTabAndroid != 0; |
623 nativeInitWebContents( | 621 nativeInitWebContents( |
624 mNativeTabAndroid, mIncognito, mContentViewCore, mWebContentsDel
egate, | 622 mNativeTabAndroid, mIncognito, mContentViewCore, mWebContentsDel
egate, |
625 new TabBaseContextMenuPopulator(createContextMenuPopulator())); | 623 new TabBaseContextMenuPopulator(createContextMenuPopulator())); |
626 | 624 |
627 // In the case where restoring a Tab or showing a prerendered one we alr
eady have a | 625 // In the case where restoring a Tab or showing a prerendered one we alr
eady have a |
628 // valid infobar container, no need to recreate one. | 626 // valid infobar container, no need to recreate one. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 | 712 |
715 if (mInfoBarContainer != null && mInfoBarContainer.getParent() != null)
{ | 713 if (mInfoBarContainer != null && mInfoBarContainer.getParent() != null)
{ |
716 mInfoBarContainer.removeFromParentView(); | 714 mInfoBarContainer.removeFromParentView(); |
717 } | 715 } |
718 if (mContentViewCore != null) mContentViewCore.destroy(); | 716 if (mContentViewCore != null) mContentViewCore.destroy(); |
719 | 717 |
720 mContentView = null; | 718 mContentView = null; |
721 mContentViewCore = null; | 719 mContentViewCore = null; |
722 mWebContentsDelegate = null; | 720 mWebContentsDelegate = null; |
723 mWebContentsObserver = null; | 721 mWebContentsObserver = null; |
724 mVoiceSearchTabHelper = null; | |
725 | 722 |
726 assert mNativeTabAndroid != 0; | 723 assert mNativeTabAndroid != 0; |
727 nativeDestroyWebContents(mNativeTabAndroid, deleteNativeWebContents); | 724 nativeDestroyWebContents(mNativeTabAndroid, deleteNativeWebContents); |
728 } | 725 } |
729 | 726 |
730 /** | 727 /** |
731 * Gives subclasses the chance to clean up some state associated with this {
@link ContentView}. | 728 * Gives subclasses the chance to clean up some state associated with this {
@link ContentView}. |
732 * This is because {@link #getContentView()} can return {@code null} if a {@
link NativePage} | 729 * This is because {@link #getContentView()} can return {@code null} if a {@
link NativePage} |
733 * is showing. | 730 * is showing. |
734 * @param contentView The {@link ContentView} that should have associated st
ate cleaned up. | 731 * @param contentView The {@link ContentView} that should have associated st
ate cleaned up. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 private native void nativeInitWebContents(long nativeTabAndroid, boolean inc
ognito, | 856 private native void nativeInitWebContents(long nativeTabAndroid, boolean inc
ognito, |
860 ContentViewCore contentViewCore, ChromeWebContentsDelegateAndroid de
legate, | 857 ContentViewCore contentViewCore, ChromeWebContentsDelegateAndroid de
legate, |
861 ContextMenuPopulator contextMenuPopulator); | 858 ContextMenuPopulator contextMenuPopulator); |
862 private native void nativeDestroyWebContents(long nativeTabAndroid, boolean
deleteNative); | 859 private native void nativeDestroyWebContents(long nativeTabAndroid, boolean
deleteNative); |
863 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); | 860 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); |
864 private native int nativeGetSecurityLevel(long nativeTabAndroid); | 861 private native int nativeGetSecurityLevel(long nativeTabAndroid); |
865 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab
Android, String url, | 862 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab
Android, String url, |
866 String title); | 863 String title); |
867 private native boolean nativePrint(long nativeTabAndroid); | 864 private native boolean nativePrint(long nativeTabAndroid); |
868 } | 865 } |
OLD | NEW |