Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 10824162: add device notification to Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use kIOAudioDeviceClassName to cover the bluetooth devices and changed to use std::vector Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/hi_res_timer_manager.h" 10 #include "base/hi_res_timer_manager.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "ui/base/l10n/l10n_util_win.h" 61 #include "ui/base/l10n/l10n_util_win.h"
62 #include "net/base/winsock_init.h" 62 #include "net/base/winsock_init.h"
63 #endif 63 #endif
64 64
65 #if defined(OS_LINUX) || defined(OS_OPENBSD) 65 #if defined(OS_LINUX) || defined(OS_OPENBSD)
66 #include <glib-object.h> 66 #include <glib-object.h>
67 #endif 67 #endif
68 68
69 #if defined(OS_LINUX) 69 #if defined(OS_LINUX)
70 #include "content/browser/device_monitor_linux.h" 70 #include "content/browser/device_monitor_linux.h"
71 #elif defined(OS_MACOSX)
72 #include "content/browser/device_monitor_mac.h"
71 #endif 73 #endif
72 74
73 #if defined(OS_CHROMEOS) 75 #if defined(OS_CHROMEOS)
74 #include <dbus/dbus-glib.h> 76 #include <dbus/dbus-glib.h>
75 #endif 77 #endif
76 78
77 #if defined(TOOLKIT_GTK) 79 #if defined(TOOLKIT_GTK)
78 #include "ui/gfx/gtk_util.h" 80 #include "ui/gfx/gtk_util.h"
79 #endif 81 #endif
80 82
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 if (resource_dispatcher_host_.get()) 500 if (resource_dispatcher_host_.get())
499 resource_dispatcher_host_.get()->Shutdown(); 501 resource_dispatcher_host_.get()->Shutdown();
500 502
501 #if defined(USE_AURA) 503 #if defined(USE_AURA)
502 ImageTransportFactory::Terminate(); 504 ImageTransportFactory::Terminate();
503 #endif 505 #endif
504 BrowserGpuChannelHostFactory::Terminate(); 506 BrowserGpuChannelHostFactory::Terminate();
505 507
506 GamepadService::GetInstance()->Terminate(); 508 GamepadService::GetInstance()->Terminate();
507 509
510 // The device monitors are using |system_monitor_| as dependency, so delete
511 // them before |system_monitor_| goes away.
512 #if defined(OS_WIN)
513 system_message_window_.reset();
514 #elif defined(OS_LINUX)
515 device_monitor_linux_.reset();
516 #elif defined(OS_MACOSX)
517 device_monitor_mac_.reset();
518 #endif
519
508 // Must be size_t so we can subtract from it. 520 // Must be size_t so we can subtract from it.
509 for (size_t thread_id = BrowserThread::ID_COUNT - 1; 521 for (size_t thread_id = BrowserThread::ID_COUNT - 1;
510 thread_id >= (BrowserThread::UI + 1); 522 thread_id >= (BrowserThread::UI + 1);
511 --thread_id) { 523 --thread_id) {
512 // Find the thread object we want to stop. Looping over all valid 524 // Find the thread object we want to stop. Looping over all valid
513 // BrowserThread IDs and DCHECKing on a missing case in the switch 525 // BrowserThread IDs and DCHECKing on a missing case in the switch
514 // statement helps avoid a mismatch between this code and the 526 // statement helps avoid a mismatch between this code and the
515 // BrowserThread::ID enumeration. 527 // BrowserThread::ID enumeration.
516 // 528 //
517 // The destruction order is the reverse order of occurrence in the 529 // The destruction order is the reverse order of occurrence in the
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 void BrowserMainLoop::BrowserThreadsStarted() { 624 void BrowserMainLoop::BrowserThreadsStarted() {
613 HistogramSynchronizer::GetInstance(); 625 HistogramSynchronizer::GetInstance();
614 626
615 content::BrowserGpuChannelHostFactory::Initialize(); 627 content::BrowserGpuChannelHostFactory::Initialize();
616 #if defined(USE_AURA) 628 #if defined(USE_AURA)
617 ImageTransportFactory::Initialize(); 629 ImageTransportFactory::Initialize();
618 #endif 630 #endif
619 631
620 #if defined(OS_LINUX) 632 #if defined(OS_LINUX)
621 device_monitor_linux_.reset(new DeviceMonitorLinux()); 633 device_monitor_linux_.reset(new DeviceMonitorLinux());
634 #elif defined(OS_MACOSX)
635 device_monitor_mac_.reset(new DeviceMonitorMac());
622 #endif 636 #endif
623 637
624 // RDH needs the IO thread to be created. 638 // RDH needs the IO thread to be created.
625 resource_dispatcher_host_.reset(new ResourceDispatcherHostImpl()); 639 resource_dispatcher_host_.reset(new ResourceDispatcherHostImpl());
626 640
627 #if defined(ENABLE_INPUT_SPEECH) 641 #if defined(ENABLE_INPUT_SPEECH)
628 speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl()); 642 speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl());
629 #endif 643 #endif
630 644
631 // Start the GpuDataManager before we set up the MessageLoops because 645 // Start the GpuDataManager before we set up the MessageLoops because
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); 695 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type());
682 if (parameters_.ui_task) 696 if (parameters_.ui_task)
683 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); 697 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task);
684 698
685 base::RunLoop run_loop; 699 base::RunLoop run_loop;
686 run_loop.Run(); 700 run_loop.Run();
687 #endif 701 #endif
688 } 702 }
689 703
690 } // namespace content 704 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698