| OLD | NEW |
| 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 status.url.reset(new std::string(url.spec())); | 504 status.url.reset(new std::string(url.spec())); |
| 505 if (type == fileapi::FileSystemOperation::PROGRESS) | 505 if (type == fileapi::FileSystemOperation::PROGRESS) |
| 506 status.size.reset(new double(size)); | 506 status.size.reset(new double(size)); |
| 507 | 507 |
| 508 BroadcastEvent( | 508 BroadcastEvent( |
| 509 profile_, | 509 profile_, |
| 510 extensions::event_names::kOnFileBrowserCopyProgress, | 510 extensions::event_names::kOnFileBrowserCopyProgress, |
| 511 file_browser_private::OnCopyProgress::Create(copy_id, status)); | 511 file_browser_private::OnCopyProgress::Create(copy_id, status)); |
| 512 } | 512 } |
| 513 | 513 |
| 514 void EventRouter::NetworkManagerChanged() { | 514 void EventRouter::DefaultNetworkChanged(const chromeos::NetworkState* network) { |
| 515 if (!profile_ || | 515 if (!profile_ || |
| 516 !extensions::ExtensionSystem::Get(profile_)->event_router()) { | 516 !extensions::ExtensionSystem::Get(profile_)->event_router()) { |
| 517 NOTREACHED(); | 517 NOTREACHED(); |
| 518 return; | 518 return; |
| 519 } | 519 } |
| 520 | 520 |
| 521 BroadcastEvent( | 521 BroadcastEvent( |
| 522 profile_, | 522 profile_, |
| 523 extensions::event_names::kOnFileBrowserDriveConnectionStatusChanged, | 523 extensions::event_names::kOnFileBrowserDriveConnectionStatusChanged, |
| 524 make_scoped_ptr(new ListValue)); | 524 make_scoped_ptr(new ListValue)); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void EventRouter::DefaultNetworkChanged(const chromeos::NetworkState* network) { | |
| 528 NetworkManagerChanged(); | |
| 529 } | |
| 530 | |
| 531 void EventRouter::OnFileManagerPrefsChanged() { | 527 void EventRouter::OnFileManagerPrefsChanged() { |
| 532 if (!profile_ || | 528 if (!profile_ || |
| 533 !extensions::ExtensionSystem::Get(profile_)->event_router()) { | 529 !extensions::ExtensionSystem::Get(profile_)->event_router()) { |
| 534 NOTREACHED(); | 530 NOTREACHED(); |
| 535 return; | 531 return; |
| 536 } | 532 } |
| 537 | 533 |
| 538 BroadcastEvent( | 534 BroadcastEvent( |
| 539 profile_, | 535 profile_, |
| 540 extensions::event_names::kOnFileBrowserPreferencesChanged, | 536 extensions::event_names::kOnFileBrowserPreferencesChanged, |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 base::TimeDelta::FromSeconds(4)); | 813 base::TimeDelta::FromSeconds(4)); |
| 818 } else { | 814 } else { |
| 819 notifications_->HideNotification(DesktopNotifications::FORMAT_START, | 815 notifications_->HideNotification(DesktopNotifications::FORMAT_START, |
| 820 device_path); | 816 device_path); |
| 821 notifications_->ShowNotification(DesktopNotifications::FORMAT_FAIL, | 817 notifications_->ShowNotification(DesktopNotifications::FORMAT_FAIL, |
| 822 device_path); | 818 device_path); |
| 823 } | 819 } |
| 824 } | 820 } |
| 825 | 821 |
| 826 } // namespace file_manager | 822 } // namespace file_manager |
| OLD | NEW |