| 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/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 - (void)applicationDidBecomeActive:(NSNotification*)notify { | 620 - (void)applicationDidBecomeActive:(NSNotification*)notify { |
| 621 content::NotificationService::current()->Notify( | 621 content::NotificationService::current()->Notify( |
| 622 content::NOTIFICATION_APP_ACTIVATED, | 622 content::NOTIFICATION_APP_ACTIVATED, |
| 623 content::NotificationService::AllSources(), | 623 content::NotificationService::AllSources(), |
| 624 content::NotificationService::NoDetails()); | 624 content::NotificationService::NoDetails()); |
| 625 } | 625 } |
| 626 | 626 |
| 627 // Helper function for populating and displaying the in progress downloads at | 627 // Helper function for populating and displaying the in progress downloads at |
| 628 // exit alert panel. | 628 // exit alert panel. |
| 629 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount { | 629 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount { |
| 630 NSString* warningText = nil; | 630 NSString* titleText = nil; |
| 631 NSString* explanationText = nil; | 631 NSString* explanationText = nil; |
| 632 NSString* waitTitle = nil; | 632 NSString* waitTitle = nil; |
| 633 NSString* exitTitle = nil; | 633 NSString* exitTitle = nil; |
| 634 | 634 |
| 635 // Set the dialog text based on whether or not there are multiple downloads. | 635 // Set the dialog text based on whether or not there are multiple downloads. |
| 636 if (downloadCount == 1) { | 636 if (downloadCount == 1) { |
| 637 // Dialog text: warning and explanation. | 637 // Dialog text: warning and explanation. |
| 638 warningText = l10n_util::GetNSString( | 638 titleText = l10n_util::GetNSString( |
| 639 IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING); | 639 IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_TITLE); |
| 640 explanationText = l10n_util::GetNSString( | 640 explanationText = l10n_util::GetNSString( |
| 641 IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION); | 641 IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION); |
| 642 | |
| 643 // Cancel download and exit button text. | |
| 644 exitTitle = l10n_util::GetNSString( | |
| 645 IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL); | |
| 646 | |
| 647 // Wait for download button text. | |
| 648 waitTitle = l10n_util::GetNSString( | |
| 649 IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL); | |
| 650 } else { | 642 } else { |
| 651 // Dialog text: warning and explanation. | 643 // Dialog text: warning and explanation. |
| 652 warningText = l10n_util::GetNSStringF( | 644 titleText = l10n_util::GetNSStringF( |
| 653 IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING, | 645 IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_TITLE, |
| 654 base::IntToString16(downloadCount)); | 646 base::IntToString16(downloadCount)); |
| 655 explanationText = l10n_util::GetNSString( | 647 explanationText = l10n_util::GetNSString( |
| 656 IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION); | 648 IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION); |
| 649 } |
| 650 // Cancel download and exit button text. |
| 651 exitTitle = l10n_util::GetNSString( |
| 652 IDS_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL); |
| 657 | 653 |
| 658 // Cancel downloads and exit button text. | 654 // Wait for download button text. |
| 659 exitTitle = l10n_util::GetNSString( | 655 waitTitle = l10n_util::GetNSString( |
| 660 IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL); | 656 IDS_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL); |
| 661 | |
| 662 // Wait for downloads button text. | |
| 663 waitTitle = l10n_util::GetNSString( | |
| 664 IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL); | |
| 665 } | |
| 666 | 657 |
| 667 // 'waitButton' is the default choice. | 658 // 'waitButton' is the default choice. |
| 668 int choice = NSRunAlertPanel(warningText, explanationText, | 659 int choice = NSRunAlertPanel(titleText, explanationText, |
| 669 waitTitle, exitTitle, nil); | 660 waitTitle, exitTitle, nil); |
| 670 return choice == NSAlertDefaultReturn ? YES : NO; | 661 return choice == NSAlertDefaultReturn ? YES : NO; |
| 671 } | 662 } |
| 672 | 663 |
| 673 // Check all profiles for in progress downloads, and if we find any, prompt the | 664 // Check all profiles for in progress downloads, and if we find any, prompt the |
| 674 // user to see if we should continue to exit (and thus cancel the downloads), or | 665 // user to see if we should continue to exit (and thus cancel the downloads), or |
| 675 // if we should wait. | 666 // if we should wait. |
| 676 - (BOOL)shouldQuitWithInProgressDownloads { | 667 - (BOOL)shouldQuitWithInProgressDownloads { |
| 677 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 668 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 678 if (!profile_manager) | 669 if (!profile_manager) |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 | 1314 |
| 1324 } // namespace browser | 1315 } // namespace browser |
| 1325 | 1316 |
| 1326 namespace app_controller_mac { | 1317 namespace app_controller_mac { |
| 1327 | 1318 |
| 1328 bool IsOpeningNewWindow() { | 1319 bool IsOpeningNewWindow() { |
| 1329 return g_is_opening_new_window; | 1320 return g_is_opening_new_window; |
| 1330 } | 1321 } |
| 1331 | 1322 |
| 1332 } // namespace app_controller_mac | 1323 } // namespace app_controller_mac |
| OLD | NEW |