| 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.download; | 5 package org.chromium.chrome.browser.download; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.NotificationManager; | 8 import android.app.NotificationManager; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 @Override | 43 @Override |
| 44 public void onAction(Object actionData) { | 44 public void onAction(Object actionData) { |
| 45 if (!(actionData instanceof ActionDataInfo)) { | 45 if (!(actionData instanceof ActionDataInfo)) { |
| 46 DownloadManagerService.openDownloadsPage(mContext); | 46 DownloadManagerService.openDownloadsPage(mContext); |
| 47 return; | 47 return; |
| 48 } | 48 } |
| 49 final ActionDataInfo download = (ActionDataInfo) actionData; | 49 final ActionDataInfo download = (ActionDataInfo) actionData; |
| 50 if (download.downloadInfo.isOfflinePage()) { | 50 if (download.downloadInfo.isOfflinePage()) { |
| 51 OfflinePageDownloadBridge.openDownloadedPage(download.downloadInfo.g
etDownloadGuid()); | 51 OfflinePageDownloadBridge.openDownloadedPage(download.downloadInfo.g
etContentId()); |
| 52 return; | 52 return; |
| 53 } | 53 } |
| 54 DownloadManagerService manager = DownloadManagerService.getDownloadManag
erService(mContext); | 54 DownloadManagerService manager = DownloadManagerService.getDownloadManag
erService(mContext); |
| 55 manager.openDownloadedContent(download.downloadInfo, download.systemDown
loadId); | 55 manager.openDownloadedContent(download.downloadInfo, download.systemDown
loadId); |
| 56 if (download.notificationId != INVALID_NOTIFICATION_ID) { | 56 if (download.notificationId != INVALID_NOTIFICATION_ID) { |
| 57 NotificationManager notificationManager = | 57 NotificationManager notificationManager = |
| 58 (NotificationManager) mContext.getSystemService(Context.NOTI
FICATION_SERVICE); | 58 (NotificationManager) mContext.getSystemService(Context.NOTI
FICATION_SERVICE); |
| 59 notificationManager.cancel( | 59 notificationManager.cancel( |
| 60 DownloadNotificationService.NOTIFICATION_NAMESPACE, download
.notificationId); | 60 DownloadNotificationService.NOTIFICATION_NAMESPACE, download
.notificationId); |
| 61 } | 61 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 | 131 |
| 132 public SnackbarManager getSnackbarManager() { | 132 public SnackbarManager getSnackbarManager() { |
| 133 Activity activity = getActivity(); | 133 Activity activity = getActivity(); |
| 134 if (activity != null && activity instanceof SnackbarManager.SnackbarMana
geable) { | 134 if (activity != null && activity instanceof SnackbarManager.SnackbarMana
geable) { |
| 135 return ((SnackbarManager.SnackbarManageable) activity).getSnackbarMa
nager(); | 135 return ((SnackbarManager.SnackbarManageable) activity).getSnackbarMa
nager(); |
| 136 } | 136 } |
| 137 return null; | 137 return null; |
| 138 } | 138 } |
| 139 } | 139 } |
| OLD | NEW |