| 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 iter->second->RemoveExtension(extension_id); | 405 iter->second->RemoveExtension(extension_id); |
| 406 if (iter->second->GetExtensionIds().empty()) { | 406 if (iter->second->GetExtensionIds().empty()) { |
| 407 delete iter->second; | 407 delete iter->second; |
| 408 file_watchers_.erase(iter); | 408 file_watchers_.erase(iter); |
| 409 } | 409 } |
| 410 } | 410 } |
| 411 | 411 |
| 412 void EventRouter::OnCopyCompleted(int copy_id, | 412 void EventRouter::OnCopyCompleted(int copy_id, |
| 413 const GURL& source_url, | 413 const GURL& source_url, |
| 414 const GURL& destination_url, | 414 const GURL& destination_url, |
| 415 base::PlatformFileError error) { | 415 base::File::Error error) { |
| 416 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 416 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 417 | 417 |
| 418 file_browser_private::CopyProgressStatus status; | 418 file_browser_private::CopyProgressStatus status; |
| 419 if (error == base::PLATFORM_FILE_OK) { | 419 if (error == base::File::FILE_OK) { |
| 420 // Send success event. | 420 // Send success event. |
| 421 status.type = file_browser_private::COPY_PROGRESS_STATUS_TYPE_SUCCESS; | 421 status.type = file_browser_private::COPY_PROGRESS_STATUS_TYPE_SUCCESS; |
| 422 status.source_url.reset(new std::string(source_url.spec())); | 422 status.source_url.reset(new std::string(source_url.spec())); |
| 423 status.destination_url.reset(new std::string(destination_url.spec())); | 423 status.destination_url.reset(new std::string(destination_url.spec())); |
| 424 } else { | 424 } else { |
| 425 // Send error event. | 425 // Send error event. |
| 426 status.type = file_browser_private::COPY_PROGRESS_STATUS_TYPE_ERROR; | 426 status.type = file_browser_private::COPY_PROGRESS_STATUS_TYPE_ERROR; |
| 427 status.error.reset( | 427 status.error.reset( |
| 428 new int(fileapi::PlatformFileErrorToWebFileError(error))); | 428 new int(fileapi::FileErrorToWebFileError(error))); |
| 429 } | 429 } |
| 430 | 430 |
| 431 BroadcastEvent( | 431 BroadcastEvent( |
| 432 profile_, | 432 profile_, |
| 433 file_browser_private::OnCopyProgress::kEventName, | 433 file_browser_private::OnCopyProgress::kEventName, |
| 434 file_browser_private::OnCopyProgress::Create(copy_id, status)); | 434 file_browser_private::OnCopyProgress::Create(copy_id, status)); |
| 435 } | 435 } |
| 436 | 436 |
| 437 void EventRouter::OnCopyProgress( | 437 void EventRouter::OnCopyProgress( |
| 438 int copy_id, | 438 int copy_id, |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 void EventRouter::OnFormatCompleted(const std::string& device_path, | 781 void EventRouter::OnFormatCompleted(const std::string& device_path, |
| 782 bool success) { | 782 bool success) { |
| 783 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 783 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 784 DispatchDeviceEvent(success ? | 784 DispatchDeviceEvent(success ? |
| 785 file_browser_private::DEVICE_EVENT_TYPE_FORMAT_SUCCESS : | 785 file_browser_private::DEVICE_EVENT_TYPE_FORMAT_SUCCESS : |
| 786 file_browser_private::DEVICE_EVENT_TYPE_FORMAT_FAIL, | 786 file_browser_private::DEVICE_EVENT_TYPE_FORMAT_FAIL, |
| 787 device_path); | 787 device_path); |
| 788 } | 788 } |
| 789 | 789 |
| 790 } // namespace file_manager | 790 } // namespace file_manager |
| OLD | NEW |