license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
| 5 | #include "chrome/browser/browser_process_impl.h" |
| 6 | |
| 7 | #include "base/command_line.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 8 | #include "base/path_service.h" |
[email protected] | ac262c9f | 2008-10-19 17:45:21 | [diff] [blame] | 9 | #include "base/thread.h" |
[email protected] | 1c4947f | 2009-01-15 22:25:11 | [diff] [blame] | 10 | #include "base/waitable_event.h" |
[email protected] | ac262c9f | 2008-10-19 17:45:21 | [diff] [blame] | 11 | #include "chrome/browser/browser_trial.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 12 | #include "chrome/browser/chrome_thread.h" |
[email protected] | 4ab4b0f | 2009-02-10 18:54:50 | [diff] [blame] | 13 | #include "chrome/browser/debugger/debugger_wrapper.h" |
[email protected] | b7f0588 | 2009-02-22 01:21:56 | [diff] [blame] | 14 | #include "chrome/browser/download/download_file.h" |
[email protected] | 5ba0a2c | 2009-02-19 01:19:34 | [diff] [blame] | 15 | #include "chrome/browser/download/save_file_manager.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 16 | #include "chrome/browser/google_url_tracker.h" |
[email protected] | dc6f496 | 2009-02-13 01:25:50 | [diff] [blame] | 17 | #include "chrome/browser/metrics/metrics_service.h" |
[email protected] | 1933eb20 | 2009-02-19 18:23:25 | [diff] [blame] | 18 | #include "chrome/browser/net/dns_global.h" |
[email protected] | fd49e2d | 2009-02-20 17:21:30 | [diff] [blame] | 19 | #include "chrome/browser/plugin_service.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 20 | #include "chrome/browser/profile_manager.h" |
[email protected] | 8c8657d6 | 2009-01-16 18:31:26 | [diff] [blame] | 21 | #include "chrome/browser/renderer_host/render_process_host.h" |
[email protected] | 81218f4 | 2009-02-05 18:48:08 | [diff] [blame] | 22 | #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 23 | #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 24 | #include "chrome/common/chrome_paths.h" |
| 25 | #include "chrome/common/chrome_switches.h" |
[email protected] | ef3a0f2 | 2009-03-07 01:06:38 | [diff] [blame^] | 26 | #include "chrome/common/clipboard_service.h" |
[email protected] | 70dd2b3 | 2009-02-13 01:43:59 | [diff] [blame] | 27 | #include "chrome/common/l10n_util.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 28 | #include "chrome/common/notification_service.h" |
| 29 | #include "chrome/common/pref_names.h" |
| 30 | #include "chrome/common/pref_service.h" |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 31 | |
| 32 | #if defined(OS_WIN) |
| 33 | #include "chrome/browser/automation/automation_provider_list.h" |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 34 | #include "chrome/browser/icon_manager.h" |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 35 | #include "chrome/browser/printing/print_job_manager.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 36 | #include "chrome/views/accelerator_handler.h" |
| 37 | #include "chrome/views/view_storage.h" |
[email protected] | 81218f4 | 2009-02-05 18:48:08 | [diff] [blame] | 38 | #elif defined(OS_POSIX) |
| 39 | // TODO(port): Remove the temporary scaffolding as we port the above headers. |
| 40 | #include "chrome/common/temp_scaffolding_stubs.h" |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 41 | #endif |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 42 | |
| 43 | namespace { |
| 44 | |
| 45 | // ---------------------------------------------------------------------------- |
| 46 | // BrowserProcessSubThread |
| 47 | // |
| 48 | // This simple thread object is used for the specialized threads that the |
| 49 | // BrowserProcess spins up. |
| 50 | // |
| 51 | // Applications must initialize the COM library before they can call |
| 52 | // COM library functions other than CoGetMalloc and memory allocation |
| 53 | // functions, so this class initializes COM for those users. |
| 54 | class BrowserProcessSubThread : public ChromeThread { |
| 55 | public: |
| 56 | explicit BrowserProcessSubThread(ChromeThread::ID identifier) |
| 57 | : ChromeThread(identifier) { |
| 58 | } |
| 59 | |
| 60 | ~BrowserProcessSubThread() { |
| 61 | // We cannot rely on our base class to stop the thread since we want our |
| 62 | // CleanUp function to run. |
| 63 | Stop(); |
| 64 | } |
| 65 | |
| 66 | protected: |
| 67 | virtual void Init() { |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 68 | #if defined(OS_WIN) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 69 | // Initializes the COM library on the current thread. |
| 70 | CoInitialize(NULL); |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 71 | #endif |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 72 | |
| 73 | notification_service_ = new NotificationService; |
| 74 | } |
| 75 | |
| 76 | virtual void CleanUp() { |
| 77 | delete notification_service_; |
| 78 | notification_service_ = NULL; |
| 79 | |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 80 | #if defined(OS_WIN) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 81 | // Closes the COM library on the current thread. CoInitialize must |
| 82 | // be balanced by a corresponding call to CoUninitialize. |
| 83 | CoUninitialize(); |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 84 | #endif |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | private: |
| 88 | // Each specialized thread has its own notification service. |
| 89 | // Note: We don't use scoped_ptr because the destructor runs on the wrong |
| 90 | // thread. |
| 91 | NotificationService* notification_service_; |
| 92 | }; |
| 93 | |
| 94 | } // namespace |
| 95 | |
[email protected] | bb97536 | 2009-01-21 01:00:22 | [diff] [blame] | 96 | BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 97 | : created_resource_dispatcher_host_(false), |
| 98 | created_metrics_service_(false), |
| 99 | created_io_thread_(false), |
| 100 | created_file_thread_(false), |
| 101 | created_db_thread_(false), |
| 102 | created_profile_manager_(false), |
| 103 | created_local_state_(false), |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 104 | initialized_broker_services_(false), |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 105 | broker_services_(NULL), |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 106 | created_icon_manager_(false), |
| 107 | created_debugger_wrapper_(false), |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 108 | module_ref_count_(0), |
[email protected] | 1b2db1a | 2008-08-08 17:46:13 | [diff] [blame] | 109 | memory_model_(MEDIUM_MEMORY_MODEL), |
| 110 | checked_for_new_frames_(false), |
| 111 | using_new_frames_(false) { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 112 | g_browser_process = this; |
| 113 | clipboard_service_.reset(new ClipboardService); |
| 114 | main_notification_service_.reset(new NotificationService); |
| 115 | |
| 116 | // Must be created after the NotificationService. |
| 117 | print_job_manager_.reset(new printing::PrintJobManager); |
| 118 | |
| 119 | // Configure the browser memory model. |
| 120 | if (command_line.HasSwitch(switches::kMemoryModel)) { |
| 121 | std::wstring model = command_line.GetSwitchValue(switches::kMemoryModel); |
| 122 | if (!model.empty()) { |
| 123 | if (model == L"high") |
| 124 | memory_model_ = HIGH_MEMORY_MODEL; |
| 125 | else if (model == L"low") |
| 126 | memory_model_ = LOW_MEMORY_MODEL; |
| 127 | else if (model == L"medium") |
| 128 | memory_model_ = MEDIUM_MEMORY_MODEL; |
| 129 | } |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 130 | } |
[email protected] | b797e15 | 2009-01-23 16:06:14 | [diff] [blame] | 131 | shutdown_event_.reset(new base::WaitableEvent(true, false)); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | BrowserProcessImpl::~BrowserProcessImpl() { |
| 135 | // Delete the AutomationProviderList before NotificationService, |
| 136 | // since it may try to unregister notifications |
| 137 | // Both NotificationService and AutomationProvider are singleton instances in |
| 138 | // the BrowserProcess. Since AutomationProvider may have some active |
| 139 | // notification observers, it is essential that it gets destroyed before the |
| 140 | // NotificationService. NotificationService won't be destroyed until after |
| 141 | // this destructor is run. |
| 142 | automation_provider_list_.reset(); |
| 143 | |
| 144 | // We need to destroy the MetricsService and GoogleURLTracker before the |
| 145 | // io_thread_ gets destroyed, since both destructors can call the URLFetcher |
| 146 | // destructor, which does an InvokeLater operation on the IO thread. (The IO |
| 147 | // thread will handle that URLFetcher operation before going away.) |
| 148 | metrics_service_.reset(); |
| 149 | google_url_tracker_.reset(); |
| 150 | |
| 151 | // Need to clear profiles (download managers) before the io_thread_. |
| 152 | profile_manager_.reset(); |
| 153 | |
| 154 | // Debugger must be cleaned up before IO thread and NotificationService. |
| 155 | debugger_wrapper_ = NULL; |
| 156 | |
| 157 | if (resource_dispatcher_host_.get()) { |
| 158 | // Need to tell Safe Browsing Service that the IO thread is going away |
| 159 | // since it cached a pointer to it. |
| 160 | if (resource_dispatcher_host()->safe_browsing_service()) |
| 161 | resource_dispatcher_host()->safe_browsing_service()->ShutDown(); |
| 162 | |
| 163 | // Cancel pending requests and prevent new requests. |
| 164 | resource_dispatcher_host()->Shutdown(); |
| 165 | } |
| 166 | |
[email protected] | 1933eb20 | 2009-02-19 18:23:25 | [diff] [blame] | 167 | // Shutdown DNS prefetching now to ensure that network stack objects |
| 168 | // living on the IO thread get destroyed before the IO thread goes away. |
| 169 | io_thread_->message_loop()->PostTask(FROM_HERE, |
[email protected] | 53c4c62 | 2009-02-23 19:22:13 | [diff] [blame] | 170 | NewRunnableFunction(chrome_browser_net::EnsureDnsPrefetchShutdown)); |
[email protected] | 1933eb20 | 2009-02-19 18:23:25 | [diff] [blame] | 171 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 172 | // Need to stop io_thread_ before resource_dispatcher_host_, since |
| 173 | // io_thread_ may still deref ResourceDispatcherHost and handle resource |
| 174 | // request before going away. |
| 175 | io_thread_.reset(); |
| 176 | |
| 177 | // Clean up state that lives on the file_thread_ before it goes away. |
| 178 | if (resource_dispatcher_host_.get()) { |
| 179 | resource_dispatcher_host()->download_file_manager()->Shutdown(); |
| 180 | resource_dispatcher_host()->save_file_manager()->Shutdown(); |
| 181 | } |
| 182 | |
| 183 | // Need to stop the file_thread_ here to force it to process messages in its |
| 184 | // message loop from the previous call to shutdown the DownloadFileManager, |
| 185 | // SaveFileManager and SessionService. |
| 186 | file_thread_.reset(); |
| 187 | |
| 188 | // With the file_thread_ flushed, we can release any icon resources. |
| 189 | icon_manager_.reset(); |
| 190 | |
| 191 | // Need to destroy ResourceDispatcherHost before PluginService and |
| 192 | // SafeBrowsingService, since it caches a pointer to it. |
| 193 | resource_dispatcher_host_.reset(); |
| 194 | |
| 195 | // Wait for the pending print jobs to finish. |
| 196 | print_job_manager_->OnQuit(); |
| 197 | print_job_manager_.reset(); |
| 198 | |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 199 | // TODO(port): remove this completely from BrowserProcessImpl, it has no |
| 200 | // business being here. |
| 201 | #if defined(OS_WIN) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 202 | // The ViewStorage needs to go before the NotificationService. |
[email protected] | c2dacc9 | 2008-10-16 23:51:38 | [diff] [blame] | 203 | views::ViewStorage::DeleteSharedInstance(); |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 204 | #endif |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 205 | |
| 206 | // Now OK to destroy NotificationService. |
| 207 | main_notification_service_.reset(); |
| 208 | |
| 209 | g_browser_process = NULL; |
| 210 | } |
| 211 | |
[email protected] | 295039bd | 2008-08-15 04:32:57 | [diff] [blame] | 212 | // Send a QuitTask to the given MessageLoop. |
| 213 | static void PostQuit(MessageLoop* message_loop) { |
| 214 | message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
| 215 | } |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 216 | |
| 217 | void BrowserProcessImpl::EndSession() { |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 218 | #if defined(OS_WIN) |
[email protected] | d65cab7a | 2008-08-12 01:25:41 | [diff] [blame] | 219 | // Notify we are going away. |
[email protected] | b797e15 | 2009-01-23 16:06:14 | [diff] [blame] | 220 | ::SetEvent(shutdown_event_->handle()); |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 221 | #endif |
[email protected] | d65cab7a | 2008-08-12 01:25:41 | [diff] [blame] | 222 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 223 | // Mark all the profiles as clean. |
| 224 | ProfileManager* pm = profile_manager(); |
| 225 | for (ProfileManager::const_iterator i = pm->begin(); i != pm->end(); ++i) |
| 226 | (*i)->MarkAsCleanShutdown(); |
| 227 | |
| 228 | // Tell the metrics service it was cleanly shutdown. |
| 229 | MetricsService* metrics = g_browser_process->metrics_service(); |
| 230 | if (metrics && local_state()) { |
| 231 | metrics->RecordCleanShutdown(); |
| 232 | |
| 233 | metrics->RecordStartOfSessionEnd(); |
| 234 | |
| 235 | // MetricsService lazily writes to prefs, force it to write now. |
| 236 | local_state()->SavePersistentPrefs(file_thread()); |
| 237 | } |
| 238 | |
| 239 | // We must write that the profile and metrics service shutdown cleanly, |
| 240 | // otherwise on startup we'll think we crashed. So we block until done and |
| 241 | // then proceed with normal shutdown. |
| 242 | g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, |
[email protected] | 295039bd | 2008-08-15 04:32:57 | [diff] [blame] | 243 | NewRunnableFunction(PostQuit, MessageLoop::current())); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 244 | MessageLoop::current()->Run(); |
| 245 | } |
| 246 | |
| 247 | printing::PrintJobManager* BrowserProcessImpl::print_job_manager() { |
| 248 | // TODO(abarth): DCHECK(CalledOnValidThread()); |
| 249 | // See <http://b/1287209>. |
| 250 | // print_job_manager_ is initialized in the constructor and destroyed in the |
| 251 | // destructor, so it should always be valid. |
| 252 | DCHECK(print_job_manager_.get()); |
| 253 | return print_job_manager_.get(); |
| 254 | } |
| 255 | |
| 256 | const std::wstring& BrowserProcessImpl::GetApplicationLocale() { |
| 257 | DCHECK(CalledOnValidThread()); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 258 | if (locale_.empty()) { |
| 259 | locale_ = l10n_util::GetApplicationLocale(local_state()->GetString( |
| 260 | prefs::kApplicationLocale)); |
| 261 | } |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 262 | return locale_; |
| 263 | } |
| 264 | |
| 265 | void BrowserProcessImpl::CreateResourceDispatcherHost() { |
| 266 | DCHECK(!created_resource_dispatcher_host_ && |
| 267 | resource_dispatcher_host_.get() == NULL); |
| 268 | created_resource_dispatcher_host_ = true; |
| 269 | |
| 270 | resource_dispatcher_host_.reset( |
| 271 | new ResourceDispatcherHost(io_thread()->message_loop())); |
| 272 | resource_dispatcher_host_->Initialize(); |
| 273 | } |
| 274 | |
| 275 | void BrowserProcessImpl::CreateMetricsService() { |
| 276 | DCHECK(!created_metrics_service_ && metrics_service_.get() == NULL); |
| 277 | created_metrics_service_ = true; |
| 278 | |
| 279 | metrics_service_.reset(new MetricsService); |
| 280 | } |
| 281 | |
| 282 | void BrowserProcessImpl::CreateIOThread() { |
| 283 | DCHECK(!created_io_thread_ && io_thread_.get() == NULL); |
| 284 | created_io_thread_ = true; |
| 285 | |
| 286 | // Prior to starting the io thread, we create the plugin service as |
| 287 | // it is predominantly used from the io thread, but must be created |
| 288 | // on the main thread. The service ctor is inexpensive and does not |
| 289 | // invoke the io_thread() accessor. |
| 290 | PluginService::GetInstance(); |
| 291 | |
[email protected] | ab820df | 2008-08-26 05:55:10 | [diff] [blame] | 292 | scoped_ptr<base::Thread> thread( |
| 293 | new BrowserProcessSubThread(ChromeThread::IO)); |
| 294 | base::Thread::Options options; |
| 295 | options.message_loop_type = MessageLoop::TYPE_IO; |
| 296 | if (!thread->StartWithOptions(options)) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 297 | return; |
| 298 | io_thread_.swap(thread); |
| 299 | } |
| 300 | |
| 301 | void BrowserProcessImpl::CreateFileThread() { |
| 302 | DCHECK(!created_file_thread_ && file_thread_.get() == NULL); |
| 303 | created_file_thread_ = true; |
| 304 | |
[email protected] | ab820df | 2008-08-26 05:55:10 | [diff] [blame] | 305 | scoped_ptr<base::Thread> thread( |
| 306 | new BrowserProcessSubThread(ChromeThread::FILE)); |
[email protected] | a1db384 | 2008-09-17 22:04:06 | [diff] [blame] | 307 | base::Thread::Options options; |
[email protected] | 9e549b58 | 2009-02-05 21:13:39 | [diff] [blame] | 308 | #if defined(OS_WIN) |
| 309 | // On Windows, the FILE thread needs to be have a UI message loop which pumps |
| 310 | // messages in such a way that Google Update can communicate back to us. |
[email protected] | a1db384 | 2008-09-17 22:04:06 | [diff] [blame] | 311 | options.message_loop_type = MessageLoop::TYPE_UI; |
[email protected] | 9e549b58 | 2009-02-05 21:13:39 | [diff] [blame] | 312 | #else |
| 313 | options.message_loop_type = MessageLoop::TYPE_IO; |
| 314 | #endif |
[email protected] | a1db384 | 2008-09-17 22:04:06 | [diff] [blame] | 315 | if (!thread->StartWithOptions(options)) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 316 | return; |
| 317 | file_thread_.swap(thread); |
| 318 | } |
| 319 | |
| 320 | void BrowserProcessImpl::CreateDBThread() { |
| 321 | DCHECK(!created_db_thread_ && db_thread_.get() == NULL); |
| 322 | created_db_thread_ = true; |
| 323 | |
[email protected] | ab820df | 2008-08-26 05:55:10 | [diff] [blame] | 324 | scoped_ptr<base::Thread> thread( |
| 325 | new BrowserProcessSubThread(ChromeThread::DB)); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 326 | if (!thread->Start()) |
| 327 | return; |
| 328 | db_thread_.swap(thread); |
| 329 | } |
| 330 | |
| 331 | void BrowserProcessImpl::CreateProfileManager() { |
| 332 | DCHECK(!created_profile_manager_ && profile_manager_.get() == NULL); |
| 333 | created_profile_manager_ = true; |
| 334 | |
| 335 | profile_manager_.reset(new ProfileManager()); |
| 336 | } |
| 337 | |
| 338 | void BrowserProcessImpl::CreateLocalState() { |
| 339 | DCHECK(!created_local_state_ && local_state_.get() == NULL); |
| 340 | created_local_state_ = true; |
| 341 | |
[email protected] | b963600 | 2009-03-04 00:05:25 | [diff] [blame] | 342 | FilePath local_state_path; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 343 | PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
| 344 | local_state_.reset(new PrefService(local_state_path)); |
| 345 | } |
| 346 | |
| 347 | void BrowserProcessImpl::InitBrokerServices( |
| 348 | sandbox::BrokerServices* broker_services) { |
| 349 | DCHECK(!initialized_broker_services_ && broker_services_ == NULL); |
| 350 | broker_services->Init(); |
| 351 | initialized_broker_services_ = true; |
| 352 | broker_services_ = broker_services; |
| 353 | } |
| 354 | |
| 355 | void BrowserProcessImpl::CreateIconManager() { |
| 356 | DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); |
| 357 | created_icon_manager_ = true; |
| 358 | icon_manager_.reset(new IconManager); |
| 359 | } |
| 360 | |
| 361 | void BrowserProcessImpl::CreateDebuggerWrapper(int port) { |
| 362 | DCHECK(debugger_wrapper_.get() == NULL); |
| 363 | created_debugger_wrapper_ = true; |
| 364 | |
| 365 | debugger_wrapper_ = new DebuggerWrapper(port); |
| 366 | } |
| 367 | |
| 368 | void BrowserProcessImpl::CreateAcceleratorHandler() { |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 369 | #if defined(OS_WIN) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 370 | DCHECK(accelerator_handler_.get() == NULL); |
[email protected] | c2dacc9 | 2008-10-16 23:51:38 | [diff] [blame] | 371 | scoped_ptr<views::AcceleratorHandler> accelerator_handler( |
| 372 | new views::AcceleratorHandler); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 373 | accelerator_handler_.swap(accelerator_handler); |
[email protected] | b112a4c | 2009-02-01 20:24:01 | [diff] [blame] | 374 | #else |
| 375 | // TODO(port): remove this completely, it has no business being here. |
| 376 | #endif |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 377 | } |
| 378 | |
| 379 | void BrowserProcessImpl::CreateGoogleURLTracker() { |
| 380 | DCHECK(google_url_tracker_.get() == NULL); |
| 381 | scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); |
| 382 | google_url_tracker_.swap(google_url_tracker); |
| 383 | } |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 384 | |