Java Code Examples for org.chromium.chrome.browser.tab.Tab#isInitialized()

The following examples show how to use org.chromium.chrome.browser.tab.Tab#isInitialized() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CastNotificationControl.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private String getCurrentTabOrigin() {
    Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();

    if (!(activity instanceof ChromeTabbedActivity)) return null;

    Tab tab = ((ChromeTabbedActivity) activity).getActivityTab();
    if (tab == null || !tab.isInitialized()) return null;

    String url = tab.getUrl();
    try {
        return UrlFormatter.formatUrlForSecurityDisplay(new URI(url), true);
    } catch (URISyntaxException | UnsatisfiedLinkError e) {
        // UnstatisfiedLinkError can only happen in tests as the natives are not initialized
        // yet.
        Log.e(TAG, "Unable to parse the origin from the URL. Using the full URL instead.");
        return url;
    }
}
 
Example 2
Source File: TabPrinter.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public boolean print() {
    Tab tab = mTab.get();
    if (tab == null || !tab.isInitialized()) {
        Log.d(TAG, "Tab not ready, unable to start printing.");
        return false;
    }
    return tab.print();
}
 
Example 3
Source File: LayerTitleCache.java    From delion with Apache License 2.0 5 votes vote down vote up
private void updateFaviconFromHistory(Tab tab, Bitmap faviconBitmap) {
    if (!tab.isInitialized()) return;

    int tabId = tab.getId();
    Title title = mTitles.get(tabId);
    if (title == null) return;
    if (!title.updateFaviconFromHistory(faviconBitmap)) return;

    if (mNativeLayerTitleCache != 0) {
        nativeUpdateFavicon(mNativeLayerTitleCache, tabId, title.getFaviconResId());
    }
}
 
Example 4
Source File: TabModelImpl.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void destroy() {
    for (Tab tab : mTabs) {
        if (tab.isInitialized()) tab.destroy();
    }

    mRewoundList.destroy();
    mTabs.clear();
    mObservers.clear();

    super.destroy();
}
 
Example 5
Source File: TabPrinter.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public boolean print() {
    Tab tab = mTab.get();
    if (tab == null || !tab.isInitialized()) {
        Log.d(TAG, "Tab not ready, unable to start printing.");
        return false;
    }
    return tab.print();
}
 
Example 6
Source File: LayerTitleCache.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void updateFaviconFromHistory(Tab tab, Bitmap faviconBitmap) {
    if (!tab.isInitialized()) return;

    int tabId = tab.getId();
    Title title = mTitles.get(tabId);
    if (title == null) return;
    if (!title.updateFaviconFromHistory(faviconBitmap)) return;

    if (mNativeLayerTitleCache != 0) {
        nativeUpdateFavicon(mNativeLayerTitleCache, tabId, title.getFaviconResId());
    }
}
 
Example 7
Source File: TabModelImpl.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void destroy() {
    for (Tab tab : mTabs) {
        if (tab.isInitialized()) tab.destroy();
    }

    mRewoundList.destroy();
    mTabs.clear();
    mObservers.clear();
    mRecentlyClosedBridge.destroy();
    super.destroy();
}
 
Example 8
Source File: TabPrinter.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public boolean print() {
    Tab tab = mTab.get();
    if (tab == null || !tab.isInitialized()) {
        Log.d(TAG, "Tab not ready, unable to start printing.");
        return false;
    }
    return tab.print();
}
 
Example 9
Source File: LayerTitleCache.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void updateFaviconFromHistory(Tab tab, Bitmap faviconBitmap) {
    if (!tab.isInitialized()) return;

    int tabId = tab.getId();
    Title title = mTitles.get(tabId);
    if (title == null) return;
    if (!title.updateFaviconFromHistory(faviconBitmap)) return;

    if (mNativeLayerTitleCache != 0) {
        nativeUpdateFavicon(mNativeLayerTitleCache, tabId, title.getFaviconResId());
    }
}
 
Example 10
Source File: TabModelImpl.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void destroy() {
    for (Tab tab : mTabs) {
        if (tab.isInitialized()) tab.destroy();
    }

    mRewoundList.destroy();
    mTabs.clear();
    mObservers.clear();
    mRecentlyClosedBridge.destroy();
    super.destroy();
}
 
Example 11
Source File: TabModelImpl.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Destroy all tabs in this model.  This will check to see if the tab is already destroyed
 * before destroying it.
 */
public void destroy() {
    for (Tab tab : mRewoundTabs) {
        if (tab.isInitialized()) tab.destroy();
    }
}
 
Example 12
Source File: TabModelImpl.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Destroy all tabs in this model.  This will check to see if the tab is already destroyed
 * before destroying it.
 */
public void destroy() {
    for (Tab tab : mRewoundTabs) {
        if (tab.isInitialized()) tab.destroy();
    }
}
 
Example 13
Source File: TabModelImpl.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Destroy all tabs in this model.  This will check to see if the tab is already destroyed
 * before destroying it.
 */
public void destroy() {
    for (Tab tab : mRewoundTabs) {
        if (tab.isInitialized()) tab.destroy();
    }
}