| 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.view.View; | 8 import android.view.View; |
| 9 | 9 |
| 10 import org.chromium.base.ActivityState; | 10 import org.chromium.base.ActivityState; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 * @param host A NativePageHost to load urls. | 32 * @param host A NativePageHost to load urls. |
| 33 */ | 33 */ |
| 34 public DownloadPage(Activity activity, NativePageHost host) { | 34 public DownloadPage(Activity activity, NativePageHost host) { |
| 35 super(activity, host); | 35 super(activity, host); |
| 36 } | 36 } |
| 37 | 37 |
| 38 @Override | 38 @Override |
| 39 protected void initialize(Activity activity, final NativePageHost host) { | 39 protected void initialize(Activity activity, final NativePageHost host) { |
| 40 ThreadUtils.assertOnUiThread(); | 40 ThreadUtils.assertOnUiThread(); |
| 41 | 41 |
| 42 mManager = new DownloadManagerUi(activity, host.isIncognito(), activity.
getComponentName()); | 42 mManager = new DownloadManagerUi( |
| 43 activity, host.isIncognito(), activity.getComponentName(), false
); |
| 43 mManager.setBasicNativePage(this); | 44 mManager.setBasicNativePage(this); |
| 44 mTitle = activity.getString(R.string.download_manager_ui_all_downloads); | 45 mTitle = activity.getString(R.string.download_manager_ui_all_downloads); |
| 45 | 46 |
| 46 // #destroy() unregisters the ActivityStateListener to avoid checking fo
r externally removed | 47 // #destroy() unregisters the ActivityStateListener to avoid checking fo
r externally removed |
| 47 // downloads after the downloads page is closed. This requires each Down
loadPage to have its | 48 // downloads after the downloads page is closed. This requires each Down
loadPage to have its |
| 48 // own ActivityStateListener. If multiple tabs are showing the downloads
page, multiple | 49 // own ActivityStateListener. If multiple tabs are showing the downloads
page, multiple |
| 49 // requests to check for externally removed downloads will be issued whe
n the activity is | 50 // requests to check for externally removed downloads will be issued whe
n the activity is |
| 50 // resumed. | 51 // resumed. |
| 51 mActivityStateListener = new ActivityStateListener() { | 52 mActivityStateListener = new ActivityStateListener() { |
| 52 @Override | 53 @Override |
| (...skipping 29 matching lines...) Expand all Loading... |
| 82 } | 83 } |
| 83 | 84 |
| 84 @Override | 85 @Override |
| 85 public void destroy() { | 86 public void destroy() { |
| 86 mManager.onDestroyed(); | 87 mManager.onDestroyed(); |
| 87 mManager = null; | 88 mManager = null; |
| 88 ApplicationStatus.unregisterActivityStateListener(mActivityStateListener
); | 89 ApplicationStatus.unregisterActivityStateListener(mActivityStateListener
); |
| 89 super.destroy(); | 90 super.destroy(); |
| 90 } | 91 } |
| 91 } | 92 } |
| OLD | NEW |