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 4802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4854 /////////////////////////////////////////////////////////////////////////////// | 4856 /////////////////////////////////////////////////////////////////////////////// |
4855 // Browser, In-progress download termination handling (private): | 4857 // Browser, In-progress download termination handling (private): |
4856 | 4858 |
4857 void Browser::CheckDownloadsInProgress(bool* normal_downloads_are_present, | 4859 void Browser::CheckDownloadsInProgress(bool* normal_downloads_are_present, |
4858 bool* incognito_downloads_are_present) { | 4860 bool* incognito_downloads_are_present) { |
4859 *normal_downloads_are_present = false; | 4861 *normal_downloads_are_present = false; |
4860 *incognito_downloads_are_present = false; | 4862 *incognito_downloads_are_present = false; |
4861 | 4863 |
4862 // If there are no download in-progress, our job is done. | 4864 // If there are no download in-progress, our job is done. |
4863 DownloadManager* download_manager = NULL; | 4865 DownloadManager* download_manager = NULL; |
| 4866 DownloadService* download_service = |
| 4867 DownloadServiceFactory::GetForProfile(profile()); |
4864 // But first we need to check for the existence of the download manager, as | 4868 // But first we need to check for the existence of the download manager, as |
4865 // GetDownloadManager() will unnecessarily try to create one if it does not | 4869 // GetDownloadManager() will unnecessarily try to create one if it does not |
4866 // exist. | 4870 // exist. |
4867 if (profile()->HasCreatedDownloadManager()) | 4871 if (download_service->HasCreatedDownloadManager()) |
4868 download_manager = profile()->GetDownloadManager(); | 4872 download_manager = download_service->GetDownloadManager(); |
4869 if (profile()->IsOffTheRecord()) { | 4873 if (profile()->IsOffTheRecord()) { |
4870 // Browser is incognito and so download_manager if present is for incognito | 4874 // Browser is incognito and so download_manager if present is for incognito |
4871 // downloads. | 4875 // downloads. |
4872 *incognito_downloads_are_present = | 4876 *incognito_downloads_are_present = |
4873 (download_manager && download_manager->in_progress_count() != 0); | 4877 (download_manager && download_manager->in_progress_count() != 0); |
4874 // Check original profile. | 4878 // Check original profile. |
4875 if (profile()->GetOriginalProfile()->HasCreatedDownloadManager()) | 4879 DownloadService* download_service = DownloadServiceFactory::GetForProfile( |
4876 download_manager = profile()->GetOriginalProfile()->GetDownloadManager(); | 4880 profile()->GetOriginalProfile()); |
| 4881 if (download_service->HasCreatedDownloadManager()) |
| 4882 download_manager = download_service->GetDownloadManager(); |
4877 } | 4883 } |
4878 | 4884 |
4879 *normal_downloads_are_present = | 4885 *normal_downloads_are_present = |
4880 (download_manager && download_manager->in_progress_count() != 0); | 4886 (download_manager && download_manager->in_progress_count() != 0); |
4881 } | 4887 } |
4882 | 4888 |
4883 bool Browser::CanCloseWithInProgressDownloads() { | 4889 bool Browser::CanCloseWithInProgressDownloads() { |
4884 if (cancel_download_confirmation_state_ != NOT_PROMPTED) { | 4890 if (cancel_download_confirmation_state_ != NOT_PROMPTED) { |
4885 if (cancel_download_confirmation_state_ == WAITING_FOR_RESPONSE) { | 4891 if (cancel_download_confirmation_state_ == WAITING_FOR_RESPONSE) { |
4886 // We need to hear from the user before we can close. | 4892 // We need to hear from the user before we can close. |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5285 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); | 5291 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); |
5286 } else if (is_type_tabbed()) { | 5292 } else if (is_type_tabbed()) { |
5287 GlobalErrorService* service = | 5293 GlobalErrorService* service = |
5288 GlobalErrorServiceFactory::GetForProfile(profile()); | 5294 GlobalErrorServiceFactory::GetForProfile(profile()); |
5289 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5295 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
5290 if (error) { | 5296 if (error) { |
5291 error->ShowBubbleView(this); | 5297 error->ShowBubbleView(this); |
5292 } | 5298 } |
5293 } | 5299 } |
5294 } | 5300 } |
OLD | NEW |