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

Side by Side Diff: chrome/browser/chromeos/drive/job_scheduler.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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/drive/job_scheduler.h" 5 #include "chrome/browser/chromeos/drive/job_scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 #include "chrome/browser/drive/event_logger.h" 16 #include "chrome/browser/drive/event_logger.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "components/user_manager/user_id.h"
18 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
19 #include "google_apis/drive/drive_api_parser.h" 20 #include "google_apis/drive/drive_api_parser.h"
20 21
21 using content::BrowserThread; 22 using content::BrowserThread;
22 23
23 namespace drive { 24 namespace drive {
24 25
25 namespace { 26 namespace {
26 27
27 // All jobs are retried at maximum of kMaxRetryCount when they fail due to 28 // All jobs are retried at maximum of kMaxRetryCount when they fail due to
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 params.progress_callback = base::Bind(&JobScheduler::UpdateProgress, 696 params.progress_callback = base::Bind(&JobScheduler::UpdateProgress,
696 weak_ptr_factory_.GetWeakPtr(), 697 weak_ptr_factory_.GetWeakPtr(),
697 new_job->job_info.job_id); 698 new_job->job_info.job_id);
698 new_job->task = base::Bind(&RunUploadExistingFile, uploader_.get(), params); 699 new_job->task = base::Bind(&RunUploadExistingFile, uploader_.get(), params);
699 new_job->abort_callback = CreateErrorRunCallback(callback); 700 new_job->abort_callback = CreateErrorRunCallback(callback);
700 StartJob(new_job); 701 StartJob(new_job);
701 } 702 }
702 703
703 void JobScheduler::AddPermission( 704 void JobScheduler::AddPermission(
704 const std::string& resource_id, 705 const std::string& resource_id,
705 const std::string& email, 706 const user_manager::UserID& user_id,
706 google_apis::drive::PermissionRole role, 707 google_apis::drive::PermissionRole role,
707 const google_apis::EntryActionCallback& callback) { 708 const google_apis::EntryActionCallback& callback) {
708 DCHECK_CURRENTLY_ON(BrowserThread::UI); 709 DCHECK_CURRENTLY_ON(BrowserThread::UI);
709 DCHECK(!callback.is_null()); 710 DCHECK(!callback.is_null());
710 711
711 JobEntry* new_job = CreateNewJob(TYPE_ADD_PERMISSION); 712 JobEntry* new_job = CreateNewJob(TYPE_ADD_PERMISSION);
712 new_job->task = base::Bind(&DriveServiceInterface::AddPermission, 713 new_job->task = base::Bind(&DriveServiceInterface::AddPermission,
713 base::Unretained(drive_service_), 714 base::Unretained(drive_service_),
714 resource_id, 715 resource_id,
715 email, 716 user_id,
716 role, 717 role,
717 base::Bind(&JobScheduler::OnEntryActionJobDone, 718 base::Bind(&JobScheduler::OnEntryActionJobDone,
718 weak_ptr_factory_.GetWeakPtr(), 719 weak_ptr_factory_.GetWeakPtr(),
719 new_job->job_info.job_id, 720 new_job->job_info.job_id,
720 callback)); 721 callback));
721 new_job->abort_callback = callback; 722 new_job->abort_callback = callback;
722 StartJob(new_job); 723 StartJob(new_job);
723 } 724 }
724 725
725 JobScheduler::JobEntry* JobScheduler::CreateNewJob(JobType type) { 726 JobScheduler::JobEntry* JobScheduler::CreateNewJob(JobType type) {
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 case FILE_QUEUE: 1187 case FILE_QUEUE:
1187 return "FILE_QUEUE"; 1188 return "FILE_QUEUE";
1188 case NUM_QUEUES: 1189 case NUM_QUEUES:
1189 break; // This value is just a sentinel. Should never be used. 1190 break; // This value is just a sentinel. Should never be used.
1190 } 1191 }
1191 NOTREACHED(); 1192 NOTREACHED();
1192 return ""; 1193 return "";
1193 } 1194 }
1194 1195
1195 } // namespace drive 1196 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698