| 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 25 matching lines...) Expand all Loading... |
| 36 super(activity, host); | 36 super(activity, host); |
| 37 } | 37 } |
| 38 | 38 |
| 39 @Override | 39 @Override |
| 40 protected void initialize(Activity activity, final NativePageHost host) { | 40 protected void initialize(Activity activity, final NativePageHost host) { |
| 41 ThreadUtils.assertOnUiThread(); | 41 ThreadUtils.assertOnUiThread(); |
| 42 | 42 |
| 43 mManager = new DownloadManagerUi(activity, host.isIncognito(), activity.
getComponentName(), | 43 mManager = new DownloadManagerUi(activity, host.isIncognito(), activity.
getComponentName(), |
| 44 false, ((SnackbarManageable) activity).getSnackbarManager()); | 44 false, ((SnackbarManageable) activity).getSnackbarManager()); |
| 45 mManager.setBasicNativePage(this); | 45 mManager.setBasicNativePage(this); |
| 46 mTitle = activity.getString(R.string.download_manager_ui_all_downloads); | 46 mTitle = activity.getString(R.string.menu_downloads); |
| 47 | 47 |
| 48 // #destroy() unregisters the ActivityStateListener to avoid checking fo
r externally removed | 48 // #destroy() unregisters the ActivityStateListener to avoid checking fo
r externally removed |
| 49 // downloads after the downloads page is closed. This requires each Down
loadPage to have its | 49 // downloads after the downloads page is closed. This requires each Down
loadPage to have its |
| 50 // own ActivityStateListener. If multiple tabs are showing the downloads
page, multiple | 50 // own ActivityStateListener. If multiple tabs are showing the downloads
page, multiple |
| 51 // requests to check for externally removed downloads will be issued whe
n the activity is | 51 // requests to check for externally removed downloads will be issued whe
n the activity is |
| 52 // resumed. | 52 // resumed. |
| 53 mActivityStateListener = new ActivityStateListener() { | 53 mActivityStateListener = new ActivityStateListener() { |
| 54 @Override | 54 @Override |
| 55 public void onActivityStateChange(Activity activity, int newState) { | 55 public void onActivityStateChange(Activity activity, int newState) { |
| 56 if (newState == ActivityState.RESUMED) { | 56 if (newState == ActivityState.RESUMED) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 84 } | 84 } |
| 85 | 85 |
| 86 @Override | 86 @Override |
| 87 public void destroy() { | 87 public void destroy() { |
| 88 mManager.onDestroyed(); | 88 mManager.onDestroyed(); |
| 89 mManager = null; | 89 mManager = null; |
| 90 ApplicationStatus.unregisterActivityStateListener(mActivityStateListener
); | 90 ApplicationStatus.unregisterActivityStateListener(mActivityStateListener
); |
| 91 super.destroy(); | 91 super.destroy(); |
| 92 } | 92 } |
| 93 } | 93 } |
| OLD | NEW |