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/path_service.h" | 11 #include "base/path_service.h" |
11 #include "base/thread.h" | 12 #include "base/thread.h" |
12 #include "base/waitable_event.h" | 13 #include "base/waitable_event.h" |
13 #include "chrome/browser/browser_trial.h" | 14 #include "chrome/browser/browser_trial.h" |
14 #include "chrome/browser/chrome_thread.h" | 15 #include "chrome/browser/chrome_thread.h" |
15 #include "chrome/browser/debugger/debugger_wrapper.h" | 16 #include "chrome/browser/debugger/debugger_wrapper.h" |
16 #include "chrome/browser/debugger/devtools_manager.h" | 17 #include "chrome/browser/debugger/devtools_manager.h" |
17 #include "chrome/browser/download/download_file.h" | 18 #include "chrome/browser/download/download_file.h" |
18 #include "chrome/browser/download/save_file_manager.h" | 19 #include "chrome/browser/download/save_file_manager.h" |
19 #include "chrome/browser/google_url_tracker.h" | 20 #include "chrome/browser/google_url_tracker.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 created_profile_manager_(false), | 124 created_profile_manager_(false), |
124 created_local_state_(false), | 125 created_local_state_(false), |
125 initialized_broker_services_(false), | 126 initialized_broker_services_(false), |
126 broker_services_(NULL), | 127 broker_services_(NULL), |
127 created_icon_manager_(false), | 128 created_icon_manager_(false), |
128 created_debugger_wrapper_(false), | 129 created_debugger_wrapper_(false), |
129 created_devtools_manager_(false), | 130 created_devtools_manager_(false), |
130 module_ref_count_(0), | 131 module_ref_count_(0), |
131 memory_model_(HIGH_MEMORY_MODEL), | 132 memory_model_(HIGH_MEMORY_MODEL), |
132 checked_for_new_frames_(false), | 133 checked_for_new_frames_(false), |
133 using_new_frames_(false) { | 134 using_new_frames_(false), |
| 135 have_inspector_files_(true) { |
134 g_browser_process = this; | 136 g_browser_process = this; |
135 clipboard_.reset(new Clipboard); | 137 clipboard_.reset(new Clipboard); |
136 main_notification_service_.reset(new NotificationService); | 138 main_notification_service_.reset(new NotificationService); |
137 | 139 |
138 // Must be created after the NotificationService. | 140 // Must be created after the NotificationService. |
139 print_job_manager_.reset(new printing::PrintJobManager); | 141 print_job_manager_.reset(new printing::PrintJobManager); |
140 | 142 |
141 // Configure the browser memory model. | 143 // Configure the browser memory model. |
142 if (command_line.HasSwitch(switches::kMemoryModel)) { | 144 if (command_line.HasSwitch(switches::kMemoryModel)) { |
143 std::wstring model = command_line.GetSwitchValue(switches::kMemoryModel); | 145 std::wstring model = command_line.GetSwitchValue(switches::kMemoryModel); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 DCHECK(devtools_manager_.get() == NULL); | 417 DCHECK(devtools_manager_.get() == NULL); |
416 created_devtools_manager_ = true; | 418 created_devtools_manager_ = true; |
417 devtools_manager_ = new DevToolsManager(); | 419 devtools_manager_ = new DevToolsManager(); |
418 } | 420 } |
419 | 421 |
420 void BrowserProcessImpl::CreateGoogleURLTracker() { | 422 void BrowserProcessImpl::CreateGoogleURLTracker() { |
421 DCHECK(google_url_tracker_.get() == NULL); | 423 DCHECK(google_url_tracker_.get() == NULL); |
422 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); | 424 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); |
423 google_url_tracker_.swap(google_url_tracker); | 425 google_url_tracker_.swap(google_url_tracker); |
424 } | 426 } |
| 427 |
| 428 // The BrowserProcess object must outlive the file thread so we use traits |
| 429 // which don't do any management. |
| 430 template <> |
| 431 struct RunnableMethodTraits<BrowserProcessImpl> { |
| 432 static void RetainCallee(BrowserProcessImpl*) {} |
| 433 static void ReleaseCallee(BrowserProcessImpl*) {} |
| 434 }; |
| 435 |
| 436 void BrowserProcessImpl::CheckForInspectorFiles() { |
| 437 file_thread()->message_loop()->PostTask |
| 438 (FROM_HERE, |
| 439 NewRunnableMethod(this, &BrowserProcessImpl::DoInspectorFilesCheck)); |
| 440 } |
| 441 |
| 442 void BrowserProcessImpl::DoInspectorFilesCheck() { |
| 443 // Runs on FILE thread. |
| 444 DCHECK(file_thread_->message_loop() == MessageLoop::current()); |
| 445 bool result = false; |
| 446 |
| 447 FilePath inspector_dir; |
| 448 if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) { |
| 449 result = file_util::PathExists(inspector_dir); |
| 450 } |
| 451 |
| 452 have_inspector_files_ = result; |
| 453 } |
OLD | NEW |