| 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(browser->profile())-> |
| 26 GetDownloadManager()-> |
| 27 in_progress_count(); |
| 24 | 28 |
| 25 std::string warning_text; | 29 std::string warning_text; |
| 26 std::string explanation_text; | 30 std::string explanation_text; |
| 27 std::string ok_button_text; | 31 std::string ok_button_text; |
| 28 std::string cancel_button_text; | 32 std::string cancel_button_text; |
| 29 string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 33 string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
| 30 if (download_count == 1) { | 34 if (download_count == 1) { |
| 31 warning_text = | 35 warning_text = |
| 32 l10n_util::GetStringFUTF8(IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING, | 36 l10n_util::GetStringFUTF8(IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING, |
| 33 product_name); | 37 product_name); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 79 |
| 76 gtk_widget_show_all(dialog); | 80 gtk_widget_show_all(dialog); |
| 77 } | 81 } |
| 78 | 82 |
| 79 void DownloadInProgressDialogGtk::OnResponse(GtkWidget* dialog, | 83 void DownloadInProgressDialogGtk::OnResponse(GtkWidget* dialog, |
| 80 int response_id) { | 84 int response_id) { |
| 81 gtk_widget_destroy(dialog); | 85 gtk_widget_destroy(dialog); |
| 82 browser_->InProgressDownloadResponse(response_id == GTK_RESPONSE_ACCEPT); | 86 browser_->InProgressDownloadResponse(response_id == GTK_RESPONSE_ACCEPT); |
| 83 delete this; | 87 delete this; |
| 84 } | 88 } |
| OLD | NEW |