diff options
-rw-r--r-- | chrome/browser/chrome_browser_main_linux.cc | 10 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main_linux.h | 9 | ||||
-rw-r--r-- | chrome/browser/media_gallery/media_device_notifications_linux.cc (renamed from content/browser/media_device_notifications_linux.cc) | 7 | ||||
-rw-r--r-- | chrome/browser/media_gallery/media_device_notifications_linux.h (renamed from content/browser/media_device_notifications_linux.h) | 13 | ||||
-rw-r--r-- | chrome/browser/media_gallery/media_device_notifications_linux_unittest.cc (renamed from content/browser/media_device_notifications_linux_unittest.cc) | 12 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 1 | ||||
-rw-r--r-- | content/browser/browser_main_loop.cc | 12 | ||||
-rw-r--r-- | content/browser/browser_main_loop.h | 4 | ||||
-rw-r--r-- | content/content_browser.gypi | 2 | ||||
-rw-r--r-- | content/content_tests.gypi | 1 |
11 files changed, 38 insertions, 35 deletions
diff --git a/chrome/browser/chrome_browser_main_linux.cc b/chrome/browser/chrome_browser_main_linux.cc index 1354ffb..c28daa4 100644 --- a/chrome/browser/chrome_browser_main_linux.cc +++ b/chrome/browser/chrome_browser_main_linux.cc @@ -4,6 +4,8 @@ #include "chrome/browser/chrome_browser_main_linux.h" +#include "chrome/browser/media_gallery/media_device_notifications_linux.h" + #if defined(USE_LINUX_BREAKPAD) #include <stdlib.h> @@ -70,6 +72,9 @@ ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( : ChromeBrowserMainPartsPosix(parameters) { } +ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { +} + void ChromeBrowserMainPartsLinux::PreProfileInit() { #if defined(USE_LINUX_BREAKPAD) // Needs to be called after we have chrome::DIR_USER_DATA and @@ -82,5 +87,10 @@ void ChromeBrowserMainPartsLinux::PreProfileInit() { InitCrashReporter(); #endif + const FilePath kDefaultMtabPath("/etc/mtab"); + media_device_notifications_linux_ = + new chrome::MediaDeviceNotificationsLinux(kDefaultMtabPath); + media_device_notifications_linux_->Init(); + ChromeBrowserMainPartsPosix::PreProfileInit(); } diff --git a/chrome/browser/chrome_browser_main_linux.h b/chrome/browser/chrome_browser_main_linux.h index f73c39f..6dd5093 100644 --- a/chrome/browser/chrome_browser_main_linux.h +++ b/chrome/browser/chrome_browser_main_linux.h @@ -9,17 +9,26 @@ #pragma once #include "base/compiler_specific.h" +#include "base/memory/ref_counted.h" #include "chrome/browser/chrome_browser_main_posix.h" +namespace chrome { +class MediaDeviceNotificationsLinux; +} + class ChromeBrowserMainPartsLinux : public ChromeBrowserMainPartsPosix { public: explicit ChromeBrowserMainPartsLinux( const content::MainFunctionParams& parameters); + virtual ~ChromeBrowserMainPartsLinux(); // ChromeBrowserMainParts overrides. virtual void PreProfileInit() OVERRIDE; private: + scoped_refptr<chrome::MediaDeviceNotificationsLinux> + media_device_notifications_linux_; + DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsLinux); }; diff --git a/content/browser/media_device_notifications_linux.cc b/chrome/browser/media_gallery/media_device_notifications_linux.cc index 1ac8263..f269a10 100644 --- a/content/browser/media_device_notifications_linux.cc +++ b/chrome/browser/media_gallery/media_device_notifications_linux.cc @@ -4,7 +4,7 @@ // MediaDeviceNotificationsLinux implementation. -#include "content/browser/media_device_notifications_linux.h" +#include "chrome/browser/media_gallery/media_device_notifications_linux.h" #include <mntent.h> #include <stdio.h> @@ -38,9 +38,10 @@ const char* const kKnownFileSystems[] = { } // namespace -namespace content { +namespace chrome { using base::SystemMonitor; +using content::BrowserThread; // A simple pass-through class. MediaDeviceNotificationsLinux cannot directly // inherit from FilePathWatcher::Delegate due to multiple inheritance. @@ -275,4 +276,4 @@ void MediaDeviceNotificationsLinux::RemoveOldDevice( system_monitor->ProcessMediaDeviceDetached(device_id); } -} // namespace content +} // namespace chrome diff --git a/content/browser/media_device_notifications_linux.h b/chrome/browser/media_gallery/media_device_notifications_linux.h index 1b7320c..3e83671 100644 --- a/content/browser/media_device_notifications_linux.h +++ b/chrome/browser/media_gallery/media_device_notifications_linux.h @@ -5,8 +5,8 @@ // MediaDeviceNotificationsLinux listens for mount point changes and notifies // the SystemMonitor about the addition and deletion of media devices. -#ifndef CONTENT_BROWSER_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ -#define CONTENT_BROWSER_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ +#ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ +#define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ #pragma once #include <map> @@ -19,13 +19,12 @@ #include "base/files/file_path_watcher.h" #include "base/memory/ref_counted.h" #include "base/system_monitor/system_monitor.h" -#include "content/common/content_export.h" class FilePath; -namespace content { +namespace chrome { -class CONTENT_EXPORT MediaDeviceNotificationsLinux +class MediaDeviceNotificationsLinux : public base::RefCountedThreadSafe<MediaDeviceNotificationsLinux> { public: explicit MediaDeviceNotificationsLinux(const FilePath& path); @@ -101,6 +100,6 @@ class CONTENT_EXPORT MediaDeviceNotificationsLinux DISALLOW_COPY_AND_ASSIGN(MediaDeviceNotificationsLinux); }; -} // namespace content +} // namespace chrome -#endif // CONTENT_BROWSER_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ +#endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_LINUX_H_ diff --git a/content/browser/media_device_notifications_linux_unittest.cc b/chrome/browser/media_gallery/media_device_notifications_linux_unittest.cc index 04a1533..77ebdaf 100644 --- a/content/browser/media_device_notifications_linux_unittest.cc +++ b/chrome/browser/media_gallery/media_device_notifications_linux_unittest.cc @@ -4,7 +4,7 @@ // MediaDeviceNotificationsLinux unit tests. -#include "content/browser/media_device_notifications_linux.h" +#include "chrome/browser/media_gallery/media_device_notifications_linux.h" #include <mntent.h> #include <stdio.h> @@ -18,10 +18,10 @@ #include "base/scoped_temp_dir.h" #include "base/system_monitor/system_monitor.h" #include "base/test/mock_devices_changed_observer.h" -#include "content/browser/browser_thread_impl.h" +#include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -namespace content { +namespace chrome { namespace { @@ -95,7 +95,7 @@ class MediaDeviceNotificationsLinuxTest : public testing::Test { MediaDeviceNotificationsLinuxTest() : message_loop_(MessageLoop::TYPE_IO), - file_thread_(BrowserThread::FILE, &message_loop_) { + file_thread_(content::BrowserThread::FILE, &message_loop_) { } virtual ~MediaDeviceNotificationsLinuxTest() {} @@ -217,7 +217,7 @@ class MediaDeviceNotificationsLinuxTest : public testing::Test { // The message loop and file thread to run tests on. MessageLoop message_loop_; - BrowserThreadImpl file_thread_; + content::TestBrowserThread file_thread_; // SystemMonitor and DevicesChangedObserver to hook together to test. base::SystemMonitor system_monitor_; @@ -393,4 +393,4 @@ TEST_F(MediaDeviceNotificationsLinuxTest, MultiDevicesOneMountPoint) { } // namespace -} // namespace content +} // namespace chrome diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 15ac32c..201292c 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1303,6 +1303,8 @@ 'browser/media/media_internals.h', 'browser/media/media_stream_devices_menu_model.cc', 'browser/media/media_stream_devices_menu_model.h', + 'browser/media_gallery/media_device_notifications_linux.cc', + 'browser/media_gallery/media_device_notifications_linux.h', 'browser/media_gallery/media_gallery_database.cc', 'browser/media_gallery/media_gallery_database.h', 'browser/media_gallery/media_gallery_database_types.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index e4182f7..d91e357 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1495,6 +1495,7 @@ 'browser/language_usage_metrics_unittest.cc', 'browser/mac/keystone_glue_unittest.mm', 'browser/media/media_internals_unittest.cc', + 'browser/media_gallery/media_device_notifications_linux_unittest.cc', 'browser/media_gallery/media_gallery_database_unittest.cc', 'browser/metrics/metrics_log_unittest.cc', 'browser/metrics/metrics_log_serializer_unittest.cc', diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 87baea5..0ecec70 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -54,10 +54,6 @@ #include "net/base/winsock_init.h" #endif -#if defined(OS_LINUX) -#include "content/browser/media_device_notifications_linux.h" -#endif - #if defined(OS_LINUX) || defined(OS_OPENBSD) #include <glib-object.h> #endif @@ -594,14 +590,6 @@ void BrowserMainLoop::InitializeMainThread() { void BrowserMainLoop::BrowserThreadsStarted() { // RDH needs the IO thread to be created. resource_dispatcher_host_.reset(new ResourceDispatcherHostImpl()); - -#if defined(OS_LINUX) - // MediaDeviceNotificationsLinux needs the File Thread. - const FilePath kDefaultMtabPath("/etc/mtab"); - media_device_notifications_linux_ = - new MediaDeviceNotificationsLinux(kDefaultMtabPath); - media_device_notifications_linux_->Init(); -#endif } void BrowserMainLoop::InitializeToolkit() { diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h index 7aa0e5f..514ddf0 100644 --- a/content/browser/browser_main_loop.h +++ b/content/browser/browser_main_loop.h @@ -38,7 +38,6 @@ class BrowserMainParts; class BrowserShutdownImpl; class BrowserThreadImpl; struct MainFunctionParams; -class MediaDeviceNotificationsLinux; class ResourceDispatcherHostImpl; class WebKitThread; @@ -97,9 +96,6 @@ class BrowserMainLoop { scoped_ptr<BrowserOnlineStateObserver> online_state_observer_; #if defined(OS_WIN) scoped_ptr<SystemMessageWindowWin> system_message_window_; -#elif defined(OS_LINUX) - scoped_refptr<MediaDeviceNotificationsLinux> - media_device_notifications_linux_; #endif // Destroy parts_ before main_message_loop_ (required) and before other diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 1422f74..9fcdc1c 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -401,8 +401,6 @@ 'browser/load_from_memory_cache_details.h', 'browser/mach_broker_mac.cc', 'browser/mach_broker_mac.h', - 'browser/media_device_notifications_linux.cc', - 'browser/media_device_notifications_linux.h', 'browser/mime_registry_message_filter.cc', 'browser/mime_registry_message_filter.h', 'browser/net/browser_online_state_observer.cc', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 6ef791f..c49ec2d 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -231,7 +231,6 @@ 'browser/intents/intent_injector_unittest.cc', 'browser/intents/internal_web_intents_dispatcher_unittest.cc', 'browser/mach_broker_mac_unittest.cc', - 'browser/media_device_notifications_linux_unittest.cc', 'browser/notification_service_impl_unittest.cc', 'browser/plugin_loader_posix_unittest.cc', 'browser/renderer_host/accelerated_plugin_view_mac_unittest.mm', |