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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 InitCrashReporter(); | 132 InitCrashReporter(); |
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 device::MediaTransferProtocolManager::Initialize(); | 142 scoped_refptr<base::MessageLoopProxy> loop_proxy; |
| 143 #if !defined(OS_CHROMEOS) |
| 144 loop_proxy = content::BrowserThread::GetMessageLoopProxyForThread( |
| 145 content::BrowserThread::FILE); |
| 146 #endif |
| 147 device::MediaTransferProtocolManager::Initialize(loop_proxy); |
142 | 148 |
143 did_pre_profile_init_ = true; | 149 did_pre_profile_init_ = true; |
144 | 150 |
145 ChromeBrowserMainPartsPosix::PreProfileInit(); | 151 ChromeBrowserMainPartsPosix::PreProfileInit(); |
146 } | 152 } |
147 | 153 |
148 void ChromeBrowserMainPartsLinux::PostProfileInit() { | 154 void ChromeBrowserMainPartsLinux::PostProfileInit() { |
149 media_transfer_protocol_device_observer_.reset( | 155 media_transfer_protocol_device_observer_.reset( |
150 new chrome::MediaTransferProtocolDeviceObserverLinux()); | 156 new chrome::MediaTransferProtocolDeviceObserverLinux()); |
151 | 157 |
152 ChromeBrowserMainPartsPosix::PostProfileInit(); | 158 ChromeBrowserMainPartsPosix::PostProfileInit(); |
153 } | 159 } |
154 | 160 |
155 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { | 161 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { |
156 #if !defined(OS_CHROMEOS) | 162 #if !defined(OS_CHROMEOS) |
157 // Release it now. Otherwise the FILE thread would be gone when we try to | 163 // Release it now. Otherwise the FILE thread would be gone when we try to |
158 // release it in the dtor and Valgrind would report a leak on almost ever | 164 // release it in the dtor and Valgrind would report a leak on almost ever |
159 // single browser_test. | 165 // single browser_test. |
160 removable_device_notifications_linux_ = NULL; | 166 removable_device_notifications_linux_ = NULL; |
161 #endif | 167 #endif |
162 | 168 |
163 media_transfer_protocol_device_observer_.reset(); | 169 media_transfer_protocol_device_observer_.reset(); |
164 | 170 |
165 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); | 171 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); |
166 } | 172 } |
OLD | NEW |