| 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 "chrome/browser/chrome_browser_main_linux.h" | 5 #include "chrome/browser/chrome_browser_main_linux.h" |
| 6 | 6 |
| 7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
| 8 #include "chrome/browser/storage_monitor/media_transfer_protocol_device_observer
_linux.h" | 8 #include "chrome/browser/storage_monitor/media_transfer_protocol_device_observer
_linux.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" | 10 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
| 11 | 11 |
| 12 #if !defined(OS_CHROMEOS) | 12 #if !defined(OS_CHROMEOS) |
| 13 #include "chrome/browser/storage_monitor/removable_device_notifications_linux.h" | 13 #include "chrome/browser/storage_monitor/storage_monitor_linux.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 #if defined(USE_LINUX_BREAKPAD) | 17 #if defined(USE_LINUX_BREAKPAD) |
| 18 #include <stdlib.h> | 18 #include <stdlib.h> |
| 19 | 19 |
| 20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| 21 #include "base/linux_util.h" | 21 #include "base/linux_util.h" |
| 22 #include "base/prefs/pref_service.h" | 22 #include "base/prefs/pref_service.h" |
| 23 #include "chrome/app/breakpad_linux.h" | 23 #include "chrome/app/breakpad_linux.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 FROM_HERE, | 126 FROM_HERE, |
| 127 base::Bind(&GetLinuxDistroCallback)); | 127 base::Bind(&GetLinuxDistroCallback)); |
| 128 #endif | 128 #endif |
| 129 | 129 |
| 130 if (IsCrashReportingEnabled(local_state())) | 130 if (IsCrashReportingEnabled(local_state())) |
| 131 InitCrashReporter(); | 131 InitCrashReporter(); |
| 132 #endif | 132 #endif |
| 133 | 133 |
| 134 #if !defined(OS_CHROMEOS) | 134 #if !defined(OS_CHROMEOS) |
| 135 const base::FilePath kDefaultMtabPath("/etc/mtab"); | 135 const base::FilePath kDefaultMtabPath("/etc/mtab"); |
| 136 removable_device_notifications_linux_ = | 136 storage_monitor_ = new chrome::StorageMonitorLinux(kDefaultMtabPath); |
| 137 new chrome::RemovableDeviceNotificationsLinux(kDefaultMtabPath); | 137 storage_monitor_->Init(); |
| 138 removable_device_notifications_linux_->Init(); | |
| 139 #endif | 138 #endif |
| 140 | 139 |
| 141 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { | 140 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { |
| 142 scoped_refptr<base::MessageLoopProxy> loop_proxy; | 141 scoped_refptr<base::MessageLoopProxy> loop_proxy; |
| 143 #if !defined(OS_CHROMEOS) | 142 #if !defined(OS_CHROMEOS) |
| 144 loop_proxy = content::BrowserThread::GetMessageLoopProxyForThread( | 143 loop_proxy = content::BrowserThread::GetMessageLoopProxyForThread( |
| 145 content::BrowserThread::FILE); | 144 content::BrowserThread::FILE); |
| 146 #endif | 145 #endif |
| 147 device::MediaTransferProtocolManager::Initialize(loop_proxy); | 146 device::MediaTransferProtocolManager::Initialize(loop_proxy); |
| 148 initialized_media_transfer_protocol_manager_ = true; | 147 initialized_media_transfer_protocol_manager_ = true; |
| 149 } | 148 } |
| 150 | 149 |
| 151 ChromeBrowserMainPartsPosix::PreProfileInit(); | 150 ChromeBrowserMainPartsPosix::PreProfileInit(); |
| 152 } | 151 } |
| 153 | 152 |
| 154 void ChromeBrowserMainPartsLinux::PostProfileInit() { | 153 void ChromeBrowserMainPartsLinux::PostProfileInit() { |
| 155 // TODO(gbillock): Make this owned by RemovableDeviceNotificationsLinux. | 154 // TODO(gbillock): Make this owned by StorageMonitorLinux. |
| 156 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { | 155 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { |
| 157 media_transfer_protocol_device_observer_.reset( | 156 media_transfer_protocol_device_observer_.reset( |
| 158 new chrome::MediaTransferProtocolDeviceObserverLinux()); | 157 new chrome::MediaTransferProtocolDeviceObserverLinux()); |
| 159 media_transfer_protocol_device_observer_->SetNotifications( | 158 media_transfer_protocol_device_observer_->SetNotifications( |
| 160 chrome::StorageMonitor::GetInstance()->receiver()); | 159 chrome::StorageMonitor::GetInstance()->receiver()); |
| 161 } | 160 } |
| 162 | 161 |
| 163 ChromeBrowserMainPartsPosix::PostProfileInit(); | 162 ChromeBrowserMainPartsPosix::PostProfileInit(); |
| 164 } | 163 } |
| 165 | 164 |
| 166 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { | 165 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { |
| 167 #if !defined(OS_CHROMEOS) | 166 #if !defined(OS_CHROMEOS) |
| 168 // Release it now. Otherwise the FILE thread would be gone when we try to | 167 // Release it now. Otherwise the FILE thread would be gone when we try to |
| 169 // release it in the dtor and Valgrind would report a leak on almost ever | 168 // release it in the dtor and Valgrind would report a leak on almost ever |
| 170 // single browser_test. | 169 // single browser_test. |
| 171 removable_device_notifications_linux_ = NULL; | 170 storage_monitor_ = NULL; |
| 172 #endif | 171 #endif |
| 173 | 172 |
| 174 media_transfer_protocol_device_observer_.reset(); | 173 media_transfer_protocol_device_observer_.reset(); |
| 175 | 174 |
| 176 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); | 175 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); |
| 177 } | 176 } |
| OLD | NEW |