| 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 "chrome/browser/media_transfer_protocol/media_transfer_protocol_manager
.h" | |
| 8 #include "chrome/browser/system_monitor/media_transfer_protocol_device_observer_
linux.h" | 7 #include "chrome/browser/system_monitor/media_transfer_protocol_device_observer_
linux.h" |
| 8 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
| 9 | 9 |
| 10 #if !defined(OS_CHROMEOS) | 10 #if !defined(OS_CHROMEOS) |
| 11 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" | 11 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #if defined(USE_LINUX_BREAKPAD) | 14 #if defined(USE_LINUX_BREAKPAD) |
| 15 #include <stdlib.h> | 15 #include <stdlib.h> |
| 16 | 16 |
| 17 #include "base/linux_util.h" | 17 #include "base/linux_util.h" |
| 18 #include "chrome/app/breakpad_linux.h" | 18 #include "chrome/app/breakpad_linux.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } // namespace | 75 } // namespace |
| 76 | 76 |
| 77 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( | 77 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( |
| 78 const content::MainFunctionParams& parameters) | 78 const content::MainFunctionParams& parameters) |
| 79 : ChromeBrowserMainPartsPosix(parameters), | 79 : ChromeBrowserMainPartsPosix(parameters), |
| 80 did_pre_profile_init_(false) { | 80 did_pre_profile_init_(false) { |
| 81 } | 81 } |
| 82 | 82 |
| 83 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { | 83 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { |
| 84 if (did_pre_profile_init_) | 84 if (did_pre_profile_init_) |
| 85 chrome::MediaTransferProtocolManager::Shutdown(); | 85 device::MediaTransferProtocolManager::Shutdown(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void ChromeBrowserMainPartsLinux::PreProfileInit() { | 88 void ChromeBrowserMainPartsLinux::PreProfileInit() { |
| 89 #if defined(USE_LINUX_BREAKPAD) | 89 #if defined(USE_LINUX_BREAKPAD) |
| 90 #if !defined(OS_CHROMEOS) | 90 #if !defined(OS_CHROMEOS) |
| 91 // Needs to be called after we have chrome::DIR_USER_DATA and | 91 // Needs to be called after we have chrome::DIR_USER_DATA and |
| 92 // g_browser_process. This happens in PreCreateThreads. | 92 // g_browser_process. This happens in PreCreateThreads. |
| 93 content::BrowserThread::PostTask(content::BrowserThread::FILE, | 93 content::BrowserThread::PostTask(content::BrowserThread::FILE, |
| 94 FROM_HERE, | 94 FROM_HERE, |
| 95 base::Bind(&GetLinuxDistroCallback)); | 95 base::Bind(&GetLinuxDistroCallback)); |
| 96 #endif | 96 #endif |
| 97 | 97 |
| 98 if (IsCrashReportingEnabled(local_state())) | 98 if (IsCrashReportingEnabled(local_state())) |
| 99 InitCrashReporter(); | 99 InitCrashReporter(); |
| 100 #endif | 100 #endif |
| 101 | 101 |
| 102 #if !defined(OS_CHROMEOS) | 102 #if !defined(OS_CHROMEOS) |
| 103 const FilePath kDefaultMtabPath("/etc/mtab"); | 103 const FilePath kDefaultMtabPath("/etc/mtab"); |
| 104 removable_device_notifications_linux_ = | 104 removable_device_notifications_linux_ = |
| 105 new chrome::RemovableDeviceNotificationsLinux(kDefaultMtabPath); | 105 new chrome::RemovableDeviceNotificationsLinux(kDefaultMtabPath); |
| 106 removable_device_notifications_linux_->Init(); | 106 removable_device_notifications_linux_->Init(); |
| 107 #endif | 107 #endif |
| 108 | 108 |
| 109 chrome::MediaTransferProtocolManager::Initialize(); | 109 device::MediaTransferProtocolManager::Initialize(); |
| 110 | 110 |
| 111 did_pre_profile_init_ = true; | 111 did_pre_profile_init_ = true; |
| 112 | 112 |
| 113 ChromeBrowserMainPartsPosix::PreProfileInit(); | 113 ChromeBrowserMainPartsPosix::PreProfileInit(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void ChromeBrowserMainPartsLinux::PostProfileInit() { | 116 void ChromeBrowserMainPartsLinux::PostProfileInit() { |
| 117 media_transfer_protocol_device_observer_.reset( | 117 media_transfer_protocol_device_observer_.reset( |
| 118 new chrome::MediaTransferProtocolDeviceObserverLinux()); | 118 new chrome::MediaTransferProtocolDeviceObserverLinux()); |
| 119 | 119 |
| 120 ChromeBrowserMainPartsPosix::PostProfileInit(); | 120 ChromeBrowserMainPartsPosix::PostProfileInit(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { | 123 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { |
| 124 #if !defined(OS_CHROMEOS) | 124 #if !defined(OS_CHROMEOS) |
| 125 // Release it now. Otherwise the FILE thread would be gone when we try to | 125 // Release it now. Otherwise the FILE thread would be gone when we try to |
| 126 // release it in the dtor and Valgrind would report a leak on almost ever | 126 // release it in the dtor and Valgrind would report a leak on almost ever |
| 127 // single browser_test. | 127 // single browser_test. |
| 128 removable_device_notifications_linux_ = NULL; | 128 removable_device_notifications_linux_ = NULL; |
| 129 #endif | 129 #endif |
| 130 | 130 |
| 131 media_transfer_protocol_device_observer_.reset(); | 131 media_transfer_protocol_device_observer_.reset(); |
| 132 | 132 |
| 133 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); | 133 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); |
| 134 } | 134 } |
| OLD | NEW |