summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chrome_browser_main_linux.cc
diff options
context:
space:
mode:
authorgbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-19 20:23:27 +0000
committergbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-19 20:23:27 +0000
commit6d7ba1a4b427c9bacbd4ca9fc07d7c934fc45165 (patch)
treea42d60dc198baac0b4d2496d5c128bee5edab4d3 /chrome/browser/chrome_browser_main_linux.cc
parentb38fccb1e7d99a2e25ad77cd5ab8a61252b7ad24 (diff)
downloadchromium_src-6d7ba1a4b427c9bacbd4ca9fc07d7c934fc45165.zip
chromium_src-6d7ba1a4b427c9bacbd4ca9fc07d7c934fc45165.tar.gz
chromium_src-6d7ba1a4b427c9bacbd4ca9fc07d7c934fc45165.tar.bz2
Regularize ownerships and lifecycle for storage monitor platform classes.
This change regularizes the construction lifecycle of the StorageMonitor implementations so that they always exist for the construction of the Profile, but don't issue any notifications until after that construction is complete. This allows profile-based listeners to be sure they're synchronized with the monitor. It also regularizes ownership of all storage-monitor-related objects. The base platform-specific object is owned by the ChromeBrowserMain object, and owns all subsidiary platform-specific objects needed to monitor and/or deal with volumes of various types (i.e. MTP). R=vandebo@chromium.org BUG=None Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=187332 Review URL: https://chromiumcodereview.appspot.com/12334096 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_browser_main_linux.cc')
-rw-r--r--chrome/browser/chrome_browser_main_linux.cc34
1 files changed, 5 insertions, 29 deletions
diff --git a/chrome/browser/chrome_browser_main_linux.cc b/chrome/browser/chrome_browser_main_linux.cc
index 4f5c48a..c15d05d 100644
--- a/chrome/browser/chrome_browser_main_linux.cc
+++ b/chrome/browser/chrome_browser_main_linux.cc
@@ -4,11 +4,6 @@
#include "chrome/browser/chrome_browser_main_linux.h"
-#include "base/message_loop_proxy.h"
-#include "chrome/browser/storage_monitor/media_transfer_protocol_device_observer_linux.h"
-#include "chrome/common/chrome_switches.h"
-#include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
-
#if !defined(OS_CHROMEOS)
#include "chrome/browser/storage_monitor/storage_monitor_linux.h"
#include "content/public/browser/browser_thread.h"
@@ -21,6 +16,7 @@
#include "base/linux_util.h"
#include "base/prefs/pref_service.h"
#include "chrome/app/breakpad_linux.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/env_vars.h"
#include "chrome/common/pref_names.h"
@@ -108,13 +104,10 @@ bool IsCrashReportingEnabled(const PrefService* local_state) {
ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux(
const content::MainFunctionParams& parameters)
- : ChromeBrowserMainPartsPosix(parameters),
- initialized_media_transfer_protocol_manager_(false) {
+ : ChromeBrowserMainPartsPosix(parameters) {
}
ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() {
- if (initialized_media_transfer_protocol_manager_)
- device::MediaTransferProtocolManager::Shutdown();
}
void ChromeBrowserMainPartsLinux::PreProfileInit() {
@@ -134,30 +127,15 @@ void ChromeBrowserMainPartsLinux::PreProfileInit() {
#if !defined(OS_CHROMEOS)
const base::FilePath kDefaultMtabPath("/etc/mtab");
storage_monitor_ = new chrome::StorageMonitorLinux(kDefaultMtabPath);
- storage_monitor_->Init();
#endif
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
- scoped_refptr<base::MessageLoopProxy> loop_proxy;
-#if !defined(OS_CHROMEOS)
- loop_proxy = content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::FILE);
-#endif
- device::MediaTransferProtocolManager::Initialize(loop_proxy);
- initialized_media_transfer_protocol_manager_ = true;
- }
-
ChromeBrowserMainPartsPosix::PreProfileInit();
}
void ChromeBrowserMainPartsLinux::PostProfileInit() {
- // TODO(gbillock): Make this owned by StorageMonitorLinux.
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
- media_transfer_protocol_device_observer_.reset(
- new chrome::MediaTransferProtocolDeviceObserverLinux());
- media_transfer_protocol_device_observer_->SetNotifications(
- chrome::StorageMonitor::GetInstance()->receiver());
- }
+#if !defined(OS_CHROMEOS)
+ storage_monitor_->Init();
+#endif
ChromeBrowserMainPartsPosix::PostProfileInit();
}
@@ -170,7 +148,5 @@ void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() {
storage_monitor_ = NULL;
#endif
- media_transfer_protocol_device_observer_.reset();
-
ChromeBrowserMainPartsPosix::PostMainMessageLoopRun();
}