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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/create_directory_operation.cc

Issue 14493009: drive: Rename DriveScheduler to JobScheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indent Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/file_system/create_directory_operation.h " 5 #include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h "
6 6
7 #include "chrome/browser/chromeos/drive/drive.pb.h" 7 #include "chrome/browser/chromeos/drive/drive.pb.h"
8 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" 8 #include "chrome/browser/chromeos/drive/drive_file_system_util.h"
9 #include "chrome/browser/chromeos/drive/drive_scheduler.h"
10 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" 9 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h"
10 #include "chrome/browser/chromeos/drive/job_scheduler.h"
11 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" 11 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
12 #include "chrome/browser/google_apis/gdata_errorcode.h" 12 #include "chrome/browser/google_apis/gdata_errorcode.h"
13 #include "chrome/browser/google_apis/gdata_wapi_parser.h" 13 #include "chrome/browser/google_apis/gdata_wapi_parser.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 15
16 using content::BrowserThread; 16 using content::BrowserThread;
17 17
18 namespace drive { 18 namespace drive {
19 namespace file_system { 19 namespace file_system {
20 20
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ~FindFirstMissingParentDirectoryParams() {} 67 ~FindFirstMissingParentDirectoryParams() {}
68 68
69 std::vector<base::FilePath::StringType> path_parts; 69 std::vector<base::FilePath::StringType> path_parts;
70 size_t index; 70 size_t index;
71 base::FilePath current_path; 71 base::FilePath current_path;
72 std::string last_dir_resource_id; 72 std::string last_dir_resource_id;
73 const FindFirstMissingParentDirectoryCallback callback; 73 const FindFirstMissingParentDirectoryCallback callback;
74 }; 74 };
75 75
76 CreateDirectoryOperation::CreateDirectoryOperation( 76 CreateDirectoryOperation::CreateDirectoryOperation(
77 DriveScheduler* drive_scheduler, 77 JobScheduler* job_scheduler,
78 DriveResourceMetadata* metadata, 78 DriveResourceMetadata* metadata,
79 OperationObserver* observer) 79 OperationObserver* observer)
80 : drive_scheduler_(drive_scheduler), 80 : job_scheduler_(job_scheduler),
81 metadata_(metadata), 81 metadata_(metadata),
82 observer_(observer), 82 observer_(observer),
83 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 83 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
85 } 85 }
86 86
87 CreateDirectoryOperation::~CreateDirectoryOperation() { 87 CreateDirectoryOperation::~CreateDirectoryOperation() {
88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
89 } 89 }
90 90
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 // Do we have a parent directory here as well? We can't then create target 137 // Do we have a parent directory here as well? We can't then create target
138 // directory if this is not a recursive operation. 138 // directory if this is not a recursive operation.
139 if (params->target_directory_path != result.first_missing_parent_path && 139 if (params->target_directory_path != result.first_missing_parent_path &&
140 !params->is_recursive) { 140 !params->is_recursive) {
141 params->callback.Run(FILE_ERROR_NOT_FOUND); 141 params->callback.Run(FILE_ERROR_NOT_FOUND);
142 return; 142 return;
143 } 143 }
144 144
145 drive_scheduler_->AddNewDirectory( 145 job_scheduler_->AddNewDirectory(
146 result.last_dir_resource_id, 146 result.last_dir_resource_id,
147 result.first_missing_parent_path.BaseName().AsUTF8Unsafe(), 147 result.first_missing_parent_path.BaseName().AsUTF8Unsafe(),
148 base::Bind(&CreateDirectoryOperation::AddNewDirectory, 148 base::Bind(&CreateDirectoryOperation::AddNewDirectory,
149 weak_ptr_factory_.GetWeakPtr(), 149 weak_ptr_factory_.GetWeakPtr(),
150 base::Passed(&params), 150 base::Passed(&params),
151 result.first_missing_parent_path)); 151 result.first_missing_parent_path));
152 } 152 }
153 153
154 void CreateDirectoryOperation::AddNewDirectory( 154 void CreateDirectoryOperation::AddNewDirectory(
155 scoped_ptr<CreateDirectoryParams> params, 155 scoped_ptr<CreateDirectoryParams> params,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } else { 270 } else {
271 // This parent exists, so recursively look at the next element. 271 // This parent exists, so recursively look at the next element.
272 params->last_dir_resource_id = entry_proto->resource_id(); 272 params->last_dir_resource_id = entry_proto->resource_id();
273 params->index++; 273 params->index++;
274 FindFirstMissingParentDirectoryInternal(params.Pass()); 274 FindFirstMissingParentDirectoryInternal(params.Pass());
275 } 275 }
276 } 276 }
277 277
278 } // namespace file_system 278 } // namespace file_system
279 } // namespace drive 279 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698