Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Side by Side Diff: chrome/browser/chrome_browser_main_linux.cc

Issue 12082017: Remove dependencies to 'chrome' from device/media_transfer_protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comment Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chrome_browser_main_linux.h ('k') | device/media_transfer_protocol/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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" 8 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
9 9
10 #if !defined(OS_CHROMEOS) 10 #if !defined(OS_CHROMEOS)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 return breakpad_enabled; 103 return breakpad_enabled;
104 } 104 }
105 #endif // defined(USE_LINUX_BREAKPAD) 105 #endif // defined(USE_LINUX_BREAKPAD)
106 106
107 } // namespace 107 } // namespace
108 108
109 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( 109 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux(
110 const content::MainFunctionParams& parameters) 110 const content::MainFunctionParams& parameters)
111 : ChromeBrowserMainPartsPosix(parameters), 111 : ChromeBrowserMainPartsPosix(parameters),
112 did_pre_profile_init_(false) { 112 initialized_media_transfer_protocol_manager_(false) {
113 } 113 }
114 114
115 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { 115 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() {
116 if (did_pre_profile_init_) 116 if (initialized_media_transfer_protocol_manager_)
117 device::MediaTransferProtocolManager::Shutdown(); 117 device::MediaTransferProtocolManager::Shutdown();
118 } 118 }
119 119
120 void ChromeBrowserMainPartsLinux::PreProfileInit() { 120 void ChromeBrowserMainPartsLinux::PreProfileInit() {
121 #if defined(USE_LINUX_BREAKPAD) 121 #if defined(USE_LINUX_BREAKPAD)
122 #if !defined(OS_CHROMEOS) 122 #if !defined(OS_CHROMEOS)
123 // Needs to be called after we have chrome::DIR_USER_DATA and 123 // Needs to be called after we have chrome::DIR_USER_DATA and
124 // g_browser_process. This happens in PreCreateThreads. 124 // g_browser_process. This happens in PreCreateThreads.
125 content::BrowserThread::PostTask(content::BrowserThread::FILE, 125 content::BrowserThread::PostTask(content::BrowserThread::FILE,
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 FilePath kDefaultMtabPath("/etc/mtab"); 135 const FilePath kDefaultMtabPath("/etc/mtab");
136 removable_device_notifications_linux_ = 136 removable_device_notifications_linux_ =
137 new chrome::RemovableDeviceNotificationsLinux(kDefaultMtabPath); 137 new chrome::RemovableDeviceNotificationsLinux(kDefaultMtabPath);
138 removable_device_notifications_linux_->Init(); 138 removable_device_notifications_linux_->Init();
139 #endif 139 #endif
140 140
141 device::MediaTransferProtocolManager::Initialize(); 141 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
142 142 device::MediaTransferProtocolManager::Initialize();
143 did_pre_profile_init_ = true; 143 initialized_media_transfer_protocol_manager_ = true;
144 }
144 145
145 ChromeBrowserMainPartsPosix::PreProfileInit(); 146 ChromeBrowserMainPartsPosix::PreProfileInit();
146 } 147 }
147 148
148 void ChromeBrowserMainPartsLinux::PostProfileInit() { 149 void ChromeBrowserMainPartsLinux::PostProfileInit() {
149 media_transfer_protocol_device_observer_.reset( 150 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
150 new chrome::MediaTransferProtocolDeviceObserverLinux()); 151 media_transfer_protocol_device_observer_.reset(
152 new chrome::MediaTransferProtocolDeviceObserverLinux());
153 }
151 154
152 ChromeBrowserMainPartsPosix::PostProfileInit(); 155 ChromeBrowserMainPartsPosix::PostProfileInit();
153 } 156 }
154 157
155 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { 158 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() {
156 #if !defined(OS_CHROMEOS) 159 #if !defined(OS_CHROMEOS)
157 // Release it now. Otherwise the FILE thread would be gone when we try to 160 // 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 161 // release it in the dtor and Valgrind would report a leak on almost ever
159 // single browser_test. 162 // single browser_test.
160 removable_device_notifications_linux_ = NULL; 163 removable_device_notifications_linux_ = NULL;
161 #endif 164 #endif
162 165
163 media_transfer_protocol_device_observer_.reset(); 166 media_transfer_protocol_device_observer_.reset();
164 167
165 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); 168 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun();
166 } 169 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_linux.h ('k') | device/media_transfer_protocol/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698