OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.download; | 5 package org.chromium.chrome.browser.download; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.app.PendingIntent; | 8 import android.app.PendingIntent; |
9 import android.content.ActivityNotFoundException; | 9 import android.content.ActivityNotFoundException; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (tab == null && activity instanceof ChromeTabbedActivity) { | 128 if (tab == null && activity instanceof ChromeTabbedActivity) { |
129 tab = ((ChromeTabbedActivity) activity).getActivityTab(); | 129 tab = ((ChromeTabbedActivity) activity).getActivityTab(); |
130 } | 130 } |
131 | 131 |
132 Context appContext = ContextUtils.getApplicationContext(); | 132 Context appContext = ContextUtils.getApplicationContext(); |
133 if (activity instanceof ChromeActivity | 133 if (activity instanceof ChromeActivity |
134 && ((ChromeActivity) activity).getBottomSheet() != null) { | 134 && ((ChromeActivity) activity).getBottomSheet() != null) { |
135 ((ChromeActivity) activity) | 135 ((ChromeActivity) activity) |
136 .getBottomSheetContentController() | 136 .getBottomSheetContentController() |
137 .showContentAndOpenSheet(R.id.action_downloads); | 137 .showContentAndOpenSheet(R.id.action_downloads); |
138 } else if (DeviceFormFactor.isTablet(appContext)) { | 138 } else if (DeviceFormFactor.isTablet()) { |
139 // Download Home shows up as a tab on tablets. | 139 // Download Home shows up as a tab on tablets. |
140 LoadUrlParams params = new LoadUrlParams(UrlConstants.DOWNLOADS_URL)
; | 140 LoadUrlParams params = new LoadUrlParams(UrlConstants.DOWNLOADS_URL)
; |
141 if (tab == null || !tab.isInitialized()) { | 141 if (tab == null || !tab.isInitialized()) { |
142 // Open a new tab, which pops Chrome into the foreground. | 142 // Open a new tab, which pops Chrome into the foreground. |
143 TabDelegate delegate = new TabDelegate(false); | 143 TabDelegate delegate = new TabDelegate(false); |
144 delegate.createNewTab(params, TabLaunchType.FROM_CHROME_UI, null
); | 144 delegate.createNewTab(params, TabLaunchType.FROM_CHROME_UI, null
); |
145 } else { | 145 } else { |
146 // Download Home shows up inside an existing tab, but only if th
e last Activity was | 146 // Download Home shows up inside an existing tab, but only if th
e last Activity was |
147 // the ChromeTabbedActivity. | 147 // the ChromeTabbedActivity. |
148 tab.loadUrl(params); | 148 tab.loadUrl(params); |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 public static Date getDateAtMidnight(long timestamp) { | 880 public static Date getDateAtMidnight(long timestamp) { |
881 Calendar cal = Calendar.getInstance(); | 881 Calendar cal = Calendar.getInstance(); |
882 cal.setTimeInMillis(timestamp); | 882 cal.setTimeInMillis(timestamp); |
883 cal.set(Calendar.HOUR_OF_DAY, 0); | 883 cal.set(Calendar.HOUR_OF_DAY, 0); |
884 cal.set(Calendar.MINUTE, 0); | 884 cal.set(Calendar.MINUTE, 0); |
885 cal.set(Calendar.SECOND, 0); | 885 cal.set(Calendar.SECOND, 0); |
886 cal.set(Calendar.MILLISECOND, 0); | 886 cal.set(Calendar.MILLISECOND, 0); |
887 return cal.getTime(); | 887 return cal.getTime(); |
888 } | 888 } |
889 } | 889 } |
OLD | NEW |