Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(830)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/Tab.java

Issue 901203003: Redo how AppBannerInfoBars are created and stored (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving init before the early return so that restored tabs also get them Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/banners/AppBannerManager.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 } finally { 1234 } finally {
1235 if (mTimestampMillis == INVALID_TIMESTAMP) { 1235 if (mTimestampMillis == INVALID_TIMESTAMP) {
1236 mTimestampMillis = System.currentTimeMillis(); 1236 mTimestampMillis = System.currentTimeMillis();
1237 } 1237 }
1238 1238
1239 TraceEvent.end("Tab.initialize"); 1239 TraceEvent.end("Tab.initialize");
1240 } 1240 }
1241 } 1241 }
1242 1242
1243 /** 1243 /**
1244 * Perform any subclass-specific initialization tasks. 1244 * Perform any class-specific initialization tasks.
1245 * @param tabContentManager A {@link TabContentManager} instance or {@code n ull} if the web 1245 * @param tabContentManager A {@link TabContentManager} instance or {@code n ull} if the web
1246 * content will be managed/displayed manually. 1246 * content will be managed/displayed manually.
1247 */ 1247 */
1248 protected void internalInit(TabContentManager tabContentManager) { 1248 protected void internalInit(TabContentManager tabContentManager) {
1249 initializeNative(); 1249 initializeNative();
1250
1251 if (AppBannerManager.isEnabled()) {
1252 mAppBannerManager = new AppBannerManager(this);
1253 addObserver(mAppBannerManager);
1254 }
1250 } 1255 }
1251 1256
1252 /** 1257 /**
1253 * Called when a page has started loading. 1258 * Called when a page has started loading.
1254 * @param validatedUrl URL being loaded. 1259 * @param validatedUrl URL being loaded.
1255 * @param showingErrorPage Whether an error page is being shown. 1260 * @param showingErrorPage Whether an error page is being shown.
1256 */ 1261 */
1257 protected void didStartPageLoad(String validatedUrl, boolean showingErrorPag e) { 1262 protected void didStartPageLoad(String validatedUrl, boolean showingErrorPag e) {
1258 mIsShowingErrorPage = showingErrorPage; 1263 mIsShowingErrorPage = showingErrorPage;
1259 1264
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 // The InfoBarContainer needs to be created after the ContentView ha s been natively 1368 // The InfoBarContainer needs to be created after the ContentView ha s been natively
1364 // initialized. 1369 // initialized.
1365 WebContents webContents = mContentViewCore.getWebContents(); 1370 WebContents webContents = mContentViewCore.getWebContents();
1366 mInfoBarContainer = new InfoBarContainer( 1371 mInfoBarContainer = new InfoBarContainer(
1367 mContext, getId(), mContentViewParent, webContents, this); 1372 mContext, getId(), mContentViewParent, webContents, this);
1368 } else { 1373 } else {
1369 mInfoBarContainer.onParentViewChanged(getId(), mContentViewParent); 1374 mInfoBarContainer.onParentViewChanged(getId(), mContentViewParent);
1370 } 1375 }
1371 mInfoBarContainer.setContentViewCore(mContentViewCore); 1376 mInfoBarContainer.setContentViewCore(mContentViewCore);
1372 1377
1373 if (AppBannerManager.isEnabled() && mAppBannerManager == null) {
1374 mAppBannerManager = new AppBannerManager(this);
1375 }
1376
1377 if (DomDistillerFeedbackReporter.isEnabled() && mDomDistillerFeedbackRep orter == null) { 1378 if (DomDistillerFeedbackReporter.isEnabled() && mDomDistillerFeedbackRep orter == null) {
1378 mDomDistillerFeedbackReporter = new DomDistillerFeedbackReporter(thi s); 1379 mDomDistillerFeedbackReporter = new DomDistillerFeedbackReporter(thi s);
1379 } 1380 }
1380 1381
1381 for (TabObserver observer : mObservers) observer.onContentChanged(this); 1382 for (TabObserver observer : mObservers) observer.onContentChanged(this);
1382 1383
1383 // For browser tabs, we want to set accessibility focus to the page 1384 // For browser tabs, we want to set accessibility focus to the page
1384 // when it loads. This is not the default behavior for embedded 1385 // when it loads. This is not the default behavior for embedded
1385 // web views. 1386 // web views.
1386 mContentViewCore.setShouldSetAccessibilityFocusOnPageLoad(true); 1387 mContentViewCore.setShouldSetAccessibilityFocusOnPageLoad(true);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 // expects all infobars to be cleaned up before its own destruction. 1461 // expects all infobars to be cleaned up before its own destruction.
1461 assert mNativeTabAndroid != 0; 1462 assert mNativeTabAndroid != 0;
1462 nativeDestroy(mNativeTabAndroid); 1463 nativeDestroy(mNativeTabAndroid);
1463 assert mNativeTabAndroid == 0; 1464 assert mNativeTabAndroid == 0;
1464 1465
1465 if (mInfoBarContainer != null) { 1466 if (mInfoBarContainer != null) {
1466 mInfoBarContainer.destroy(); 1467 mInfoBarContainer.destroy();
1467 mInfoBarContainer = null; 1468 mInfoBarContainer = null;
1468 } 1469 }
1469 1470
1471 // Destroy the AppBannerManager after the InfoBarContainer because it mo nitors for infobar
1472 // removals.
1473 if (mAppBannerManager != null) {
1474 mAppBannerManager.destroy();
1475 mAppBannerManager = null;
1476 }
1477
1470 mPreviousFullscreenTopControlsOffsetY = Float.NaN; 1478 mPreviousFullscreenTopControlsOffsetY = Float.NaN;
1471 mPreviousFullscreenContentOffsetY = Float.NaN; 1479 mPreviousFullscreenContentOffsetY = Float.NaN;
1472 1480
1473 mNeedsReload = false; 1481 mNeedsReload = false;
1474 } 1482 }
1475 1483
1476 /** 1484 /**
1477 * @return Whether or not this Tab has a live native component. 1485 * @return Whether or not this Tab has a live native component.
1478 */ 1486 */
1479 public boolean isInitialized() { 1487 public boolean isInitialized() {
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 private native boolean nativePrint(long nativeTabAndroid); 2386 private native boolean nativePrint(long nativeTabAndroid);
2379 private native Bitmap nativeGetFavicon(long nativeTabAndroid); 2387 private native Bitmap nativeGetFavicon(long nativeTabAndroid);
2380 private native void nativeCreateHistoricalTab(long nativeTabAndroid); 2388 private native void nativeCreateHistoricalTab(long nativeTabAndroid);
2381 private native void nativeUpdateTopControlsState( 2389 private native void nativeUpdateTopControlsState(
2382 long nativeTabAndroid, int constraints, int current, boolean animate ); 2390 long nativeTabAndroid, int constraints, int current, boolean animate );
2383 private native void nativeSearchByImageInNewTabAsync(long nativeTabAndroid); 2391 private native void nativeSearchByImageInNewTabAsync(long nativeTabAndroid);
2384 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, 2392 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id,
2385 InterceptNavigationDelegate delegate); 2393 InterceptNavigationDelegate delegate);
2386 private static native void nativeRecordStartupToCommitUma(); 2394 private static native void nativeRecordStartupToCommitUma();
2387 } 2395 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/banners/AppBannerManager.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698