OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include "app/clipboard/clipboard.h" | 7 #include "app/clipboard/clipboard.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/thread.h" | 12 #include "base/thread.h" |
13 #include "base/waitable_event.h" | 13 #include "base/waitable_event.h" |
14 #include "chrome/browser/browser_main.h" | 14 #include "chrome/browser/browser_main.h" |
15 #include "chrome/browser/browser_trial.h" | 15 #include "chrome/browser/browser_trial.h" |
16 #include "chrome/browser/chrome_thread.h" | 16 #include "chrome/browser/chrome_thread.h" |
17 #include "chrome/browser/debugger/debugger_wrapper.h" | 17 #include "chrome/browser/debugger/debugger_wrapper.h" |
18 #include "chrome/browser/debugger/devtools_manager.h" | 18 #include "chrome/browser/debugger/devtools_manager.h" |
19 #include "chrome/browser/download/download_file.h" | 19 #include "chrome/browser/download/download_file.h" |
20 #include "chrome/browser/download/save_file_manager.h" | 20 #include "chrome/browser/download/save_file_manager.h" |
21 #include "chrome/browser/google_url_tracker.h" | 21 #include "chrome/browser/google_url_tracker.h" |
22 #include "chrome/browser/icon_manager.h" | 22 #include "chrome/browser/icon_manager.h" |
| 23 #include "chrome/browser/intranet_redirect_detector.h" |
23 #include "chrome/browser/metrics/metrics_service.h" | 24 #include "chrome/browser/metrics/metrics_service.h" |
24 #include "chrome/browser/net/dns_global.h" | 25 #include "chrome/browser/net/dns_global.h" |
25 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 26 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
26 #include "chrome/browser/notifications/notification_ui_manager.h" | 27 #include "chrome/browser/notifications/notification_ui_manager.h" |
27 #include "chrome/browser/plugin_service.h" | 28 #include "chrome/browser/plugin_service.h" |
28 #include "chrome/browser/profile_manager.h" | 29 #include "chrome/browser/profile_manager.h" |
29 #include "chrome/browser/renderer_host/render_process_host.h" | 30 #include "chrome/browser/renderer_host/render_process_host.h" |
30 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 31 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
31 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 32 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
32 #include "chrome/common/child_process_host.h" | 33 #include "chrome/common/child_process_host.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // NotificationService. NotificationService won't be destroyed until after | 176 // NotificationService. NotificationService won't be destroyed until after |
176 // this destructor is run. | 177 // this destructor is run. |
177 automation_provider_list_.reset(); | 178 automation_provider_list_.reset(); |
178 | 179 |
179 // We need to shutdown the SdchDictionaryFetcher as it regularly holds | 180 // We need to shutdown the SdchDictionaryFetcher as it regularly holds |
180 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do | 181 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do |
181 // a PostDelayedTask onto the IO thread. This shutdown call will both discard | 182 // a PostDelayedTask onto the IO thread. This shutdown call will both discard |
182 // any pending URLFetchers, and avoid creating any more. | 183 // any pending URLFetchers, and avoid creating any more. |
183 SdchDictionaryFetcher::Shutdown(); | 184 SdchDictionaryFetcher::Shutdown(); |
184 | 185 |
185 // We need to destroy the MetricsService and GoogleURLTracker before the | 186 // We need to destroy the MetricsService, GoogleURLTracker, and |
186 // io_thread_ gets destroyed, since both destructors can call the URLFetcher | 187 // IntranetRedirectDetector before the io_thread_ gets destroyed, since their |
187 // destructor, which does an PostDelayedTask operation on the IO thread. (The | 188 // destructors can call the URLFetcher destructor, which does a |
188 // IO thread will handle that URLFetcher operation before going away.) | 189 // PostDelayedTask operation on the IO thread. (The IO thread will handle |
| 190 // that URLFetcher operation before going away.) |
189 metrics_service_.reset(); | 191 metrics_service_.reset(); |
190 google_url_tracker_.reset(); | 192 google_url_tracker_.reset(); |
| 193 intranet_redirect_detector_.reset(); |
191 | 194 |
192 // Need to clear profiles (download managers) before the io_thread_. | 195 // Need to clear profiles (download managers) before the io_thread_. |
193 profile_manager_.reset(); | 196 profile_manager_.reset(); |
194 | 197 |
195 // Debugger must be cleaned up before IO thread and NotificationService. | 198 // Debugger must be cleaned up before IO thread and NotificationService. |
196 debugger_wrapper_ = NULL; | 199 debugger_wrapper_ = NULL; |
197 | 200 |
198 if (resource_dispatcher_host_.get()) { | 201 if (resource_dispatcher_host_.get()) { |
199 // Need to tell Safe Browsing Service that the IO thread is going away | 202 // Need to tell Safe Browsing Service that the IO thread is going away |
200 // since it cached a pointer to it. | 203 // since it cached a pointer to it. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 created_devtools_manager_ = true; | 457 created_devtools_manager_ = true; |
455 devtools_manager_ = new DevToolsManager(); | 458 devtools_manager_ = new DevToolsManager(); |
456 } | 459 } |
457 | 460 |
458 void BrowserProcessImpl::CreateGoogleURLTracker() { | 461 void BrowserProcessImpl::CreateGoogleURLTracker() { |
459 DCHECK(google_url_tracker_.get() == NULL); | 462 DCHECK(google_url_tracker_.get() == NULL); |
460 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); | 463 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); |
461 google_url_tracker_.swap(google_url_tracker); | 464 google_url_tracker_.swap(google_url_tracker); |
462 } | 465 } |
463 | 466 |
| 467 void BrowserProcessImpl::CreateIntranetRedirectDetector() { |
| 468 DCHECK(intranet_redirect_detector_.get() == NULL); |
| 469 scoped_ptr<IntranetRedirectDetector> intranet_redirect_detector( |
| 470 new IntranetRedirectDetector); |
| 471 intranet_redirect_detector_.swap(intranet_redirect_detector); |
| 472 } |
| 473 |
464 void BrowserProcessImpl::CreateNotificationUIManager() { | 474 void BrowserProcessImpl::CreateNotificationUIManager() { |
465 DCHECK(notification_ui_manager_.get() == NULL); | 475 DCHECK(notification_ui_manager_.get() == NULL); |
466 notification_ui_manager_.reset(NotificationUIManager::Create()); | 476 notification_ui_manager_.reset(NotificationUIManager::Create()); |
467 created_notification_ui_manager_ = true; | 477 created_notification_ui_manager_ = true; |
468 } | 478 } |
469 | 479 |
470 // The BrowserProcess object must outlive the file thread so we use traits | 480 // The BrowserProcess object must outlive the file thread so we use traits |
471 // which don't do any management. | 481 // which don't do any management. |
472 template <> | 482 template <> |
473 struct RunnableMethodTraits<BrowserProcessImpl> { | 483 struct RunnableMethodTraits<BrowserProcessImpl> { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 DCHECK(file_thread_->message_loop() == MessageLoop::current()); | 534 DCHECK(file_thread_->message_loop() == MessageLoop::current()); |
525 bool result = false; | 535 bool result = false; |
526 | 536 |
527 FilePath inspector_dir; | 537 FilePath inspector_dir; |
528 if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) { | 538 if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) { |
529 result = file_util::PathExists(inspector_dir); | 539 result = file_util::PathExists(inspector_dir); |
530 } | 540 } |
531 | 541 |
532 have_inspector_files_ = result; | 542 have_inspector_files_ = result; |
533 } | 543 } |
OLD | NEW |