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" | |
9 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
10 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" | 9 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
11 | 10 |
12 #if !defined(OS_CHROMEOS) | 11 #if !defined(OS_CHROMEOS) |
13 #include "chrome/browser/storage_monitor/removable_device_notifications_linux.h" | 12 #include "chrome/browser/storage_monitor/removable_device_notifications_linux.h" |
14 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
15 #endif | 14 #endif |
16 | 15 |
17 #if defined(USE_LINUX_BREAKPAD) | 16 #if defined(USE_LINUX_BREAKPAD) |
18 #include <stdlib.h> | 17 #include <stdlib.h> |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | |
156 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { | |
157 media_transfer_protocol_device_observer_.reset( | |
158 new chrome::MediaTransferProtocolDeviceObserverLinux()); | |
159 media_transfer_protocol_device_observer_->SetNotifications( | |
160 chrome::RemovableStorageNotifications::GetInstance()->receiver()); | |
161 } | |
162 | |
163 ChromeBrowserMainPartsPosix::PostProfileInit(); | 154 ChromeBrowserMainPartsPosix::PostProfileInit(); |
164 } | 155 } |
165 | 156 |
166 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { | 157 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { |
167 #if !defined(OS_CHROMEOS) | 158 #if !defined(OS_CHROMEOS) |
168 // Release it now. Otherwise the FILE thread would be gone when we try to | 159 // 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 | 160 // release it in the dtor and Valgrind would report a leak on almost ever |
170 // single browser_test. | 161 // single browser_test. |
171 removable_device_notifications_linux_ = NULL; | 162 removable_device_notifications_linux_ = NULL; |
172 #endif | 163 #endif |
173 | 164 |
174 media_transfer_protocol_device_observer_.reset(); | |
175 | |
176 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); | 165 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); |
177 } | 166 } |
OLD | NEW |