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.ntp; | 5 package org.chromium.chrome.browser.ntp; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.net.Uri; | 8 import android.net.Uri; |
9 | 9 |
10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
11 import org.chromium.chrome.browser.ChromeActivity; | 11 import org.chromium.chrome.browser.ChromeActivity; |
12 import org.chromium.chrome.browser.ChromeFeatureList; | 12 import org.chromium.chrome.browser.ChromeFeatureList; |
13 import org.chromium.chrome.browser.ChromeTabbedActivity; | 13 import org.chromium.chrome.browser.ChromeTabbedActivity; |
14 import org.chromium.chrome.browser.NativePage; | 14 import org.chromium.chrome.browser.NativePage; |
15 import org.chromium.chrome.browser.NativePageHost; | 15 import org.chromium.chrome.browser.NativePageHost; |
16 import org.chromium.chrome.browser.TabLoadStatus; | 16 import org.chromium.chrome.browser.TabLoadStatus; |
17 import org.chromium.chrome.browser.UrlConstants; | 17 import org.chromium.chrome.browser.UrlConstants; |
18 import org.chromium.chrome.browser.bookmarks.BookmarkPage; | 18 import org.chromium.chrome.browser.bookmarks.BookmarkPage; |
19 import org.chromium.chrome.browser.download.DownloadPage; | 19 import org.chromium.chrome.browser.download.DownloadPage; |
20 import org.chromium.chrome.browser.history.HistoryManagerUtils; | |
21 import org.chromium.chrome.browser.history.HistoryPage; | 20 import org.chromium.chrome.browser.history.HistoryPage; |
22 import org.chromium.chrome.browser.physicalweb.PhysicalWebDiagnosticsPage; | 21 import org.chromium.chrome.browser.physicalweb.PhysicalWebDiagnosticsPage; |
23 import org.chromium.chrome.browser.tab.Tab; | 22 import org.chromium.chrome.browser.tab.Tab; |
24 import org.chromium.chrome.browser.tabmodel.TabModel; | 23 import org.chromium.chrome.browser.tabmodel.TabModel; |
25 import org.chromium.chrome.browser.tabmodel.TabModelSelector; | 24 import org.chromium.chrome.browser.tabmodel.TabModelSelector; |
26 import org.chromium.chrome.browser.util.FeatureUtilities; | 25 import org.chromium.chrome.browser.util.FeatureUtilities; |
27 import org.chromium.content_public.browser.LoadUrlParams; | 26 import org.chromium.content_public.browser.LoadUrlParams; |
28 | 27 |
29 /** | 28 /** |
30 * Creates NativePage objects to show chrome-native:// URLs using the native And
roid view system. | 29 * Creates NativePage objects to show chrome-native:// URLs using the native And
roid view system. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 return NativePageType.CANDIDATE; | 91 return NativePageType.CANDIDATE; |
93 } | 92 } |
94 | 93 |
95 if (UrlConstants.NTP_HOST.equals(host)) { | 94 if (UrlConstants.NTP_HOST.equals(host)) { |
96 return NativePageType.NTP; | 95 return NativePageType.NTP; |
97 } else if (UrlConstants.BOOKMARKS_HOST.equals(host)) { | 96 } else if (UrlConstants.BOOKMARKS_HOST.equals(host)) { |
98 return NativePageType.BOOKMARKS; | 97 return NativePageType.BOOKMARKS; |
99 } else if (UrlConstants.DOWNLOADS_HOST.equals(host)) { | 98 } else if (UrlConstants.DOWNLOADS_HOST.equals(host)) { |
100 return NativePageType.DOWNLOADS; | 99 return NativePageType.DOWNLOADS; |
101 } else if (UrlConstants.HISTORY_HOST.equals(host)) { | 100 } else if (UrlConstants.HISTORY_HOST.equals(host)) { |
102 if (HistoryManagerUtils.isAndroidHistoryManagerEnabled()) { | 101 return NativePageType.HISTORY; |
103 return NativePageType.HISTORY; | |
104 } else { | |
105 return NativePageType.NONE; | |
106 } | |
107 } else if (UrlConstants.RECENT_TABS_HOST.equals(host) && !isIncognito) { | 102 } else if (UrlConstants.RECENT_TABS_HOST.equals(host) && !isIncognito) { |
108 return NativePageType.RECENT_TABS; | 103 return NativePageType.RECENT_TABS; |
109 } else if (UrlConstants.PHYSICAL_WEB_DIAGNOSTICS_HOST.equals(host)) { | 104 } else if (UrlConstants.PHYSICAL_WEB_DIAGNOSTICS_HOST.equals(host)) { |
110 if (ChromeFeatureList.isEnabled("PhysicalWeb")) { | 105 if (ChromeFeatureList.isEnabled("PhysicalWeb")) { |
111 return NativePageType.PHYSICAL_WEB; | 106 return NativePageType.PHYSICAL_WEB; |
112 } else { | 107 } else { |
113 return NativePageType.NONE; | 108 return NativePageType.NONE; |
114 } | 109 } |
115 } else { | 110 } else { |
116 return NativePageType.NONE; | 111 return NativePageType.NONE; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 public Tab getActiveTab() { | 219 public Tab getActiveTab() { |
225 return mTab; | 220 return mTab; |
226 } | 221 } |
227 | 222 |
228 @Override | 223 @Override |
229 public boolean isVisible() { | 224 public boolean isVisible() { |
230 return mTab == mTab.getTabModelSelector().getCurrentTab(); | 225 return mTab == mTab.getTabModelSelector().getCurrentTab(); |
231 } | 226 } |
232 } | 227 } |
233 } | 228 } |
OLD | NEW |