OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/gtk/download/download_in_progress_dialog_gtk.h" | 5 #include "chrome/browser/ui/gtk/download/download_in_progress_dialog_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "chrome/browser/download/download_service.h" |
| 12 #include "chrome/browser/download/download_service_factory.h" |
11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/browser/ui/gtk/gtk_util.h" | 16 #include "chrome/browser/ui/gtk/gtk_util.h" |
15 #include "content/browser/download/download_manager.h" | 17 #include "content/browser/download/download_manager.h" |
16 #include "grit/chromium_strings.h" | 18 #include "grit/chromium_strings.h" |
17 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
18 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
19 | 21 |
20 DownloadInProgressDialogGtk::DownloadInProgressDialogGtk(Browser* browser) | 22 DownloadInProgressDialogGtk::DownloadInProgressDialogGtk(Browser* browser) |
21 : browser_(browser) { | 23 : browser_(browser) { |
22 int download_count = browser->profile()->GetDownloadManager()-> | 24 int download_count = |
23 in_progress_count(); | 25 DownloadServiceFactory::GetForProfile( |
| 26 browser->profile())->GetDownloadManager()->in_progress_count(); |
24 | 27 |
25 std::string warning_text; | 28 std::string warning_text; |
26 std::string explanation_text; | 29 std::string explanation_text; |
27 std::string ok_button_text; | 30 std::string ok_button_text; |
28 std::string cancel_button_text; | 31 std::string cancel_button_text; |
29 string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 32 string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
30 if (download_count == 1) { | 33 if (download_count == 1) { |
31 warning_text = | 34 warning_text = |
32 l10n_util::GetStringFUTF8(IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING, | 35 l10n_util::GetStringFUTF8(IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING, |
33 product_name); | 36 product_name); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 78 |
76 gtk_widget_show_all(dialog); | 79 gtk_widget_show_all(dialog); |
77 } | 80 } |
78 | 81 |
79 void DownloadInProgressDialogGtk::OnResponse(GtkWidget* dialog, | 82 void DownloadInProgressDialogGtk::OnResponse(GtkWidget* dialog, |
80 int response_id) { | 83 int response_id) { |
81 gtk_widget_destroy(dialog); | 84 gtk_widget_destroy(dialog); |
82 browser_->InProgressDownloadResponse(response_id == GTK_RESPONSE_ACCEPT); | 85 browser_->InProgressDownloadResponse(response_id == GTK_RESPONSE_ACCEPT); |
83 delete this; | 86 delete this; |
84 } | 87 } |
OLD | NEW |