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_linux_ = |
137 new chrome::RemovableDeviceNotificationsLinux(kDefaultMtabPath); | 137 new chrome::StorageMonitorLinux(kDefaultMtabPath); |
vandebo (ex-Chrome)
2013/03/01 19:47:39
nit: line wrap.
| |
138 removable_device_notifications_linux_->Init(); | 138 storage_monitor_linux_->Init(); |
139 #endif | 139 #endif |
140 | 140 |
141 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { | 141 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { |
142 scoped_refptr<base::MessageLoopProxy> loop_proxy; | 142 scoped_refptr<base::MessageLoopProxy> loop_proxy; |
143 #if !defined(OS_CHROMEOS) | 143 #if !defined(OS_CHROMEOS) |
144 loop_proxy = content::BrowserThread::GetMessageLoopProxyForThread( | 144 loop_proxy = content::BrowserThread::GetMessageLoopProxyForThread( |
145 content::BrowserThread::FILE); | 145 content::BrowserThread::FILE); |
146 #endif | 146 #endif |
147 device::MediaTransferProtocolManager::Initialize(loop_proxy); | 147 device::MediaTransferProtocolManager::Initialize(loop_proxy); |
148 initialized_media_transfer_protocol_manager_ = true; | 148 initialized_media_transfer_protocol_manager_ = true; |
149 } | 149 } |
150 | 150 |
151 ChromeBrowserMainPartsPosix::PreProfileInit(); | 151 ChromeBrowserMainPartsPosix::PreProfileInit(); |
152 } | 152 } |
153 | 153 |
154 void ChromeBrowserMainPartsLinux::PostProfileInit() { | 154 void ChromeBrowserMainPartsLinux::PostProfileInit() { |
155 // TODO(gbillock): Make this owned by RemovableDeviceNotificationsLinux. | 155 // TODO(gbillock): Make this owned by StorageMonitorLinux. |
156 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { | 156 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { |
157 media_transfer_protocol_device_observer_.reset( | 157 media_transfer_protocol_device_observer_.reset( |
158 new chrome::MediaTransferProtocolDeviceObserverLinux()); | 158 new chrome::MediaTransferProtocolDeviceObserverLinux()); |
159 media_transfer_protocol_device_observer_->SetNotifications( | 159 media_transfer_protocol_device_observer_->SetNotifications( |
160 chrome::StorageMonitor::GetInstance()->receiver()); | 160 chrome::StorageMonitor::GetInstance()->receiver()); |
161 } | 161 } |
162 | 162 |
163 ChromeBrowserMainPartsPosix::PostProfileInit(); | 163 ChromeBrowserMainPartsPosix::PostProfileInit(); |
164 } | 164 } |
165 | 165 |
166 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { | 166 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { |
167 #if !defined(OS_CHROMEOS) | 167 #if !defined(OS_CHROMEOS) |
168 // Release it now. Otherwise the FILE thread would be gone when we try to | 168 // 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 | 169 // release it in the dtor and Valgrind would report a leak on almost ever |
170 // single browser_test. | 170 // single browser_test. |
171 removable_device_notifications_linux_ = NULL; | 171 storage_monitor_linux_ = NULL; |
172 #endif | 172 #endif |
173 | 173 |
174 media_transfer_protocol_device_observer_.reset(); | 174 media_transfer_protocol_device_observer_.reset(); |
175 | 175 |
176 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); | 176 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); |
177 } | 177 } |
OLD | NEW |