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 "chrome/browser/system_monitor/media_transfer_protocol_device_observer_
linux.h" | 8 #include "chrome/browser/system_monitor/media_transfer_protocol_device_observer_
linux.h" |
8 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" | 9 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
9 | 10 |
10 #if !defined(OS_CHROMEOS) | 11 #if !defined(OS_CHROMEOS) |
11 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" | 12 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" |
| 13 #include "content/public/browser/browser_thread.h" |
12 #endif | 14 #endif |
13 | 15 |
14 #if defined(USE_LINUX_BREAKPAD) | 16 #if defined(USE_LINUX_BREAKPAD) |
15 #include <stdlib.h> | 17 #include <stdlib.h> |
16 | 18 |
17 #include "base/command_line.h" | 19 #include "base/command_line.h" |
18 #include "base/linux_util.h" | 20 #include "base/linux_util.h" |
19 #include "chrome/app/breakpad_linux.h" | 21 #include "chrome/app/breakpad_linux.h" |
20 #include "chrome/browser/prefs/pref_service.h" | 22 #include "chrome/browser/prefs/pref_service.h" |
21 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/env_vars.h" | 24 #include "chrome/common/env_vars.h" |
23 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
24 #include "content/public/browser/browser_thread.h" | |
25 | 26 |
26 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
27 #include "chrome/browser/chromeos/settings/cros_settings.h" | 28 #include "chrome/browser/chromeos/settings/cros_settings.h" |
28 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 29 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
29 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/chrome_version_info.h" | 31 #include "chrome/common/chrome_version_info.h" |
31 #endif | 32 #endif |
32 | 33 |
33 #endif // defined(USE_LINUX_BREAKPAD) | 34 #endif // defined(USE_LINUX_BREAKPAD) |
34 | 35 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 #endif | 133 #endif |
133 | 134 |
134 #if !defined(OS_CHROMEOS) | 135 #if !defined(OS_CHROMEOS) |
135 const FilePath kDefaultMtabPath("/etc/mtab"); | 136 const FilePath kDefaultMtabPath("/etc/mtab"); |
136 removable_device_notifications_linux_ = | 137 removable_device_notifications_linux_ = |
137 new chrome::RemovableDeviceNotificationsLinux(kDefaultMtabPath); | 138 new chrome::RemovableDeviceNotificationsLinux(kDefaultMtabPath); |
138 removable_device_notifications_linux_->Init(); | 139 removable_device_notifications_linux_->Init(); |
139 #endif | 140 #endif |
140 | 141 |
141 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { | 142 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { |
142 device::MediaTransferProtocolManager::Initialize(); | 143 scoped_refptr<base::MessageLoopProxy> loop_proxy; |
| 144 #if !defined(OS_CHROMEOS) |
| 145 loop_proxy = content::BrowserThread::GetMessageLoopProxyForThread( |
| 146 content::BrowserThread::FILE); |
| 147 #endif |
| 148 device::MediaTransferProtocolManager::Initialize(loop_proxy); |
143 initialized_media_transfer_protocol_manager_ = true; | 149 initialized_media_transfer_protocol_manager_ = true; |
144 } | 150 } |
145 | 151 |
146 ChromeBrowserMainPartsPosix::PreProfileInit(); | 152 ChromeBrowserMainPartsPosix::PreProfileInit(); |
147 } | 153 } |
148 | 154 |
149 void ChromeBrowserMainPartsLinux::PostProfileInit() { | 155 void ChromeBrowserMainPartsLinux::PostProfileInit() { |
150 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { | 156 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { |
151 media_transfer_protocol_device_observer_.reset( | 157 media_transfer_protocol_device_observer_.reset( |
152 new chrome::MediaTransferProtocolDeviceObserverLinux()); | 158 new chrome::MediaTransferProtocolDeviceObserverLinux()); |
153 } | 159 } |
154 | 160 |
155 ChromeBrowserMainPartsPosix::PostProfileInit(); | 161 ChromeBrowserMainPartsPosix::PostProfileInit(); |
156 } | 162 } |
157 | 163 |
158 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { | 164 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { |
159 #if !defined(OS_CHROMEOS) | 165 #if !defined(OS_CHROMEOS) |
160 // Release it now. Otherwise the FILE thread would be gone when we try to | 166 // Release it now. Otherwise the FILE thread would be gone when we try to |
161 // release it in the dtor and Valgrind would report a leak on almost ever | 167 // release it in the dtor and Valgrind would report a leak on almost ever |
162 // single browser_test. | 168 // single browser_test. |
163 removable_device_notifications_linux_ = NULL; | 169 removable_device_notifications_linux_ = NULL; |
164 #endif | 170 #endif |
165 | 171 |
166 media_transfer_protocol_device_observer_.reset(); | 172 media_transfer_protocol_device_observer_.reset(); |
167 | 173 |
168 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); | 174 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); |
169 } | 175 } |
OLD | NEW |