OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/job_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/job_event_router.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "chrome/browser/chromeos/file_manager/app_id.h" | 10 #include "chrome/browser/chromeos/file_manager/app_id.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 OnJobUpdated(job_info); | 41 OnJobUpdated(job_info); |
42 } | 42 } |
43 | 43 |
44 void JobEventRouter::OnJobUpdated(const drive::JobInfo& job_info) { | 44 void JobEventRouter::OnJobUpdated(const drive::JobInfo& job_info) { |
45 DCHECK(thread_checker_.CalledOnValidThread()); | 45 DCHECK(thread_checker_.CalledOnValidThread()); |
46 if (!drive::IsActiveFileTransferJobInfo(job_info)) | 46 if (!drive::IsActiveFileTransferJobInfo(job_info)) |
47 return; | 47 return; |
48 | 48 |
49 // Add new job info. | 49 // Add new job info. |
50 UpdateBytes(job_info); | 50 UpdateBytes(job_info); |
51 drive_jobs_[job_info.job_id] = make_linked_ptr(new drive::JobInfo(job_info)); | 51 drive_jobs_[job_info.job_id] = base::MakeUnique<drive::JobInfo>(job_info); |
52 | 52 |
53 ScheduleDriveFileTransferEvent( | 53 ScheduleDriveFileTransferEvent( |
54 job_info, file_manager_private::TRANSFER_STATE_IN_PROGRESS, | 54 job_info, file_manager_private::TRANSFER_STATE_IN_PROGRESS, |
55 false /* immediate */); | 55 false /* immediate */); |
56 } | 56 } |
57 | 57 |
58 void JobEventRouter::OnJobDone(const drive::JobInfo& job_info, | 58 void JobEventRouter::OnJobDone(const drive::JobInfo& job_info, |
59 drive::FileError error) { | 59 drive::FileError error) { |
60 DCHECK(thread_checker_.CalledOnValidThread()); | 60 DCHECK(thread_checker_.CalledOnValidThread()); |
61 if (!drive::IsActiveFileTransferJobInfo(job_info)) | 61 if (!drive::IsActiveFileTransferJobInfo(job_info)) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 status.total = num_total_bytes; | 150 status.total = num_total_bytes; |
151 | 151 |
152 DispatchEventToExtension( | 152 DispatchEventToExtension( |
153 extension_id, | 153 extension_id, |
154 extensions::events::FILE_MANAGER_PRIVATE_ON_FILE_TRANSFERS_UPDATED, | 154 extensions::events::FILE_MANAGER_PRIVATE_ON_FILE_TRANSFERS_UPDATED, |
155 file_manager_private::OnFileTransfersUpdated::kEventName, | 155 file_manager_private::OnFileTransfersUpdated::kEventName, |
156 file_manager_private::OnFileTransfersUpdated::Create(status)); | 156 file_manager_private::OnFileTransfersUpdated::Create(status)); |
157 } | 157 } |
158 | 158 |
159 } // namespace file_manager | 159 } // namespace file_manager |
OLD | NEW |