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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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 430e6f41589444efc8f5640c12f30dfeb00ff860..c4304333d8ccba8ab1f0d6c8806901d3a0a64916 100644
--- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc
@@ -385,41 +385,37 @@ void FileBrowserEventRouter::OnNetworkManagerChanged(
scoped_ptr<ListValue>(new ListValue()), NULL, GURL());
}
-void FileBrowserEventRouter::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
+void FileBrowserEventRouter::OnPreferenceChanged(PrefServiceBase* service,
+ const std::string& pref_name) {
if (!profile_ ||
!extensions::ExtensionSystem::Get(profile_)->event_router()) {
NOTREACHED();
return;
}
- if (type == chrome::NOTIFICATION_PREF_CHANGED) {
- std::string* pref_name = content::Details<std::string>(details).ptr();
- // If the policy just got disabled we have to unmount every device currently
- // mounted. The opposite is fine - we can let the user re-plug her device to
- // make it available.
- if (*pref_name == prefs::kExternalStorageDisabled &&
- profile_->GetPrefs()->GetBoolean(prefs::kExternalStorageDisabled)) {
- DiskMountManager* manager = DiskMountManager::GetInstance();
- DiskMountManager::MountPointMap mounts(manager->mount_points());
- for (DiskMountManager::MountPointMap::const_iterator it = mounts.begin();
- it != mounts.end(); ++it) {
- LOG(INFO) << "Unmounting " << it->second.mount_path
- << " because of policy.";
- manager->UnmountPath(it->second.mount_path,
- chromeos::UNMOUNT_OPTIONS_NONE);
- }
- return;
- } else if (*pref_name == prefs::kDisableDriveOverCellular ||
- *pref_name == prefs::kDisableDriveHostedFiles ||
- *pref_name == prefs::kDisableDrive ||
- *pref_name == prefs::kUse24HourClock) {
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToRenderers(
- extensions::event_names::kOnFileBrowserPreferencesChanged,
- scoped_ptr<ListValue>(new ListValue()), NULL, GURL());
+
+ // If the policy just got disabled we have to unmount every device currently
+ // mounted. The opposite is fine - we can let the user re-plug her device to
+ // make it available.
+ if (pref_name == prefs::kExternalStorageDisabled &&
+ profile_->GetPrefs()->GetBoolean(prefs::kExternalStorageDisabled)) {
+ DiskMountManager* manager = DiskMountManager::GetInstance();
+ DiskMountManager::MountPointMap mounts(manager->mount_points());
+ for (DiskMountManager::MountPointMap::const_iterator it = mounts.begin();
+ it != mounts.end(); ++it) {
+ LOG(INFO) << "Unmounting " << it->second.mount_path
+ << " because of policy.";
+ manager->UnmountPath(it->second.mount_path,
+ chromeos::UNMOUNT_OPTIONS_NONE);
}
+ return;
+ } else if (pref_name == prefs::kDisableDriveOverCellular ||
+ pref_name == prefs::kDisableDriveHostedFiles ||
+ pref_name == prefs::kDisableDrive ||
+ pref_name == prefs::kUse24HourClock) {
+ extensions::ExtensionSystem::Get(profile_)->event_router()->
+ DispatchEventToRenderers(
+ extensions::event_names::kOnFileBrowserPreferencesChanged,
+ scoped_ptr<ListValue>(new ListValue()), NULL, GURL());
}
}

Powered by Google App Engine
This is Rietveld 408576698