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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/bookmarks/bookmark_utils.h" | 32 #include "chrome/browser/bookmarks/bookmark_utils.h" |
33 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
34 #include "chrome/browser/browser_shutdown.h" | 34 #include "chrome/browser/browser_shutdown.h" |
35 #include "chrome/browser/character_encoding.h" | 35 #include "chrome/browser/character_encoding.h" |
36 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 36 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
37 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" | 37 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" |
38 #include "chrome/browser/debugger/devtools_toggle_action.h" | 38 #include "chrome/browser/debugger/devtools_toggle_action.h" |
39 #include "chrome/browser/debugger/devtools_window.h" | 39 #include "chrome/browser/debugger/devtools_window.h" |
40 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 40 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
41 #include "chrome/browser/download/download_item_model.h" | 41 #include "chrome/browser/download/download_item_model.h" |
| 42 #include "chrome/browser/download/download_service.h" |
| 43 #include "chrome/browser/download/download_service_factory.h" |
42 #include "chrome/browser/download/download_started_animation.h" | 44 #include "chrome/browser/download/download_started_animation.h" |
43 #include "chrome/browser/extensions/crx_installer.h" | 45 #include "chrome/browser/extensions/crx_installer.h" |
44 #include "chrome/browser/extensions/extension_browser_event_router.h" | 46 #include "chrome/browser/extensions/extension_browser_event_router.h" |
45 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" | 47 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" |
46 #include "chrome/browser/extensions/extension_host.h" | 48 #include "chrome/browser/extensions/extension_host.h" |
47 #include "chrome/browser/extensions/extension_prefs.h" | 49 #include "chrome/browser/extensions/extension_prefs.h" |
48 #include "chrome/browser/extensions/extension_service.h" | 50 #include "chrome/browser/extensions/extension_service.h" |
49 #include "chrome/browser/extensions/extension_tab_helper.h" | 51 #include "chrome/browser/extensions/extension_tab_helper.h" |
50 #include "chrome/browser/extensions/extension_tabs_module.h" | 52 #include "chrome/browser/extensions/extension_tabs_module.h" |
51 #include "chrome/browser/favicon/favicon_tab_helper.h" | 53 #include "chrome/browser/favicon/favicon_tab_helper.h" |
(...skipping 4824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4876 /////////////////////////////////////////////////////////////////////////////// | 4878 /////////////////////////////////////////////////////////////////////////////// |
4877 // Browser, In-progress download termination handling (private): | 4879 // Browser, In-progress download termination handling (private): |
4878 | 4880 |
4879 void Browser::CheckDownloadsInProgress(bool* normal_downloads_are_present, | 4881 void Browser::CheckDownloadsInProgress(bool* normal_downloads_are_present, |
4880 bool* incognito_downloads_are_present) { | 4882 bool* incognito_downloads_are_present) { |
4881 *normal_downloads_are_present = false; | 4883 *normal_downloads_are_present = false; |
4882 *incognito_downloads_are_present = false; | 4884 *incognito_downloads_are_present = false; |
4883 | 4885 |
4884 // If there are no download in-progress, our job is done. | 4886 // If there are no download in-progress, our job is done. |
4885 DownloadManager* download_manager = NULL; | 4887 DownloadManager* download_manager = NULL; |
| 4888 DownloadService* download_service = |
| 4889 DownloadServiceFactory::GetForProfile(profile()); |
4886 // But first we need to check for the existence of the download manager, as | 4890 // But first we need to check for the existence of the download manager, as |
4887 // GetDownloadManager() will unnecessarily try to create one if it does not | 4891 // GetDownloadManager() will unnecessarily try to create one if it does not |
4888 // exist. | 4892 // exist. |
4889 if (profile()->HasCreatedDownloadManager()) | 4893 if (download_service->HasCreatedDownloadManager()) |
4890 download_manager = profile()->GetDownloadManager(); | 4894 download_manager = download_service->GetDownloadManager(); |
4891 if (profile()->IsOffTheRecord()) { | 4895 if (profile()->IsOffTheRecord()) { |
4892 // Browser is incognito and so download_manager if present is for incognito | 4896 // Browser is incognito and so download_manager if present is for incognito |
4893 // downloads. | 4897 // downloads. |
4894 *incognito_downloads_are_present = | 4898 *incognito_downloads_are_present = |
4895 (download_manager && download_manager->in_progress_count() != 0); | 4899 (download_manager && download_manager->in_progress_count() != 0); |
4896 // Check original profile. | 4900 // Check original profile. |
4897 if (profile()->GetOriginalProfile()->HasCreatedDownloadManager()) | 4901 DownloadService* download_service = DownloadServiceFactory::GetForProfile( |
4898 download_manager = profile()->GetOriginalProfile()->GetDownloadManager(); | 4902 profile()->GetOriginalProfile()); |
| 4903 if (download_service->HasCreatedDownloadManager()) |
| 4904 download_manager = download_service->GetDownloadManager(); |
4899 } | 4905 } |
4900 | 4906 |
4901 *normal_downloads_are_present = | 4907 *normal_downloads_are_present = |
4902 (download_manager && download_manager->in_progress_count() != 0); | 4908 (download_manager && download_manager->in_progress_count() != 0); |
4903 } | 4909 } |
4904 | 4910 |
4905 bool Browser::CanCloseWithInProgressDownloads() { | 4911 bool Browser::CanCloseWithInProgressDownloads() { |
4906 if (cancel_download_confirmation_state_ != NOT_PROMPTED) { | 4912 if (cancel_download_confirmation_state_ != NOT_PROMPTED) { |
4907 if (cancel_download_confirmation_state_ == WAITING_FOR_RESPONSE) { | 4913 if (cancel_download_confirmation_state_ == WAITING_FOR_RESPONSE) { |
4908 // We need to hear from the user before we can close. | 4914 // We need to hear from the user before we can close. |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5299 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); | 5305 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); |
5300 } else if (is_type_tabbed()) { | 5306 } else if (is_type_tabbed()) { |
5301 GlobalErrorService* service = | 5307 GlobalErrorService* service = |
5302 GlobalErrorServiceFactory::GetForProfile(profile()); | 5308 GlobalErrorServiceFactory::GetForProfile(profile()); |
5303 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5309 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
5304 if (error) { | 5310 if (error) { |
5305 error->ShowBubbleView(this); | 5311 error->ShowBubbleView(this); |
5306 } | 5312 } |
5307 } | 5313 } |
5308 } | 5314 } |
OLD | NEW |