Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java

Issue 2679933005: Make all member variables in DownloadNotificationService final (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/download/DownloadSharedPreferenceEntry.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.ActivityManager; 7 import android.app.ActivityManager;
8 import android.app.DownloadManager; 8 import android.app.DownloadManager;
9 import android.app.Notification; 9 import android.app.Notification;
10 import android.app.NotificationManager; 10 import android.app.NotificationManager;
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 } 635 }
636 636
637 if (ACTION_DOWNLOAD_PAUSE.equals(intent.getAction())) { 637 if (ACTION_DOWNLOAD_PAUSE.equals(intent.getAction())) {
638 // If browser process already goes away, the download should have al ready paused. Do 638 // If browser process already goes away, the download should have al ready paused. Do
639 // nothing in that case. 639 // nothing in that case.
640 if (!DownloadManagerService.hasDownloadManagerService()) { 640 if (!DownloadManagerService.hasDownloadManagerService()) {
641 notifyDownloadPaused(entry.downloadGuid, !entry.isOffTheRecord, false); 641 notifyDownloadPaused(entry.downloadGuid, !entry.isOffTheRecord, false);
642 return; 642 return;
643 } 643 }
644 } else if (ACTION_DOWNLOAD_RESUME.equals(intent.getAction())) { 644 } else if (ACTION_DOWNLOAD_RESUME.equals(intent.getAction())) {
645 boolean metered = DownloadManagerService.isActiveNetworkMetered(mCon text); 645 // If user manually resumes a download, update the network type if i t
646 if (!entry.canDownloadWhileMetered) { 646 // is not metered previously.
647 // If user manually resumes a download, update the network type if it 647 boolean canDownloadWhileMetered = entry.canDownloadWhileMetered
648 // is not metered previously. 648 || DownloadManagerService.isActiveNetworkMetered(mContext);
649 entry.canDownloadWhileMetered = metered;
650 }
651 entry.isAutoResumable = true;
652 // Update the SharedPreference entry. 649 // Update the SharedPreference entry.
653 mDownloadSharedPreferenceHelper.addOrReplaceSharedPreferenceEntry(en try); 650 mDownloadSharedPreferenceHelper.addOrReplaceSharedPreferenceEntry(
651 new DownloadSharedPreferenceEntry(entry.notificationId, entr y.isOffTheRecord,
652 canDownloadWhileMetered, entry.downloadGuid, entry.f ileName,
653 entry.itemType, true));
654 } else if (ACTION_DOWNLOAD_RESUME_ALL.equals(intent.getAction()) 654 } else if (ACTION_DOWNLOAD_RESUME_ALL.equals(intent.getAction())
655 && (mDownloadSharedPreferenceHelper.getEntries().isEmpty() 655 && (mDownloadSharedPreferenceHelper.getEntries().isEmpty()
656 || DownloadManagerService.hasDownloadManagerService())) { 656 || DownloadManagerService.hasDownloadManagerService())) {
657 return; 657 return;
658 } else if (ACTION_DOWNLOAD_OPEN.equals(intent.getAction())) { 658 } else if (ACTION_DOWNLOAD_OPEN.equals(intent.getAction())) {
659 // TODO(fgorski): Do we even need to do anything special here, befor e we launch Chrome? 659 // TODO(fgorski): Do we even need to do anything special here, befor e we launch Chrome?
660 } 660 }
661 661
662 BrowserParts parts = new EmptyBrowserParts() { 662 BrowserParts parts = new EmptyBrowserParts() {
663 @Override 663 @Override
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 return context.getString(R.string.remaining_duration_minutes, minute s); 877 return context.getString(R.string.remaining_duration_minutes, minute s);
878 } else if (minutes > 0) { 878 } else if (minutes > 0) {
879 return context.getString(R.string.remaining_duration_one_minute); 879 return context.getString(R.string.remaining_duration_one_minute);
880 } else if (seconds == 1) { 880 } else if (seconds == 1) {
881 return context.getString(R.string.remaining_duration_one_second); 881 return context.getString(R.string.remaining_duration_one_second);
882 } else { 882 } else {
883 return context.getString(R.string.remaining_duration_seconds, second s); 883 return context.getString(R.string.remaining_duration_seconds, second s);
884 } 884 }
885 } 885 }
886 } 886 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/download/DownloadSharedPreferenceEntry.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698