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

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: Fix PrefNotifierImpl Created 8 years, 2 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 61bfd77776a57ac6ed2912a0d2231f30ef6295a1..343cc496f4c3bb50bb2e94d61ecab611016bfb79 100644
--- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc
@@ -382,39 +382,35 @@ 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_ || !profile_->GetExtensionEventRouter()) {
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) {
- profile_->GetExtensionEventRouter()->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) {
+ profile_->GetExtensionEventRouter()->DispatchEventToRenderers(
+ extensions::event_names::kOnFileBrowserPreferencesChanged,
+ scoped_ptr<ListValue>(new ListValue()), NULL, GURL());
}
}

Powered by Google App Engine
This is Rietveld 408576698