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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/event_router.cc

Issue 23684042: Eliminate NetworkManagerChanged (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_change_registrar.h" 10 #include "base/prefs/pref_change_registrar.h"
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 501 }
502 } 502 }
503 } 503 }
504 504
505 void EventRouter::OnFormatEvent(DiskMountManager::FormatEvent event, 505 void EventRouter::OnFormatEvent(DiskMountManager::FormatEvent event,
506 chromeos::FormatError error_code, 506 chromeos::FormatError error_code,
507 const std::string& device_path) { 507 const std::string& device_path) {
508 // Format event is dispatched by VolumeManager now. Do nothing. 508 // Format event is dispatched by VolumeManager now. Do nothing.
509 } 509 }
510 510
511 void EventRouter::NetworkManagerChanged() { 511 void EventRouter::DefaultNetworkChanged(const chromeos::NetworkState* network) {
512 if (!profile_ || 512 if (!profile_ ||
513 !extensions::ExtensionSystem::Get(profile_)->event_router()) { 513 !extensions::ExtensionSystem::Get(profile_)->event_router()) {
514 NOTREACHED(); 514 NOTREACHED();
515 return; 515 return;
516 } 516 }
517 517
518 BroadcastEvent( 518 BroadcastEvent(
519 profile_, 519 profile_,
520 extensions::event_names::kOnFileBrowserDriveConnectionStatusChanged, 520 extensions::event_names::kOnFileBrowserDriveConnectionStatusChanged,
521 make_scoped_ptr(new ListValue)); 521 make_scoped_ptr(new ListValue));
522 } 522 }
523 523
524 void EventRouter::DefaultNetworkChanged(const chromeos::NetworkState* network) {
525 NetworkManagerChanged();
526 }
527
528 void EventRouter::OnExternalStorageDisabledChanged() { 524 void EventRouter::OnExternalStorageDisabledChanged() {
529 // If the policy just got disabled we have to unmount every device currently 525 // If the policy just got disabled we have to unmount every device currently
530 // mounted. The opposite is fine - we can let the user re-plug her device to 526 // mounted. The opposite is fine - we can let the user re-plug her device to
531 // make it available. 527 // make it available.
532 if (profile_->GetPrefs()->GetBoolean(prefs::kExternalStorageDisabled)) { 528 if (profile_->GetPrefs()->GetBoolean(prefs::kExternalStorageDisabled)) {
533 DiskMountManager* manager = DiskMountManager::GetInstance(); 529 DiskMountManager* manager = DiskMountManager::GetInstance();
534 DiskMountManager::MountPointMap mounts(manager->mount_points()); 530 DiskMountManager::MountPointMap mounts(manager->mount_points());
535 for (DiskMountManager::MountPointMap::const_iterator it = mounts.begin(); 531 for (DiskMountManager::MountPointMap::const_iterator it = mounts.begin();
536 it != mounts.end(); ++it) { 532 it != mounts.end(); ++it) {
537 LOG(INFO) << "Unmounting " << it->second.mount_path 533 LOG(INFO) << "Unmounting " << it->second.mount_path
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 base::TimeDelta::FromSeconds(4)); 868 base::TimeDelta::FromSeconds(4));
873 } else { 869 } else {
874 notifications_->HideNotification(DesktopNotifications::FORMAT_START, 870 notifications_->HideNotification(DesktopNotifications::FORMAT_START,
875 device_path); 871 device_path);
876 notifications_->ShowNotification(DesktopNotifications::FORMAT_FAIL, 872 notifications_->ShowNotification(DesktopNotifications::FORMAT_FAIL,
877 device_path); 873 device_path);
878 } 874 }
879 } 875 }
880 876
881 } // namespace file_manager 877 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698