OLD | NEW |
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.content.Context; | 7 import android.content.Context; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.content.pm.ResolveInfo; | 9 import android.content.pm.ResolveInfo; |
10 import android.os.IBinder; | 10 import android.os.IBinder; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 mSession, CustomTabsCallback.NAVIGATION_ABORTED); | 84 mSession, CustomTabsCallback.NAVIGATION_ABORTED); |
85 mPageLoadStartedTimestamp = SystemClock.elapsedRealtime(); | 85 mPageLoadStartedTimestamp = SystemClock.elapsedRealtime(); |
86 } | 86 } |
87 mCustomTabsConnection.notifyNavigationEvent( | 87 mCustomTabsConnection.notifyNavigationEvent( |
88 mSession, CustomTabsCallback.NAVIGATION_STARTED); | 88 mSession, CustomTabsCallback.NAVIGATION_STARTED); |
89 } | 89 } |
90 | 90 |
91 @Override | 91 @Override |
92 public void onShown(Tab tab) { | 92 public void onShown(Tab tab) { |
93 mCustomTabsConnection.notifyNavigationEvent( | 93 mCustomTabsConnection.notifyNavigationEvent( |
94 mSession, CustomTabsCallback.TAB_SHOWN); | 94 mSession, TAB_SHOWN); |
95 } | 95 } |
96 | 96 |
97 @Override | 97 @Override |
98 public void onPageLoadFinished(Tab tab) { | 98 public void onPageLoadFinished(Tab tab) { |
99 long pageLoadFinishedTimestamp = SystemClock.elapsedRealtime(); | 99 long pageLoadFinishedTimestamp = SystemClock.elapsedRealtime(); |
100 mCustomTabsConnection.notifyNavigationEvent( | 100 mCustomTabsConnection.notifyNavigationEvent( |
101 mSession, CustomTabsCallback.NAVIGATION_FINISHED); | 101 mSession, CustomTabsCallback.NAVIGATION_FINISHED); |
102 // Both histograms (commit and PLT) are reported here, to make sure | 102 // Both histograms (commit and PLT) are reported here, to make sure |
103 // that they are always recorded together, and that we only record | 103 // that they are always recorded together, and that we only record |
104 // commits for successful navigations. | 104 // commits for successful navigations. |
(...skipping 27 matching lines...) Expand all Loading... |
132 mCustomTabsConnection.notifyNavigationEvent( | 132 mCustomTabsConnection.notifyNavigationEvent( |
133 mSession, CustomTabsCallback.NAVIGATION_FAILED); | 133 mSession, CustomTabsCallback.NAVIGATION_FAILED); |
134 } | 134 } |
135 | 135 |
136 private void resetPageLoadTracking() { | 136 private void resetPageLoadTracking() { |
137 mCurrentState = STATE_RESET; | 137 mCurrentState = STATE_RESET; |
138 mIntentReceivedTimestamp = -1; | 138 mIntentReceivedTimestamp = -1; |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
| 142 static final int TAB_SHOWN = CustomTabsCallback.NAVIGATION_FAILED + 1; |
| 143 static final int TAB_HIDDEN = CustomTabsCallback.NAVIGATION_FAILED + 2; |
| 144 |
142 private ExternalNavigationHandler mNavigationHandler; | 145 private ExternalNavigationHandler mNavigationHandler; |
143 private CustomTabNavigationDelegate mNavigationDelegate; | 146 private CustomTabNavigationDelegate mNavigationDelegate; |
144 private TabChromeContextMenuItemDelegate | 147 private TabChromeContextMenuItemDelegate |
145 mContextMenuDelegate = new TabChromeContextMenuItemDelegate() { | 148 mContextMenuDelegate = new TabChromeContextMenuItemDelegate() { |
146 @Override | 149 @Override |
147 public boolean startDownload(String url, boolean isLink) { | 150 public boolean startDownload(String url, boolean isLink) { |
148 // Behave similarly to ChromeTabChromeContextMenuItemDelegat
e in ChromeTab. | 151 // Behave similarly to ChromeTabChromeContextMenuItemDelegat
e in ChromeTab. |
149 return !isLink || !shouldInterceptContextMenuDownload(url); | 152 return !isLink || !shouldInterceptContextMenuDownload(url); |
150 } | 153 } |
151 }; | 154 }; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // See http://crbug.com/369574. | 330 // See http://crbug.com/369574. |
328 if (e.getCause() != null && e.getCause() instanceof TransactionTooLa
rgeException) { | 331 if (e.getCause() != null && e.getCause() instanceof TransactionTooLa
rgeException) { |
329 Log.e(TAG, "Could not resolve Activity for intent " + intent.toS
tring(), e); | 332 Log.e(TAG, "Could not resolve Activity for intent " + intent.toS
tring(), e); |
330 } else { | 333 } else { |
331 throw e; | 334 throw e; |
332 } | 335 } |
333 } | 336 } |
334 } | 337 } |
335 | 338 |
336 } | 339 } |
OLD | NEW |