OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import "chrome/browser/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 | 800 |
801 // Helper function for populating and displaying the in progress downloads at | 801 // Helper function for populating and displaying the in progress downloads at |
802 // exit alert panel. | 802 // exit alert panel. |
803 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount { | 803 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount { |
804 NSString* titleText = nil; | 804 NSString* titleText = nil; |
805 NSString* explanationText = nil; | 805 NSString* explanationText = nil; |
806 NSString* waitTitle = nil; | 806 NSString* waitTitle = nil; |
807 NSString* exitTitle = nil; | 807 NSString* exitTitle = nil; |
808 | 808 |
809 // Set the dialog text based on whether or not there are multiple downloads. | 809 // Set the dialog text based on whether or not there are multiple downloads. |
810 if (downloadCount == 1) { | 810 // Dialog text: warning and explanation. |
811 // Dialog text: warning and explanation. | 811 titleText = l10n_util::GetPluralNSStringF( |
812 titleText = l10n_util::GetNSString( | 812 IDS_DOWNLOAD_REMOVE_CONFIRM_TITLE, downloadCount); |
813 IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_TITLE); | 813 explanationText = l10n_util::GetPluralNSStringF( |
814 explanationText = l10n_util::GetNSString( | 814 IDS_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION, downloadCount); |
815 IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION); | |
816 } else { | |
817 // Dialog text: warning and explanation. | |
818 titleText = l10n_util::GetNSString( | |
819 IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_TITLE); | |
820 explanationText = l10n_util::GetNSString( | |
821 IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION); | |
822 } | |
823 // Cancel download and exit button text. | 815 // Cancel download and exit button text. |
824 exitTitle = l10n_util::GetNSString( | 816 exitTitle = l10n_util::GetPluralNSStringF( |
825 IDS_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL); | 817 IDS_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL, downloadCount); |
826 | 818 |
827 // Wait for download button text. | 819 // Wait for download button text. |
828 waitTitle = l10n_util::GetNSString( | 820 waitTitle = l10n_util::GetPluralNSStringF( |
829 IDS_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL); | 821 IDS_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL, downloadCount); |
830 | 822 |
831 // 'waitButton' is the default choice. | 823 // 'waitButton' is the default choice. |
832 int choice = NSRunAlertPanel(titleText, @"%@", | 824 int choice = NSRunAlertPanel(titleText, @"%@", |
833 waitTitle, exitTitle, nil, explanationText); | 825 waitTitle, exitTitle, nil, explanationText); |
834 return choice == NSAlertDefaultReturn ? YES : NO; | 826 return choice == NSAlertDefaultReturn ? YES : NO; |
835 } | 827 } |
836 | 828 |
837 // Check all profiles for in progress downloads, and if we find any, prompt the | 829 // Check all profiles for in progress downloads, and if we find any, prompt the |
838 // user to see if we should continue to exit (and thus cancel the downloads), or | 830 // user to see if we should continue to exit (and thus cancel the downloads), or |
839 // if we should wait. | 831 // if we should wait. |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 | 1704 |
1713 //--------------------------------------------------------------------------- | 1705 //--------------------------------------------------------------------------- |
1714 | 1706 |
1715 namespace app_controller_mac { | 1707 namespace app_controller_mac { |
1716 | 1708 |
1717 bool IsOpeningNewWindow() { | 1709 bool IsOpeningNewWindow() { |
1718 return g_is_opening_new_window; | 1710 return g_is_opening_new_window; |
1719 } | 1711 } |
1720 | 1712 |
1721 } // namespace app_controller_mac | 1713 } // namespace app_controller_mac |
OLD | NEW |