OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 boolean isRendererInitiated) { | 469 boolean isRendererInitiated) { |
470 Tab.this.openNewTab( | 470 Tab.this.openNewTab( |
471 url, extraHeaders, postData, disposition, true, isRendererIn
itiated); | 471 url, extraHeaders, postData, disposition, true, isRendererIn
itiated); |
472 } | 472 } |
473 } | 473 } |
474 | 474 |
475 /** | 475 /** |
476 * ContentViewClient that provides basic tab functionality and is meant to b
e extended | 476 * ContentViewClient that provides basic tab functionality and is meant to b
e extended |
477 * by child classes. | 477 * by child classes. |
478 */ | 478 */ |
479 protected class TabContentViewClient extends ChromeContentViewClient { | 479 protected class TabContentViewClient extends ContentViewClient { |
480 @Override | 480 @Override |
481 public void onUpdateTitle(String title) { | 481 public void onUpdateTitle(String title) { |
482 updateTitle(title); | 482 updateTitle(title); |
483 } | 483 } |
484 | 484 |
485 @Override | 485 @Override |
486 public void onContextualActionBarShown() { | 486 public void onContextualActionBarShown() { |
487 for (TabObserver observer : mObservers) { | 487 for (TabObserver observer : mObservers) { |
488 observer.onContextualActionBarVisibilityChanged(Tab.this, true); | 488 observer.onContextualActionBarVisibilityChanged(Tab.this, true); |
489 } | 489 } |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 * @param validatedUrl URL being loaded. | 1481 * @param validatedUrl URL being loaded. |
1482 * @param showingErrorPage Whether an error page is being shown. | 1482 * @param showingErrorPage Whether an error page is being shown. |
1483 */ | 1483 */ |
1484 protected void didStartPageLoad(String validatedUrl, boolean showingErrorPag
e) { | 1484 protected void didStartPageLoad(String validatedUrl, boolean showingErrorPag
e) { |
1485 mIsShowingErrorPage = showingErrorPage; | 1485 mIsShowingErrorPage = showingErrorPage; |
1486 mIsLoading = true; | 1486 mIsLoading = true; |
1487 | 1487 |
1488 updateTitle(); | 1488 updateTitle(); |
1489 removeSadTabIfPresent(); | 1489 removeSadTabIfPresent(); |
1490 | 1490 |
1491 if (getContentViewCore() != null) { | |
1492 getContentViewCore().stopCurrentAccessibilityNotifications(); | |
1493 } | |
1494 | |
1495 clearHungRendererState(); | 1491 clearHungRendererState(); |
1496 | 1492 |
1497 for (TabObserver observer : mObservers) observer.onPageLoadStarted(this)
; | 1493 for (TabObserver observer : mObservers) observer.onPageLoadStarted(this)
; |
1498 } | 1494 } |
1499 | 1495 |
1500 /** | 1496 /** |
1501 * Called when a page has finished loading. | 1497 * Called when a page has finished loading. |
1502 */ | 1498 */ |
1503 protected void didFinishPageLoad() { | 1499 protected void didFinishPageLoad() { |
1504 mIsLoading = false; | 1500 mIsLoading = false; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 } | 1536 } |
1541 | 1537 |
1542 /** | 1538 /** |
1543 * Creates and initializes the {@link ContentViewCore}. | 1539 * Creates and initializes the {@link ContentViewCore}. |
1544 * | 1540 * |
1545 * @param webContents The WebContents object that will be used to build the | 1541 * @param webContents The WebContents object that will be used to build the |
1546 * {@link ContentViewCore}. | 1542 * {@link ContentViewCore}. |
1547 */ | 1543 */ |
1548 protected void initContentViewCore(WebContents webContents) { | 1544 protected void initContentViewCore(WebContents webContents) { |
1549 ContentViewCore cvc = new ContentViewCore(mContext); | 1545 ContentViewCore cvc = new ContentViewCore(mContext); |
1550 ContentView cv = ContentView.newInstance(mContext, cvc); | 1546 ContentView cv = new ContentView(mContext, cvc); |
1551 cv.setContentDescription(mContext.getResources().getString( | 1547 cv.setContentDescription(mContext.getResources().getString( |
1552 R.string.accessibility_content_view)); | 1548 R.string.accessibility_content_view)); |
1553 cvc.initialize(cv, cv, webContents, getWindowAndroid()); | 1549 cvc.initialize(cv, cv, webContents, getWindowAndroid()); |
1554 setContentViewCore(cvc); | 1550 setContentViewCore(cvc); |
1555 } | 1551 } |
1556 | 1552 |
1557 /** | 1553 /** |
1558 * Completes the {@link ContentViewCore} specific initialization around a na
tive WebContents | 1554 * Completes the {@link ContentViewCore} specific initialization around a na
tive WebContents |
1559 * pointer. {@link #getNativePage()} will still return the {@link NativePage
} if there is one. | 1555 * pointer. {@link #getNativePage()} will still return the {@link NativePage
} if there is one. |
1560 * All initialization that needs to reoccur after a web contents swap should
be added here. | 1556 * All initialization that needs to reoccur after a web contents swap should
be added here. |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2158 @CalledByNative | 2154 @CalledByNative |
2159 private long getNativePtr() { | 2155 private long getNativePtr() { |
2160 return mNativeTabAndroid; | 2156 return mNativeTabAndroid; |
2161 } | 2157 } |
2162 | 2158 |
2163 /** This is currently called when committing a pre-rendered page. */ | 2159 /** This is currently called when committing a pre-rendered page. */ |
2164 @CalledByNative | 2160 @CalledByNative |
2165 private void swapWebContents( | 2161 private void swapWebContents( |
2166 WebContents webContents, boolean didStartLoad, boolean didFinishLoad
) { | 2162 WebContents webContents, boolean didStartLoad, boolean didFinishLoad
) { |
2167 ContentViewCore cvc = new ContentViewCore(mContext); | 2163 ContentViewCore cvc = new ContentViewCore(mContext); |
2168 ContentView cv = ContentView.newInstance(mContext, cvc); | 2164 ContentView cv = new ContentView(mContext, cvc); |
2169 cv.setContentDescription(mContext.getResources().getString( | 2165 cv.setContentDescription(mContext.getResources().getString( |
2170 R.string.accessibility_content_view)); | 2166 R.string.accessibility_content_view)); |
2171 cvc.initialize(cv, cv, webContents, getWindowAndroid()); | 2167 cvc.initialize(cv, cv, webContents, getWindowAndroid()); |
2172 swapContentViewCore(cvc, false, didStartLoad, didFinishLoad); | 2168 swapContentViewCore(cvc, false, didStartLoad, didFinishLoad); |
2173 } | 2169 } |
2174 | 2170 |
2175 /** | 2171 /** |
2176 * Called to swap out the current view with the one passed in. | 2172 * Called to swap out the current view with the one passed in. |
2177 * | 2173 * |
2178 * @param newContentViewCore The content view that should be swapped into th
e tab. | 2174 * @param newContentViewCore The content view that should be swapped into th
e tab. |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2770 private native void nativeAttachToTabContentManager(long nativeTabAndroid, | 2766 private native void nativeAttachToTabContentManager(long nativeTabAndroid, |
2771 TabContentManager tabContentManager); | 2767 TabContentManager tabContentManager); |
2772 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid
, | 2768 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid
, |
2773 ContentViewCore content, boolean visible); | 2769 ContentViewCore content, boolean visible); |
2774 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid
, | 2770 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid
, |
2775 ContentViewCore content); | 2771 ContentViewCore content); |
2776 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String
url); | 2772 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String
url); |
2777 | 2773 |
2778 private static native void nativeRecordStartupToCommitUma(); | 2774 private static native void nativeRecordStartupToCommitUma(); |
2779 } | 2775 } |
OLD | NEW |