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

Unified Diff: chrome/browser/chromeos/extensions/file_browser_event_router.cc

Issue 7243012: Change many extension event routers to not be singletons and to be more profile-aware. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bookmark remove observer Created 9 years, 6 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/chromeos/extensions/file_browser_event_router.cc
diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc
index d4fb18406e33c8117b482be5f6e2735f984c8615..121cd7cb920ccb912d00aebfad5ef13eed0a47be 100644
--- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc
@@ -55,36 +55,32 @@ DictionaryValue* DiskToDictionaryValue(
return result;
}
-ExtensionFileBrowserEventRouter::ExtensionFileBrowserEventRouter()
+ExtensionFileBrowserEventRouter::ExtensionFileBrowserEventRouter(
+ Profile* profile)
: delegate_(new ExtensionFileBrowserEventRouter::FileWatcherDelegate()),
- profile_(NULL) {
+ profile_(profile) {
}
ExtensionFileBrowserEventRouter::~ExtensionFileBrowserEventRouter() {
DCHECK(file_watchers_.empty());
STLDeleteValues(&file_watchers_);
- if (!profile_)
+ if (!profile_) {
+ NOTREACHED();
return;
+ }
if (!chromeos::CrosLibrary::Get()->EnsureLoaded())
return;
chromeos::MountLibrary* lib =
chromeos::CrosLibrary::Get()->GetMountLibrary();
lib->RemoveObserver(this);
- profile_ = NULL;
-}
-
-// static
-ExtensionFileBrowserEventRouter*
- ExtensionFileBrowserEventRouter::GetInstance() {
- return Singleton<ExtensionFileBrowserEventRouter>::get();
}
-void ExtensionFileBrowserEventRouter::ObserveFileSystemEvents(
- Profile* profile) {
- if (!profile)
+void ExtensionFileBrowserEventRouter::Init() {
+ if (!profile_) {
+ NOTREACHED();
return;
- profile_ = profile;
+ }
if (!chromeos::CrosLibrary::Get()->EnsureLoaded())
return;
if (chromeos::UserManager::Get()->user_is_logged_in()) {
@@ -133,17 +129,6 @@ void ExtensionFileBrowserEventRouter::RemoveFileWatch(
}
}
-void ExtensionFileBrowserEventRouter::StopObservingFileSystemEvents() {
- if (!profile_)
- return;
- if (!chromeos::CrosLibrary::Get()->EnsureLoaded())
- return;
- chromeos::MountLibrary* lib =
- chromeos::CrosLibrary::Get()->GetMountLibrary();
- lib->RemoveObserver(this);
- profile_ = NULL;
-}
-
void ExtensionFileBrowserEventRouter::DiskChanged(
chromeos::MountLibraryEventType event,
const chromeos::MountLibrary::Disk* disk) {
« no previous file with comments | « chrome/browser/chromeos/extensions/file_browser_event_router.h ('k') | chrome/browser/extensions/extension_bookmarks_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698