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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc

Issue 515033002: [fsp] Generalize fileBrowserPrivate.getEntryProperties(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/extensions/file_manager/private_api_drive.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 9 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" 10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h"
(...skipping 17 matching lines...) Expand all
28 #include "webkit/common/fileapi/file_system_util.h" 28 #include "webkit/common/fileapi/file_system_util.h"
29 29
30 using content::BrowserThread; 30 using content::BrowserThread;
31 31
32 using file_manager::util::EntryDefinition; 32 using file_manager::util::EntryDefinition;
33 using file_manager::util::EntryDefinitionCallback; 33 using file_manager::util::EntryDefinitionCallback;
34 using file_manager::util::EntryDefinitionList; 34 using file_manager::util::EntryDefinitionList;
35 using file_manager::util::EntryDefinitionListCallback; 35 using file_manager::util::EntryDefinitionListCallback;
36 using file_manager::util::FileDefinition; 36 using file_manager::util::FileDefinition;
37 using file_manager::util::FileDefinitionList; 37 using file_manager::util::FileDefinitionList;
38 using extensions::api::file_browser_private::DriveEntryProperties; 38 using extensions::api::file_browser_private::EntryProperties;
39 39
40 namespace extensions { 40 namespace extensions {
41 namespace { 41 namespace {
42 42
43 // List of connection types of drive. 43 // List of connection types of drive.
44 // Keep this in sync with the DriveConnectionType in common/js/util.js. 44 // Keep this in sync with the DriveConnectionType in common/js/util.js.
45 const char kDriveConnectionTypeOffline[] = "offline"; 45 const char kDriveConnectionTypeOffline[] = "offline";
46 const char kDriveConnectionTypeMetered[] = "metered"; 46 const char kDriveConnectionTypeMetered[] = "metered";
47 const char kDriveConnectionTypeOnline[] = "online"; 47 const char kDriveConnectionTypeOnline[] = "online";
48 48
49 // List of reasons of kDriveConnectionType*. 49 // List of reasons of kDriveConnectionType*.
50 // Keep this in sync with the DriveConnectionReason in common/js/util.js. 50 // Keep this in sync with the DriveConnectionReason in common/js/util.js.
51 const char kDriveConnectionReasonNotReady[] = "not_ready"; 51 const char kDriveConnectionReasonNotReady[] = "not_ready";
52 const char kDriveConnectionReasonNoNetwork[] = "no_network"; 52 const char kDriveConnectionReasonNoNetwork[] = "no_network";
53 const char kDriveConnectionReasonNoService[] = "no_service"; 53 const char kDriveConnectionReasonNoService[] = "no_service";
54 54
55 // Copies properties from |entry_proto| to |properties|. |shared_with_me| is 55 // Copies properties from |entry_proto| to |properties|. |shared_with_me| is
56 // given from the running profile. 56 // given from the running profile.
57 void FillDriveEntryPropertiesValue(const drive::ResourceEntry& entry_proto, 57 void FillEntryPropertiesValue(const drive::ResourceEntry& entry_proto,
58 bool shared_with_me, 58 bool shared_with_me,
59 DriveEntryProperties* properties) { 59 EntryProperties* properties) {
60 properties->shared_with_me.reset(new bool(shared_with_me)); 60 properties->shared_with_me.reset(new bool(shared_with_me));
61 properties->shared.reset(new bool(entry_proto.shared())); 61 properties->shared.reset(new bool(entry_proto.shared()));
62 62
63 const drive::PlatformFileInfoProto& file_info = entry_proto.file_info(); 63 const drive::PlatformFileInfoProto& file_info = entry_proto.file_info();
64 properties->file_size.reset(new double(file_info.size())); 64 properties->file_size.reset(new double(file_info.size()));
65 properties->last_modified_time.reset(new double( 65 properties->last_modified_time.reset(new double(
66 base::Time::FromInternalValue(file_info.last_modified()).ToJsTime())); 66 base::Time::FromInternalValue(file_info.last_modified()).ToJsTime()));
67 67
68 if (!entry_proto.has_file_specific_info()) 68 if (!entry_proto.has_file_specific_info())
69 return; 69 return;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 file_definition_list.push_back(file_definition); 120 file_definition_list.push_back(file_definition);
121 } 121 }
122 122
123 file_manager::util::ConvertFileDefinitionListToEntryDefinitionList( 123 file_manager::util::ConvertFileDefinitionListToEntryDefinitionList(
124 profile, 124 profile,
125 extension_id, 125 extension_id,
126 file_definition_list, // Safe, since copied internally. 126 file_definition_list, // Safe, since copied internally.
127 callback); 127 callback);
128 } 128 }
129 129
130 class SingleDriveEntryPropertiesGetter { 130 class SingleEntryPropertiesGetterForDrive {
131 public: 131 public:
132 typedef base::Callback<void(drive::FileError error)> ResultCallback; 132 typedef base::Callback<void(scoped_ptr<EntryProperties> properties,
133 base::File::Error error)> ResultCallback;
133 134
134 // Creates an instance and starts the process. 135 // Creates an instance and starts the process.
135 static void Start(const base::FilePath local_path, 136 static void Start(const base::FilePath local_path,
136 linked_ptr<DriveEntryProperties> properties,
137 Profile* const profile, 137 Profile* const profile,
138 const ResultCallback& callback) { 138 const ResultCallback& callback) {
139 139 SingleEntryPropertiesGetterForDrive* instance =
140 SingleDriveEntryPropertiesGetter* instance = 140 new SingleEntryPropertiesGetterForDrive(local_path, profile, callback);
141 new SingleDriveEntryPropertiesGetter(
142 local_path, properties, profile, callback);
143 instance->StartProcess(); 141 instance->StartProcess();
144 142
145 // The instance will be destroyed by itself. 143 // The instance will be destroyed by itself.
146 } 144 }
147 145
148 virtual ~SingleDriveEntryPropertiesGetter() {} 146 virtual ~SingleEntryPropertiesGetterForDrive() {}
149 147
150 private: 148 private:
151 // Given parameters. 149 // Given parameters.
152 const ResultCallback callback_; 150 const ResultCallback callback_;
153 const base::FilePath local_path_; 151 const base::FilePath local_path_;
154 const linked_ptr<DriveEntryProperties> properties_;
155 Profile* const running_profile_; 152 Profile* const running_profile_;
156 153
157 // Values used in the process. 154 // Values used in the process.
155 scoped_ptr<EntryProperties> properties_;
158 Profile* file_owner_profile_; 156 Profile* file_owner_profile_;
159 base::FilePath file_path_; 157 base::FilePath file_path_;
160 scoped_ptr<drive::ResourceEntry> owner_resource_entry_; 158 scoped_ptr<drive::ResourceEntry> owner_resource_entry_;
161 159
162 base::WeakPtrFactory<SingleDriveEntryPropertiesGetter> weak_ptr_factory_; 160 base::WeakPtrFactory<SingleEntryPropertiesGetterForDrive> weak_ptr_factory_;
163 161
164 SingleDriveEntryPropertiesGetter(const base::FilePath local_path, 162 SingleEntryPropertiesGetterForDrive(const base::FilePath local_path,
165 linked_ptr<DriveEntryProperties> properties, 163 Profile* const profile,
166 Profile* const profile, 164 const ResultCallback& callback)
167 const ResultCallback& callback)
168 : callback_(callback), 165 : callback_(callback),
169 local_path_(local_path), 166 local_path_(local_path),
170 properties_(properties),
171 running_profile_(profile), 167 running_profile_(profile),
168 properties_(new EntryProperties),
172 file_owner_profile_(NULL), 169 file_owner_profile_(NULL),
173 weak_ptr_factory_(this) { 170 weak_ptr_factory_(this) {
174 DCHECK(!callback_.is_null()); 171 DCHECK(!callback_.is_null());
175 DCHECK(profile); 172 DCHECK(profile);
176 } 173 }
177 174
178 base::WeakPtr<SingleDriveEntryPropertiesGetter> GetWeakPtr() { 175 base::WeakPtr<SingleEntryPropertiesGetterForDrive> GetWeakPtr() {
179 return weak_ptr_factory_.GetWeakPtr(); 176 return weak_ptr_factory_.GetWeakPtr();
180 } 177 }
181 178
182 void StartProcess() { 179 void StartProcess() {
183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 180 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
184 181
185 file_path_ = drive::util::ExtractDrivePath(local_path_); 182 file_path_ = drive::util::ExtractDrivePath(local_path_);
186 file_owner_profile_ = drive::util::ExtractProfileFromPath(local_path_); 183 file_owner_profile_ = drive::util::ExtractProfileFromPath(local_path_);
187 184
188 if (!file_owner_profile_ || 185 if (!file_owner_profile_ ||
189 !g_browser_process->profile_manager()->IsValidProfile( 186 !g_browser_process->profile_manager()->IsValidProfile(
190 file_owner_profile_)) { 187 file_owner_profile_)) {
191 CompleteGetFileProperties(drive::FILE_ERROR_FAILED); 188 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED);
192 return; 189 return;
193 } 190 }
194 191
195 // Start getting the file info. 192 // Start getting the file info.
196 drive::FileSystemInterface* const file_system = 193 drive::FileSystemInterface* const file_system =
197 drive::util::GetFileSystemByProfile(file_owner_profile_); 194 drive::util::GetFileSystemByProfile(file_owner_profile_);
198 if (!file_system) { 195 if (!file_system) {
199 // |file_system| is NULL if Drive is disabled or not mounted. 196 // |file_system| is NULL if Drive is disabled or not mounted.
200 CompleteGetFileProperties(drive::FILE_ERROR_FAILED); 197 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED);
201 return; 198 return;
202 } 199 }
203 200
204 file_system->GetResourceEntry( 201 file_system->GetResourceEntry(
205 file_path_, 202 file_path_,
206 base::Bind(&SingleDriveEntryPropertiesGetter::OnGetFileInfo, 203 base::Bind(&SingleEntryPropertiesGetterForDrive::OnGetFileInfo,
207 GetWeakPtr())); 204 GetWeakPtr()));
208 } 205 }
209 206
210 void OnGetFileInfo(drive::FileError error, 207 void OnGetFileInfo(drive::FileError error,
211 scoped_ptr<drive::ResourceEntry> entry) { 208 scoped_ptr<drive::ResourceEntry> entry) {
212 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 209 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
213 210
214 if (error != drive::FILE_ERROR_OK) { 211 if (error != drive::FILE_ERROR_OK) {
215 CompleteGetFileProperties(error); 212 CompleteGetEntryProperties(error);
216 return; 213 return;
217 } 214 }
218 215
219 DCHECK(entry); 216 DCHECK(entry);
220 owner_resource_entry_.swap(entry); 217 owner_resource_entry_.swap(entry);
221 218
222 if (running_profile_->IsSameProfile(file_owner_profile_)) { 219 if (running_profile_->IsSameProfile(file_owner_profile_)) {
223 StartParseFileInfo(owner_resource_entry_->shared_with_me()); 220 StartParseFileInfo(owner_resource_entry_->shared_with_me());
224 return; 221 return;
225 } 222 }
226 223
227 // If the running profile does not own the file, obtain the shared_with_me 224 // If the running profile does not own the file, obtain the shared_with_me
228 // flag from the running profile's value. 225 // flag from the running profile's value.
229 drive::FileSystemInterface* const file_system = 226 drive::FileSystemInterface* const file_system =
230 drive::util::GetFileSystemByProfile(running_profile_); 227 drive::util::GetFileSystemByProfile(running_profile_);
231 if (!file_system) { 228 if (!file_system) {
232 CompleteGetFileProperties(drive::FILE_ERROR_FAILED); 229 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED);
233 return; 230 return;
234 } 231 }
235 file_system->GetPathFromResourceId( 232 file_system->GetPathFromResourceId(
236 owner_resource_entry_->resource_id(), 233 owner_resource_entry_->resource_id(),
237 base::Bind(&SingleDriveEntryPropertiesGetter::OnGetRunningPath, 234 base::Bind(&SingleEntryPropertiesGetterForDrive::OnGetRunningPath,
238 GetWeakPtr())); 235 GetWeakPtr()));
239 } 236 }
240 237
241 void OnGetRunningPath(drive::FileError error, 238 void OnGetRunningPath(drive::FileError error,
242 const base::FilePath& file_path) { 239 const base::FilePath& file_path) {
243 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 240 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
244 241
245 if (error != drive::FILE_ERROR_OK) { 242 if (error != drive::FILE_ERROR_OK) {
246 // The running profile does not know the file. 243 // The running profile does not know the file.
247 StartParseFileInfo(false); 244 StartParseFileInfo(false);
248 return; 245 return;
249 } 246 }
250 247
251 drive::FileSystemInterface* const file_system = 248 drive::FileSystemInterface* const file_system =
252 drive::util::GetFileSystemByProfile(running_profile_); 249 drive::util::GetFileSystemByProfile(running_profile_);
253 if (!file_system) { 250 if (!file_system) {
254 // The drive is disable for the running profile. 251 // The drive is disable for the running profile.
255 StartParseFileInfo(false); 252 StartParseFileInfo(false);
256 return; 253 return;
257 } 254 }
258 255
259 file_system->GetResourceEntry( 256 file_system->GetResourceEntry(
260 file_path, 257 file_path,
261 base::Bind(&SingleDriveEntryPropertiesGetter::OnGetShareInfo, 258 base::Bind(&SingleEntryPropertiesGetterForDrive::OnGetShareInfo,
262 GetWeakPtr())); 259 GetWeakPtr()));
263 } 260 }
264 261
265 void OnGetShareInfo(drive::FileError error, 262 void OnGetShareInfo(drive::FileError error,
266 scoped_ptr<drive::ResourceEntry> entry) { 263 scoped_ptr<drive::ResourceEntry> entry) {
267 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
268 265
269 if (error != drive::FILE_ERROR_OK) { 266 if (error != drive::FILE_ERROR_OK) {
270 CompleteGetFileProperties(error); 267 CompleteGetEntryProperties(error);
271 return; 268 return;
272 } 269 }
273 270
274 DCHECK(entry); 271 DCHECK(entry);
275 StartParseFileInfo(entry->shared_with_me()); 272 StartParseFileInfo(entry->shared_with_me());
276 } 273 }
277 274
278 void StartParseFileInfo(bool shared_with_me) { 275 void StartParseFileInfo(bool shared_with_me) {
279 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
280 277
281 FillDriveEntryPropertiesValue( 278 FillEntryPropertiesValue(
282 *owner_resource_entry_, shared_with_me, properties_.get()); 279 *owner_resource_entry_, shared_with_me, properties_.get());
283 280
284 drive::FileSystemInterface* const file_system = 281 drive::FileSystemInterface* const file_system =
285 drive::util::GetFileSystemByProfile(file_owner_profile_); 282 drive::util::GetFileSystemByProfile(file_owner_profile_);
286 drive::DriveAppRegistry* const app_registry = 283 drive::DriveAppRegistry* const app_registry =
287 drive::util::GetDriveAppRegistryByProfile(file_owner_profile_); 284 drive::util::GetDriveAppRegistryByProfile(file_owner_profile_);
288 if (!file_system || !app_registry) { 285 if (!file_system || !app_registry) {
289 // |file_system| or |app_registry| is NULL if Drive is disabled. 286 // |file_system| or |app_registry| is NULL if Drive is disabled.
290 CompleteGetFileProperties(drive::FILE_ERROR_FAILED); 287 CompleteGetEntryProperties(drive::FILE_ERROR_FAILED);
291 return; 288 return;
292 } 289 }
293 290
294 // The properties meaningful for directories are already filled in 291 // The properties meaningful for directories are already filled in
295 // FillDriveEntryPropertiesValue(). 292 // FillEntryPropertiesValue().
296 if (!owner_resource_entry_->has_file_specific_info()) { 293 if (!owner_resource_entry_->has_file_specific_info()) {
297 CompleteGetFileProperties(drive::FILE_ERROR_OK); 294 CompleteGetEntryProperties(drive::FILE_ERROR_OK);
298 return; 295 return;
299 } 296 }
300 297
301 const drive::FileSpecificInfo& file_specific_info = 298 const drive::FileSpecificInfo& file_specific_info =
302 owner_resource_entry_->file_specific_info(); 299 owner_resource_entry_->file_specific_info();
303 300
304 // Get drive WebApps that can accept this file. We just need to extract the 301 // Get drive WebApps that can accept this file. We just need to extract the
305 // doc icon for the drive app, which is set as default. 302 // doc icon for the drive app, which is set as default.
306 std::vector<drive::DriveAppInfo> drive_apps; 303 std::vector<drive::DriveAppInfo> drive_apps;
307 app_registry->GetAppsForFile(file_path_.Extension(), 304 app_registry->GetAppsForFile(file_path_.Extension(),
(...skipping 12 matching lines...) Expand all
320 const drive::DriveAppInfo& app_info = drive_apps[i]; 317 const drive::DriveAppInfo& app_info = drive_apps[i];
321 if (default_task.app_id == app_info.app_id) { 318 if (default_task.app_id == app_info.app_id) {
322 // The drive app is set as default. Files.app should use the doc icon. 319 // The drive app is set as default. Files.app should use the doc icon.
323 const GURL doc_icon = drive::util::FindPreferredIcon( 320 const GURL doc_icon = drive::util::FindPreferredIcon(
324 app_info.document_icons, drive::util::kPreferredIconSize); 321 app_info.document_icons, drive::util::kPreferredIconSize);
325 properties_->custom_icon_url.reset(new std::string(doc_icon.spec())); 322 properties_->custom_icon_url.reset(new std::string(doc_icon.spec()));
326 } 323 }
327 } 324 }
328 } 325 }
329 326
330 CompleteGetFileProperties(drive::FILE_ERROR_OK); 327 CompleteGetEntryProperties(drive::FILE_ERROR_OK);
331 } 328 }
332 329
333 void CompleteGetFileProperties(drive::FileError error) { 330 void CompleteGetEntryProperties(drive::FileError error) {
334 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 331 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
335 DCHECK(!callback_.is_null()); 332 DCHECK(!callback_.is_null());
336 callback_.Run(error); 333
334 callback_.Run(properties_.Pass(), drive::FileErrorToBaseFileError(error));
337 335
338 delete this; 336 delete this;
339 } 337 }
340 }; // class SingleDriveEntryPropertiesGetter 338 }; // class SingleEntryPropertiesGetterForDrive
341 339
342 } // namespace 340 } // namespace
343 341
344 FileBrowserPrivateGetDriveEntryPropertiesFunction:: 342 FileBrowserPrivateGetEntryPropertiesFunction::
345 FileBrowserPrivateGetDriveEntryPropertiesFunction() 343 FileBrowserPrivateGetEntryPropertiesFunction()
346 : processed_count_(0) {} 344 : processed_count_(0) {
345 }
347 346
348 FileBrowserPrivateGetDriveEntryPropertiesFunction:: 347 FileBrowserPrivateGetEntryPropertiesFunction::
349 ~FileBrowserPrivateGetDriveEntryPropertiesFunction() {} 348 ~FileBrowserPrivateGetEntryPropertiesFunction() {
349 }
350 350
351 bool FileBrowserPrivateGetDriveEntryPropertiesFunction::RunAsync() { 351 bool FileBrowserPrivateGetEntryPropertiesFunction::RunAsync() {
352 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 352 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
353 353
354 using api::file_browser_private::GetDriveEntryProperties::Params; 354 using api::file_browser_private::GetEntryProperties::Params;
355 const scoped_ptr<Params> params(Params::Create(*args_)); 355 const scoped_ptr<Params> params(Params::Create(*args_));
356 EXTENSION_FUNCTION_VALIDATE(params); 356 EXTENSION_FUNCTION_VALIDATE(params);
357 357
358 scoped_refptr<storage::FileSystemContext> file_system_context =
359 file_manager::util::GetFileSystemContextForRenderViewHost(
360 GetProfile(), render_view_host());
361
358 properties_list_.resize(params->file_urls.size()); 362 properties_list_.resize(params->file_urls.size());
359
360 for (size_t i = 0; i < params->file_urls.size(); i++) { 363 for (size_t i = 0; i < params->file_urls.size(); i++) {
361 const GURL url = GURL(params->file_urls[i]); 364 const GURL url = GURL(params->file_urls[i]);
362 const base::FilePath local_path = file_manager::util::GetLocalPathFromURL( 365 const storage::FileSystemURL file_system_url =
363 render_view_host(), GetProfile(), url); 366 file_system_context->CrackURL(url);
364 properties_list_[i] = make_linked_ptr(new DriveEntryProperties); 367 switch (file_system_url.type()) {
365 368 case storage::kFileSystemTypeDrive:
366 SingleDriveEntryPropertiesGetter::Start( 369 SingleEntryPropertiesGetterForDrive::Start(
367 local_path, 370 file_system_url.path(),
368 properties_list_[i], 371 GetProfile(),
369 GetProfile(), 372 base::Bind(&FileBrowserPrivateGetEntryPropertiesFunction::
370 base::Bind(&FileBrowserPrivateGetDriveEntryPropertiesFunction:: 373 CompleteGetEntryProperties,
371 CompleteGetFileProperties, 374 this,
372 this)); 375 i));
376 break;
377 case storage::kFileSystemTypeProvided:
378 // TODO(mtomasz): Add support for provided file systems.
379 NOTIMPLEMENTED();
380 break;
381 default:
382 LOG(ERROR) << "Not supported file system type.";
383 CompleteGetEntryProperties(i,
384 make_scoped_ptr(new EntryProperties),
385 base::File::FILE_ERROR_INVALID_OPERATION);
386 }
373 } 387 }
374 388
375 return true; 389 return true;
376 } 390 }
377 391
378 void FileBrowserPrivateGetDriveEntryPropertiesFunction:: 392 void FileBrowserPrivateGetEntryPropertiesFunction::CompleteGetEntryProperties(
379 CompleteGetFileProperties(drive::FileError error) { 393 size_t index,
394 scoped_ptr<EntryProperties> properties,
395 base::File::Error error) {
380 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 396 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
381 DCHECK(0 <= processed_count_ && processed_count_ < properties_list_.size()); 397 DCHECK(0 <= processed_count_ && processed_count_ < properties_list_.size());
382 398
399 properties_list_[index] = make_linked_ptr(properties.release());
400
383 processed_count_++; 401 processed_count_++;
384 if (processed_count_ < properties_list_.size()) 402 if (processed_count_ < properties_list_.size())
385 return; 403 return;
386 404
387 results_ = extensions::api::file_browser_private::GetDriveEntryProperties:: 405 results_ = extensions::api::file_browser_private::GetEntryProperties::
388 Results::Create(properties_list_); 406 Results::Create(properties_list_);
389 SendResponse(true); 407 SendResponse(true);
390 } 408 }
391 409
392 bool FileBrowserPrivatePinDriveFileFunction::RunAsync() { 410 bool FileBrowserPrivatePinDriveFileFunction::RunAsync() {
393 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 411 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
394 412
395 using extensions::api::file_browser_private::PinDriveFile::Params; 413 using extensions::api::file_browser_private::PinDriveFile::Params;
396 const scoped_ptr<Params> params(Params::Create(*args_)); 414 const scoped_ptr<Params> params(Params::Create(*args_));
397 EXTENSION_FUNCTION_VALIDATE(params); 415 EXTENSION_FUNCTION_VALIDATE(params);
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 return; 996 return;
979 } 997 }
980 998
981 const std::string url = download_url_ + "?access_token=" + access_token; 999 const std::string url = download_url_ + "?access_token=" + access_token;
982 SetResult(new base::StringValue(url)); 1000 SetResult(new base::StringValue(url));
983 1001
984 SendResponse(true); 1002 SendResponse(true);
985 } 1003 }
986 1004
987 } // namespace extensions 1005 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698