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 13 matching lines...) Expand all Loading... | |
24 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulatorWrapper; | 24 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulatorWrapper; |
25 import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegat e; | 25 import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegat e; |
26 import org.chromium.chrome.browser.dom_distiller.DomDistillerFeedbackReporter; | 26 import org.chromium.chrome.browser.dom_distiller.DomDistillerFeedbackReporter; |
27 import org.chromium.chrome.browser.infobar.AutoLoginProcessor; | 27 import org.chromium.chrome.browser.infobar.AutoLoginProcessor; |
28 import org.chromium.chrome.browser.infobar.InfoBarContainer; | 28 import org.chromium.chrome.browser.infobar.InfoBarContainer; |
29 import org.chromium.chrome.browser.profiles.Profile; | 29 import org.chromium.chrome.browser.profiles.Profile; |
30 import org.chromium.chrome.browser.toolbar.ToolbarModel; | 30 import org.chromium.chrome.browser.toolbar.ToolbarModel; |
31 import org.chromium.content.browser.ContentView; | 31 import org.chromium.content.browser.ContentView; |
32 import org.chromium.content.browser.ContentViewClient; | 32 import org.chromium.content.browser.ContentViewClient; |
33 import org.chromium.content.browser.ContentViewCore; | 33 import org.chromium.content.browser.ContentViewCore; |
34 import org.chromium.content.browser.NavigationClient; | |
35 import org.chromium.content.browser.WebContentsObserver; | 34 import org.chromium.content.browser.WebContentsObserver; |
36 import org.chromium.content_public.browser.LoadUrlParams; | 35 import org.chromium.content_public.browser.LoadUrlParams; |
37 import org.chromium.content_public.browser.NavigationHistory; | 36 import org.chromium.content_public.browser.NavigationHistory; |
38 import org.chromium.content_public.browser.WebContents; | 37 import org.chromium.content_public.browser.WebContents; |
39 import org.chromium.ui.base.Clipboard; | 38 import org.chromium.ui.base.Clipboard; |
40 import org.chromium.ui.base.WindowAndroid; | 39 import org.chromium.ui.base.WindowAndroid; |
41 | 40 |
42 import java.util.concurrent.atomic.AtomicInteger; | 41 import java.util.concurrent.atomic.AtomicInteger; |
43 | 42 |
44 /** | 43 /** |
(...skipping 20 matching lines...) Expand all Loading... | |
65 * to the parameter passed to that method. This should be used when doing thin gs like loading | 64 * to the parameter passed to that method. This should be used when doing thin gs like loading |
66 * persisted {@link Tab}s from disk on process start to ensure all new {@link T ab}s don't have id | 65 * persisted {@link Tab}s from disk on process start to ensure all new {@link T ab}s don't have id |
67 * collision. | 66 * collision. |
68 * Some {@link Activity}s will not call this because they do not persist stat e, which means those | 67 * Some {@link Activity}s will not call this because they do not persist stat e, which means those |
69 * ids can potentially conflict with the ones restored from persisted state dep ending on which | 68 * ids can potentially conflict with the ones restored from persisted state dep ending on which |
70 * {@link Activity} runs first on process start. If {@link Tab}s are ever shar ed across | 69 * {@link Activity} runs first on process start. If {@link Tab}s are ever shar ed across |
71 * {@link Activity}s or mixed with {@link Tab}s from other {@link Activity}s co nflicts can occur | 70 * {@link Activity}s or mixed with {@link Tab}s from other {@link Activity}s co nflicts can occur |
72 * unless special care is taken to make sure {@link Tab#incrementIdCounterTo(in t)} is called with | 71 * unless special care is taken to make sure {@link Tab#incrementIdCounterTo(in t)} is called with |
73 * the correct value across all affected {@link Activity}s. | 72 * the correct value across all affected {@link Activity}s. |
74 */ | 73 */ |
75 public class Tab implements NavigationClient { | 74 public class Tab { |
76 public static final int INVALID_TAB_ID = -1; | 75 public static final int INVALID_TAB_ID = -1; |
77 | 76 |
78 /** Used for automatically generating tab ids. */ | 77 /** Used for automatically generating tab ids. */ |
79 private static final AtomicInteger sIdCounter = new AtomicInteger(); | 78 private static final AtomicInteger sIdCounter = new AtomicInteger(); |
80 | 79 |
81 private long mNativeTabAndroid; | 80 private long mNativeTabAndroid; |
82 | 81 |
83 /** Unique id of this tab (within its container). */ | 82 /** Unique id of this tab (within its container). */ |
84 private final int mId; | 83 private final int mId; |
85 | 84 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 if (getWebContents() != null) getWebContents().getNavigationController() .goBack(); | 401 if (getWebContents() != null) getWebContents().getNavigationController() .goBack(); |
403 } | 402 } |
404 | 403 |
405 /** | 404 /** |
406 * Goes to the navigation entry after the current one. | 405 * Goes to the navigation entry after the current one. |
407 */ | 406 */ |
408 public void goForward() { | 407 public void goForward() { |
409 if (getWebContents() != null) getWebContents().getNavigationController() .goForward(); | 408 if (getWebContents() != null) getWebContents().getNavigationController() .goForward(); |
410 } | 409 } |
411 | 410 |
412 @Override | |
413 public NavigationHistory getDirectedNavigationHistory(boolean isForward, int itemLimit) { | 411 public NavigationHistory getDirectedNavigationHistory(boolean isForward, int itemLimit) { |
Ted C
2014/10/23 16:23:27
I would go ahead and remove these two methods. Th
AKVT
2014/10/23 16:39:24
Done.
| |
414 if (getWebContents() != null) { | 412 if (getWebContents() != null) { |
415 return getWebContents().getNavigationController() | 413 return getWebContents().getNavigationController() |
416 .getDirectedNavigationHistory(isForward, itemLimit); | 414 .getDirectedNavigationHistory(isForward, itemLimit); |
417 } else { | 415 } else { |
418 return new NavigationHistory(); | 416 return new NavigationHistory(); |
419 } | 417 } |
420 } | 418 } |
421 | 419 |
422 @Override | |
423 public void goToNavigationIndex(int index) { | 420 public void goToNavigationIndex(int index) { |
424 if (getWebContents() != null) { | 421 if (getWebContents() != null) { |
425 getWebContents().getNavigationController().goToNavigationIndex(index ); | 422 getWebContents().getNavigationController().goToNavigationIndex(index ); |
426 } | 423 } |
427 } | 424 } |
428 | 425 |
429 /** | 426 /** |
430 * Loads the current navigation if there is a pending lazy load (after tab r estore). | 427 * Loads the current navigation if there is a pending lazy load (after tab r estore). |
431 */ | 428 */ |
432 public void loadIfNecessary() { | 429 public void loadIfNecessary() { |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1227 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); | 1224 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); |
1228 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e xtraHeaders, | 1225 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e xtraHeaders, |
1229 byte[] postData, int transition, String referrerUrl, int referrerPol icy, | 1226 byte[] postData, int transition, String referrerUrl, int referrerPol icy, |
1230 boolean isRendererInitiated); | 1227 boolean isRendererInitiated); |
1231 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab Android, String url, | 1228 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab Android, String url, |
1232 String title); | 1229 String title); |
1233 private native boolean nativePrint(long nativeTabAndroid); | 1230 private native boolean nativePrint(long nativeTabAndroid); |
1234 private native Bitmap nativeGetFavicon(long nativeTabAndroid); | 1231 private native Bitmap nativeGetFavicon(long nativeTabAndroid); |
1235 private native boolean nativeIsFaviconValid(long nativeTabAndroid); | 1232 private native boolean nativeIsFaviconValid(long nativeTabAndroid); |
1236 } | 1233 } |
OLD | NEW |