| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 status.type = file_manager_private::COPY_PROGRESS_STATUS_TYPE_ERROR; | 526 status.type = file_manager_private::COPY_PROGRESS_STATUS_TYPE_ERROR; |
| 527 status.error.reset(new std::string(FileErrorToErrorName(error))); | 527 status.error.reset(new std::string(FileErrorToErrorName(error))); |
| 528 } | 528 } |
| 529 | 529 |
| 530 BroadcastEvent( | 530 BroadcastEvent( |
| 531 profile_, | 531 profile_, |
| 532 file_manager_private::OnCopyProgress::kEventName, | 532 file_manager_private::OnCopyProgress::kEventName, |
| 533 file_manager_private::OnCopyProgress::Create(copy_id, status)); | 533 file_manager_private::OnCopyProgress::Create(copy_id, status)); |
| 534 } | 534 } |
| 535 | 535 |
| 536 void EventRouter::OnCopyError(int copy_id, |
| 537 const GURL& source_url, |
| 538 const GURL& destination_url) { |
| 539 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 540 |
| 541 BroadcastEvent(profile_, file_manager_private::OnCopyError::kEventName, |
| 542 file_manager_private::OnCopyError::Create( |
| 543 copy_id, source_url.spec(), destination_url.spec())); |
| 544 } |
| 545 |
| 536 void EventRouter::OnCopyProgress( | 546 void EventRouter::OnCopyProgress( |
| 537 int copy_id, | 547 int copy_id, |
| 538 storage::FileSystemOperation::CopyProgressType type, | 548 storage::FileSystemOperation::CopyProgressType type, |
| 539 const GURL& source_url, | 549 const GURL& source_url, |
| 540 const GURL& destination_url, | 550 const GURL& destination_url, |
| 541 int64 size) { | 551 int64 size) { |
| 542 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 552 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 543 | 553 |
| 544 file_manager_private::CopyProgressStatus status; | 554 file_manager_private::CopyProgressStatus status; |
| 545 status.type = CopyProgressTypeToCopyProgressStatusType(type); | 555 status.type = CopyProgressTypeToCopyProgressStatusType(type); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( | 928 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( |
| 919 const DispatchDirectoryChangeEventImplCallback& callback) { | 929 const DispatchDirectoryChangeEventImplCallback& callback) { |
| 920 dispatch_directory_change_event_impl_ = callback; | 930 dispatch_directory_change_event_impl_ = callback; |
| 921 } | 931 } |
| 922 | 932 |
| 923 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { | 933 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { |
| 924 return weak_factory_.GetWeakPtr(); | 934 return weak_factory_.GetWeakPtr(); |
| 925 } | 935 } |
| 926 | 936 |
| 927 } // namespace file_manager | 937 } // namespace file_manager |
| OLD | NEW |