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

Side by Side Diff: chrome/browser/android/download/android_download_manager_duplicate_infobar_delegate.cc

Issue 2478583004: implementation for new duplicate download UI (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/android/download/android_download_manager_duplicate_inf obar_delegate.h"
6
7 #include <memory>
8
9 #include "base/memory/ptr_util.h"
10 #include "chrome/browser/android/download/chrome_download_delegate.h"
11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/ui/android/infobars/duplicate_download_infobar.h"
13 #include "components/infobars/core/infobar.h"
14
15 using base::android::ScopedJavaLocalRef;
16
17 namespace chrome {
18 namespace android {
19
20 AndroidDownloadManagerDuplicateInfoBarDelegate::
21 ~AndroidDownloadManagerDuplicateInfoBarDelegate() {
22 }
23
24 // static
25 void AndroidDownloadManagerDuplicateInfoBarDelegate::Create(
26 InfoBarService* infobar_service,
27 const std::string& file_path,
28 jobject chrome_download_delegate,
29 jobject download_info) {
30 infobar_service->AddInfoBar(DuplicateDownloadInfoBar::CreateInfoBar(
31 base::WrapUnique(new AndroidDownloadManagerDuplicateInfoBarDelegate(
32 file_path, chrome_download_delegate, download_info))));
33 }
34
35 AndroidDownloadManagerDuplicateInfoBarDelegate::
36 AndroidDownloadManagerDuplicateInfoBarDelegate(
37 const std::string& file_path,
38 jobject chrome_download_delegate,
39 jobject download_info)
40 : file_path_(file_path) {
41 JNIEnv* env = base::android::AttachCurrentThread();
42 chrome_download_delegate_.Reset(env, chrome_download_delegate);
43 download_info_.Reset(env, download_info);
44 }
45
46 infobars::InfoBarDelegate::InfoBarIdentifier
47 AndroidDownloadManagerDuplicateInfoBarDelegate::GetIdentifier() const {
48 return ANDROID_DOWNLOAD_MANAGER_DUPLICATE_INFOBAR_DELEGATE;
49 }
50
51 bool AndroidDownloadManagerDuplicateInfoBarDelegate::Download() {
52 bool tab_closed = ChromeDownloadDelegate::EnqueueDownloadManagerRequest(
53 chrome_download_delegate_.obj(), true, download_info_.obj());
54 return !tab_closed;
55 }
56
57 bool AndroidDownloadManagerDuplicateInfoBarDelegate::Cancel() {
58 return true;
59 }
60
61 std::string AndroidDownloadManagerDuplicateInfoBarDelegate::GetFilePath()
62 const {
63 return file_path_;
64 }
65
66 } // namespace android
67 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698