| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_trial.h" | 15 #include "chrome/browser/browser_trial.h" |
| 15 #include "chrome/browser/chrome_thread.h" | 16 #include "chrome/browser/chrome_thread.h" |
| 16 #include "chrome/browser/debugger/debugger_wrapper.h" | 17 #include "chrome/browser/debugger/debugger_wrapper.h" |
| 17 #include "chrome/browser/debugger/devtools_manager.h" | 18 #include "chrome/browser/debugger/devtools_manager.h" |
| 18 #include "chrome/browser/download/download_file.h" | 19 #include "chrome/browser/download/download_file.h" |
| 19 #include "chrome/browser/download/save_file_manager.h" | 20 #include "chrome/browser/download/save_file_manager.h" |
| 20 #include "chrome/browser/google_url_tracker.h" | 21 #include "chrome/browser/google_url_tracker.h" |
| 21 #include "chrome/browser/icon_manager.h" | 22 #include "chrome/browser/icon_manager.h" |
| 22 #include "chrome/browser/metrics/metrics_service.h" | 23 #include "chrome/browser/metrics/metrics_service.h" |
| 23 #include "chrome/browser/net/dns_global.h" | 24 #include "chrome/browser/net/dns_global.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 main_notification_service_.reset(); | 245 main_notification_service_.reset(); |
| 245 | 246 |
| 246 g_browser_process = NULL; | 247 g_browser_process = NULL; |
| 247 } | 248 } |
| 248 | 249 |
| 249 // Send a QuitTask to the given MessageLoop. | 250 // Send a QuitTask to the given MessageLoop. |
| 250 static void PostQuit(MessageLoop* message_loop) { | 251 static void PostQuit(MessageLoop* message_loop) { |
| 251 message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 252 message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
| 252 } | 253 } |
| 253 | 254 |
| 255 unsigned int BrowserProcessImpl::AddRefModule() { |
| 256 DCHECK(CalledOnValidThread()); |
| 257 module_ref_count_++; |
| 258 return module_ref_count_; |
| 259 } |
| 260 |
| 261 unsigned int BrowserProcessImpl::ReleaseModule() { |
| 262 DCHECK(CalledOnValidThread()); |
| 263 DCHECK(0 != module_ref_count_); |
| 264 module_ref_count_--; |
| 265 if (0 == module_ref_count_) { |
| 266 MessageLoop::current()->PostTask( |
| 267 FROM_HERE, NewRunnableFunction(Platform::DidEndMainMessageLoop)); |
| 268 MessageLoop::current()->Quit(); |
| 269 } |
| 270 return module_ref_count_; |
| 271 } |
| 272 |
| 254 void BrowserProcessImpl::EndSession() { | 273 void BrowserProcessImpl::EndSession() { |
| 255 #if defined(OS_WIN) | 274 #if defined(OS_WIN) |
| 256 // Notify we are going away. | 275 // Notify we are going away. |
| 257 ::SetEvent(shutdown_event_->handle()); | 276 ::SetEvent(shutdown_event_->handle()); |
| 258 #endif | 277 #endif |
| 259 | 278 |
| 260 // Mark all the profiles as clean. | 279 // Mark all the profiles as clean. |
| 261 ProfileManager* pm = profile_manager(); | 280 ProfileManager* pm = profile_manager(); |
| 262 for (ProfileManager::const_iterator i = pm->begin(); i != pm->end(); ++i) | 281 for (ProfileManager::const_iterator i = pm->begin(); i != pm->end(); ++i) |
| 263 (*i)->MarkAsCleanShutdown(); | 282 (*i)->MarkAsCleanShutdown(); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 DCHECK(file_thread_->message_loop() == MessageLoop::current()); | 524 DCHECK(file_thread_->message_loop() == MessageLoop::current()); |
| 506 bool result = false; | 525 bool result = false; |
| 507 | 526 |
| 508 FilePath inspector_dir; | 527 FilePath inspector_dir; |
| 509 if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) { | 528 if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) { |
| 510 result = file_util::PathExists(inspector_dir); | 529 result = file_util::PathExists(inspector_dir); |
| 511 } | 530 } |
| 512 | 531 |
| 513 have_inspector_files_ = result; | 532 have_inspector_files_ = result; |
| 514 } | 533 } |
| OLD | NEW |