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

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

Issue 2847533004: customtabs: Don't cache the Tab in PageLoadMetricsObserver. (Closed)
Patch Set: Created 3 years, 7 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.customtabs; 5 package org.chromium.chrome.browser.customtabs;
6 6
7 import android.app.PendingIntent; 7 import android.app.PendingIntent;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.SharedPreferences; 10 import android.content.SharedPreferences;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 private boolean mIsClosing; 125 private boolean mIsClosing;
126 126
127 // This boolean is used to do a hack in navigation history for 127 // This boolean is used to do a hack in navigation history for
128 // prerender and hidden tab loads with unmatching fragments. 128 // prerender and hidden tab loads with unmatching fragments.
129 private boolean mIsFirstLoad; 129 private boolean mIsFirstLoad;
130 130
131 private static class PageLoadMetricsObserver implements PageLoadMetrics.Obse rver { 131 private static class PageLoadMetricsObserver implements PageLoadMetrics.Obse rver {
132 private final CustomTabsConnection mConnection; 132 private final CustomTabsConnection mConnection;
133 private final CustomTabsSessionToken mSession; 133 private final CustomTabsSessionToken mSession;
134 private final Tab mTab; 134 private final WebContents mWebContents;
135 135
136 public PageLoadMetricsObserver(CustomTabsConnection connection, 136 public PageLoadMetricsObserver(CustomTabsConnection connection,
137 CustomTabsSessionToken session, Tab tab) { 137 CustomTabsSessionToken session, Tab tab) {
138 mConnection = connection; 138 mConnection = connection;
139 mSession = session; 139 mSession = session;
140 mTab = tab; 140 mWebContents = tab.getWebContents();
141 } 141 }
142 142
143 @Override 143 @Override
144 public void onFirstContentfulPaint( 144 public void onFirstContentfulPaint(
145 WebContents webContents, long navigationStartTick, long firstCon tentfulPaintMs) { 145 WebContents webContents, long navigationStartTick, long firstCon tentfulPaintMs) {
146 if (webContents != mTab.getWebContents()) return; 146 if (webContents != mWebContents) return;
147 147
148 mConnection.notifyPageLoadMetric(mSession, PageLoadMetrics.FIRST_CON TENTFUL_PAINT, 148 mConnection.notifyPageLoadMetric(mSession, PageLoadMetrics.FIRST_CON TENTFUL_PAINT,
149 navigationStartTick, firstContentfulPaintMs); 149 navigationStartTick, firstContentfulPaintMs);
150 } 150 }
151 151
152 @Override 152 @Override
153 public void onLoadEventStart( 153 public void onLoadEventStart(
154 WebContents webContents, long navigationStartTick, long loadEven tStartMs) { 154 WebContents webContents, long navigationStartTick, long loadEven tStartMs) {
155 if (webContents != mTab.getWebContents()) return; 155 if (webContents != mWebContents) return;
156 156
157 mConnection.notifyPageLoadMetric(mSession, PageLoadMetrics.LOAD_EVEN T_START, 157 mConnection.notifyPageLoadMetric(mSession, PageLoadMetrics.LOAD_EVEN T_START,
158 navigationStartTick, loadEventStartMs); 158 navigationStartTick, loadEventStartMs);
159 } 159 }
160 } 160 }
161 161
162 private static class CustomTabCreator extends ChromeTabCreator { 162 private static class CustomTabCreator extends ChromeTabCreator {
163 private final boolean mSupportsUrlBarHiding; 163 private final boolean mSupportsUrlBarHiding;
164 private final boolean mIsOpenedByChrome; 164 private final boolean mIsOpenedByChrome;
165 private final BrowserStateBrowserControlsVisibilityDelegate mVisibilityD elegate; 165 private final BrowserStateBrowserControlsVisibilityDelegate mVisibilityD elegate;
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 Intent intent = ChromeLauncherActivity.createCustomTabActivityIntent( 1142 Intent intent = ChromeLauncherActivity.createCustomTabActivityIntent(
1143 context, customTabIntent.intent, false); 1143 context, customTabIntent.intent, false);
1144 intent.setPackage(context.getPackageName()); 1144 intent.setPackage(context.getPackageName());
1145 intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_INFO_PAGE, true); 1145 intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_INFO_PAGE, true);
1146 intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); 1146 intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
1147 IntentHandler.addTrustedIntentExtras(intent); 1147 IntentHandler.addTrustedIntentExtras(intent);
1148 1148
1149 context.startActivity(intent); 1149 context.startActivity(intent);
1150 } 1150 }
1151 } 1151 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698