| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/clipboard.h" | 8 #include "base/clipboard.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_trial.h" | 14 #include "chrome/browser/browser_trial.h" |
| 15 #include "chrome/browser/chrome_thread.h" | 15 #include "chrome/browser/chrome_thread.h" |
| 16 #include "chrome/browser/debugger/debugger_wrapper.h" | 16 #include "chrome/browser/debugger/debugger_wrapper.h" |
| 17 #include "chrome/browser/debugger/devtools_manager.h" | 17 #include "chrome/browser/debugger/devtools_manager.h" |
| 18 #include "chrome/browser/download/download_file.h" | 18 #include "chrome/browser/download/download_file.h" |
| 19 #include "chrome/browser/download/save_file_manager.h" | 19 #include "chrome/browser/download/save_file_manager.h" |
| 20 #include "chrome/browser/google_url_tracker.h" | 20 #include "chrome/browser/google_url_tracker.h" |
| 21 #include "chrome/browser/icon_manager.h" | 21 #include "chrome/browser/icon_manager.h" |
| 22 #include "chrome/browser/metrics/metrics_service.h" | 22 #include "chrome/browser/metrics/metrics_service.h" |
| 23 #include "chrome/browser/net/dns_global.h" | 23 #include "chrome/browser/net/dns_global.h" |
| 24 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 24 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
| 25 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 25 #include "chrome/browser/plugin_service.h" | 26 #include "chrome/browser/plugin_service.h" |
| 26 #include "chrome/browser/profile_manager.h" | 27 #include "chrome/browser/profile_manager.h" |
| 27 #include "chrome/browser/renderer_host/render_process_host.h" | 28 #include "chrome/browser/renderer_host/render_process_host.h" |
| 28 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 29 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 30 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 30 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
| 31 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/notification_service.h" | 33 #include "chrome/common/notification_service.h" |
| 33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/pref_service.h" | 35 #include "chrome/common/pref_service.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 created_db_thread_(false), | 133 created_db_thread_(false), |
| 133 created_profile_manager_(false), | 134 created_profile_manager_(false), |
| 134 created_local_state_(false), | 135 created_local_state_(false), |
| 135 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
| 136 initialized_broker_services_(false), | 137 initialized_broker_services_(false), |
| 137 broker_services_(NULL), | 138 broker_services_(NULL), |
| 138 #endif // defined(OS_WIN) | 139 #endif // defined(OS_WIN) |
| 139 created_icon_manager_(false), | 140 created_icon_manager_(false), |
| 140 created_debugger_wrapper_(false), | 141 created_debugger_wrapper_(false), |
| 141 created_devtools_manager_(false), | 142 created_devtools_manager_(false), |
| 143 #if defined(OS_WIN) |
| 144 created_notification_ui_manager_(false), |
| 145 #endif |
| 142 module_ref_count_(0), | 146 module_ref_count_(0), |
| 143 memory_model_(HIGH_MEMORY_MODEL), | 147 memory_model_(HIGH_MEMORY_MODEL), |
| 144 checked_for_new_frames_(false), | 148 checked_for_new_frames_(false), |
| 145 using_new_frames_(false), | 149 using_new_frames_(false), |
| 146 have_inspector_files_(true) { | 150 have_inspector_files_(true) { |
| 147 g_browser_process = this; | 151 g_browser_process = this; |
| 148 clipboard_.reset(new Clipboard); | 152 clipboard_.reset(new Clipboard); |
| 149 main_notification_service_.reset(new NotificationService); | 153 main_notification_service_.reset(new NotificationService); |
| 150 | 154 |
| 151 // Must be created after the NotificationService. | 155 // Must be created after the NotificationService. |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 created_devtools_manager_ = true; | 435 created_devtools_manager_ = true; |
| 432 devtools_manager_ = new DevToolsManager(); | 436 devtools_manager_ = new DevToolsManager(); |
| 433 } | 437 } |
| 434 | 438 |
| 435 void BrowserProcessImpl::CreateGoogleURLTracker() { | 439 void BrowserProcessImpl::CreateGoogleURLTracker() { |
| 436 DCHECK(google_url_tracker_.get() == NULL); | 440 DCHECK(google_url_tracker_.get() == NULL); |
| 437 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); | 441 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); |
| 438 google_url_tracker_.swap(google_url_tracker); | 442 google_url_tracker_.swap(google_url_tracker); |
| 439 } | 443 } |
| 440 | 444 |
| 445 #if defined(OS_WIN) |
| 446 void BrowserProcessImpl::CreateNotificationUIManager() { |
| 447 DCHECK(notification_ui_manager_.get() == NULL); |
| 448 notification_ui_manager_.reset(NotificationUIManager::Create()); |
| 449 } |
| 450 #endif |
| 451 |
| 441 // The BrowserProcess object must outlive the file thread so we use traits | 452 // The BrowserProcess object must outlive the file thread so we use traits |
| 442 // which don't do any management. | 453 // which don't do any management. |
| 443 template <> | 454 template <> |
| 444 struct RunnableMethodTraits<BrowserProcessImpl> { | 455 struct RunnableMethodTraits<BrowserProcessImpl> { |
| 445 static void RetainCallee(BrowserProcessImpl*) {} | 456 static void RetainCallee(BrowserProcessImpl*) {} |
| 446 static void ReleaseCallee(BrowserProcessImpl*) {} | 457 static void ReleaseCallee(BrowserProcessImpl*) {} |
| 447 }; | 458 }; |
| 448 | 459 |
| 449 void BrowserProcessImpl::CheckForInspectorFiles() { | 460 void BrowserProcessImpl::CheckForInspectorFiles() { |
| 450 file_thread()->message_loop()->PostTask | 461 file_thread()->message_loop()->PostTask |
| 451 (FROM_HERE, | 462 (FROM_HERE, |
| 452 NewRunnableMethod(this, &BrowserProcessImpl::DoInspectorFilesCheck)); | 463 NewRunnableMethod(this, &BrowserProcessImpl::DoInspectorFilesCheck)); |
| 453 } | 464 } |
| 454 | 465 |
| 455 void BrowserProcessImpl::DoInspectorFilesCheck() { | 466 void BrowserProcessImpl::DoInspectorFilesCheck() { |
| 456 // Runs on FILE thread. | 467 // Runs on FILE thread. |
| 457 DCHECK(file_thread_->message_loop() == MessageLoop::current()); | 468 DCHECK(file_thread_->message_loop() == MessageLoop::current()); |
| 458 bool result = false; | 469 bool result = false; |
| 459 | 470 |
| 460 FilePath inspector_dir; | 471 FilePath inspector_dir; |
| 461 if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) { | 472 if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) { |
| 462 result = file_util::PathExists(inspector_dir); | 473 result = file_util::PathExists(inspector_dir); |
| 463 } | 474 } |
| 464 | 475 |
| 465 have_inspector_files_ = result; | 476 have_inspector_files_ = result; |
| 466 } | 477 } |
| OLD | NEW |