OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include <windows.h> | 47 #include <windows.h> |
48 #include <commctrl.h> | 48 #include <commctrl.h> |
49 #include <ole2.h> | 49 #include <ole2.h> |
50 #include <shellapi.h> | 50 #include <shellapi.h> |
51 | 51 |
52 #include "content/browser/system_message_window_win.h" | 52 #include "content/browser/system_message_window_win.h" |
53 #include "ui/base/l10n/l10n_util_win.h" | 53 #include "ui/base/l10n/l10n_util_win.h" |
54 #include "net/base/winsock_init.h" | 54 #include "net/base/winsock_init.h" |
55 #endif | 55 #endif |
56 | 56 |
| 57 #if defined(OS_LINUX) |
| 58 #include "content/browser/media_device_notifications_linux.h" |
| 59 #endif |
| 60 |
57 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 61 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
58 #include <glib-object.h> | 62 #include <glib-object.h> |
59 #endif | 63 #endif |
60 | 64 |
61 #if defined(OS_CHROMEOS) | 65 #if defined(OS_CHROMEOS) |
62 #include <dbus/dbus-glib.h> | 66 #include <dbus/dbus-glib.h> |
63 #endif | 67 #endif |
64 | 68 |
65 #if defined(TOOLKIT_USES_GTK) | 69 #if defined(TOOLKIT_USES_GTK) |
66 #include "ui/gfx/gtk_util.h" | 70 #include "ui/gfx/gtk_util.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 201 |
198 void ImmediateShutdownAndExitProcess() { | 202 void ImmediateShutdownAndExitProcess() { |
199 BrowserShutdownImpl::ImmediateShutdownAndExitProcess(); | 203 BrowserShutdownImpl::ImmediateShutdownAndExitProcess(); |
200 } | 204 } |
201 | 205 |
202 // static | 206 // static |
203 AudioManager* BrowserMainLoop::GetAudioManager() { | 207 AudioManager* BrowserMainLoop::GetAudioManager() { |
204 return g_current_browser_main_loop->audio_manager_.get(); | 208 return g_current_browser_main_loop->audio_manager_.get(); |
205 } | 209 } |
206 | 210 |
207 // BrowserMainLoop construction / destructione ============================= | 211 // BrowserMainLoop construction / destruction ============================= |
208 | 212 |
209 BrowserMainLoop::BrowserMainLoop(const content::MainFunctionParams& parameters) | 213 BrowserMainLoop::BrowserMainLoop(const content::MainFunctionParams& parameters) |
210 : parameters_(parameters), | 214 : parameters_(parameters), |
211 parsed_command_line_(parameters.command_line), | 215 parsed_command_line_(parameters.command_line), |
212 result_code_(content::RESULT_CODE_NORMAL_EXIT) { | 216 result_code_(content::RESULT_CODE_NORMAL_EXIT) { |
213 DCHECK(!g_current_browser_main_loop); | 217 DCHECK(!g_current_browser_main_loop); |
214 g_current_browser_main_loop = this; | 218 g_current_browser_main_loop = this; |
215 #if defined(OS_WIN) | 219 #if defined(OS_WIN) |
216 OleInitialize(NULL); | 220 OleInitialize(NULL); |
217 #endif | 221 #endif |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 | 584 |
581 // Register the main thread by instantiating it, but don't call any methods. | 585 // Register the main thread by instantiating it, but don't call any methods. |
582 main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, | 586 main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, |
583 MessageLoop::current())); | 587 MessageLoop::current())); |
584 } | 588 } |
585 | 589 |
586 | 590 |
587 void BrowserMainLoop::BrowserThreadsStarted() { | 591 void BrowserMainLoop::BrowserThreadsStarted() { |
588 // RDH needs the IO thread to be created. | 592 // RDH needs the IO thread to be created. |
589 resource_dispatcher_host_.reset(new ResourceDispatcherHost()); | 593 resource_dispatcher_host_.reset(new ResourceDispatcherHost()); |
| 594 |
| 595 #if defined(OS_LINUX) |
| 596 // MediaDeviceNotificationsLinux needs the File Thread. |
| 597 const FilePath kDefaultMtabPath("/etc/mtab"); |
| 598 media_device_notifications_linux_ = |
| 599 new MediaDeviceNotificationsLinux(kDefaultMtabPath); |
| 600 media_device_notifications_linux_->Init(); |
| 601 #endif |
590 } | 602 } |
591 | 603 |
592 void BrowserMainLoop::InitializeToolkit() { | 604 void BrowserMainLoop::InitializeToolkit() { |
593 // TODO(evan): this function is rather subtle, due to the variety | 605 // TODO(evan): this function is rather subtle, due to the variety |
594 // of intersecting ifdefs we have. To keep it easy to follow, there | 606 // of intersecting ifdefs we have. To keep it easy to follow, there |
595 // are no #else branches on any #ifs. | 607 // are no #else branches on any #ifs. |
596 // TODO(stevenjb): Move platform specific code into platform specific Parts | 608 // TODO(stevenjb): Move platform specific code into platform specific Parts |
597 // (Need to add InitializeToolkit stage to BrowserParts). | 609 // (Need to add InitializeToolkit stage to BrowserParts). |
598 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 610 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
599 // Glib type system initialization. Needed at least for gconf, | 611 // Glib type system initialization. Needed at least for gconf, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 650 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
639 | 651 |
640 #if defined(OS_MACOSX) | 652 #if defined(OS_MACOSX) |
641 MessageLoopForUI::current()->Run(); | 653 MessageLoopForUI::current()->Run(); |
642 #else | 654 #else |
643 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 655 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
644 #endif | 656 #endif |
645 } | 657 } |
646 | 658 |
647 } // namespace content | 659 } // namespace content |
OLD | NEW |