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

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

Issue 12334096: Regularize ownerships and lifecycle for storage monitor platform classes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix comment name Created 7 years, 9 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
diff --git a/chrome/browser/storage_monitor/storage_monitor_linux.cc b/chrome/browser/storage_monitor/storage_monitor_linux.cc
index 1b5457902dc031213890d8e8023ded2349cbb13d..d2ab41b0e67803c5e239f01cf814d23014867157 100644
--- a/chrome/browser/storage_monitor/storage_monitor_linux.cc
+++ b/chrome/browser/storage_monitor/storage_monitor_linux.cc
@@ -13,6 +13,7 @@
#include "base/basictypes.h"
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/metrics/histogram.h"
#include "base/stl_util.h"
@@ -20,8 +21,11 @@
#include "base/strings/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/storage_monitor/media_storage_util.h"
+#include "chrome/browser/storage_monitor/media_transfer_protocol_device_observer_linux.h"
#include "chrome/browser/storage_monitor/removable_device_constants.h"
#include "chrome/browser/storage_monitor/udev_util_linux.h"
+#include "chrome/common/chrome_switches.h"
+#include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
namespace chrome {
@@ -270,6 +274,12 @@ StorageMonitorLinux::StorageMonitorLinux(const base::FilePath& path,
StorageMonitorLinux::~StorageMonitorLinux() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&device::MediaTransferProtocolManager::Shutdown));
+ }
}
void StorageMonitorLinux::Init() {
@@ -282,6 +292,17 @@ void StorageMonitorLinux::Init() {
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
base::Bind(&StorageMonitorLinux::InitOnFileThread, this));
+
+ 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);
+
+ media_transfer_protocol_device_observer_.reset(
+ new MediaTransferProtocolDeviceObserverLinux());
+ media_transfer_protocol_device_observer_->SetNotifications(receiver());
+ }
}
bool StorageMonitorLinux::GetStorageInfoForPath(
« no previous file with comments | « chrome/browser/storage_monitor/storage_monitor_linux.h ('k') | chrome/browser/storage_monitor/storage_monitor_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698