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

Unified Diff: chrome/browser/storage_monitor/storage_monitor_linux.cc

Issue 14016002: Storage Monitor: Make StorageMonitorLinux own the MediaTransferProtocolManager. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Rebase to ToT, still need to fix CrOS Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/storage_monitor/storage_monitor_linux.cc
===================================================================
--- chrome/browser/storage_monitor/storage_monitor_linux.cc (revision 193326)
+++ chrome/browser/storage_monitor/storage_monitor_linux.cc (working copy)
@@ -230,14 +230,17 @@
StorageMonitorLinux::StorageMonitorLinux(const base::FilePath& path)
: mtab_path_(path),
get_device_info_callback_(base::Bind(&GetDeviceInfo)),
+ use_dummy_media_transfer_protocol_manager_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
+ UseDummyMediaTransferProtocolManagerForTest();
+ }
}
StorageMonitorLinux::~StorageMonitorLinux() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType))
- device::MediaTransferProtocolManager::Shutdown();
Greg Billock 2013/04/10 18:27:25 Still need to call this, right? Or does the destru
Lei Zhang 2013/04/11 06:54:04 The dtor does it now.
}
void StorageMonitorLinux::Init() {
@@ -251,15 +254,14 @@
base::Bind(&StorageMonitorLinux::OnMtabWatcherCreated,
weak_ptr_factory_.GetWeakPtr()));
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
- scoped_refptr<base::MessageLoopProxy> loop_proxy;
- loop_proxy = content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::FILE);
- device::MediaTransferProtocolManager::Initialize(loop_proxy);
+ scoped_refptr<base::MessageLoopProxy> loop_proxy =
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE);
+ media_transfer_protocol_manager_.reset(
+ device::MediaTransferProtocolManager::Initialize(
+ loop_proxy, use_dummy_media_transfer_protocol_manager_));
media_transfer_protocol_device_observer_.reset(
new MediaTransferProtocolDeviceObserverLinux(receiver()));
- }
}
bool StorageMonitorLinux::GetStorageInfoForPath(
@@ -290,11 +292,20 @@
return true;
}
+device::MediaTransferProtocolManager*
+StorageMonitorLinux::media_transfer_protocol_manager() {
+ return media_transfer_protocol_manager_.get();
+}
+
void StorageMonitorLinux::SetGetDeviceInfoCallbackForTest(
const GetDeviceInfoCallback& get_device_info_callback) {
get_device_info_callback_ = get_device_info_callback;
}
+void StorageMonitorLinux::UseDummyMediaTransferProtocolManagerForTest() {
+ use_dummy_media_transfer_protocol_manager_ = true;
+}
+
void StorageMonitorLinux::OnMtabWatcherCreated(MtabWatcherLinux* watcher) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
mtab_watcher_.reset(watcher);

Powered by Google App Engine
This is Rietveld 408576698