OLD | NEW |
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_file_syste
m.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_file_syste
m.h" |
6 | 6 |
7 #include <sys/statvfs.h> | 7 #include <sys/statvfs.h> |
8 | 8 |
9 #include "base/posix/eintr_wrapper.h" | 9 #include "base/posix/eintr_wrapper.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 // | 303 // |
304 // Note that we call this function even when Drive is disabled by the | 304 // Note that we call this function even when Drive is disabled by the |
305 // setting. Otherwise, we need to call this when the setting is changed at | 305 // setting. Otherwise, we need to call this when the setting is changed at |
306 // a later time, which complicates the code. | 306 // a later time, which complicates the code. |
307 SetDriveMountPointPermissions( | 307 SetDriveMountPointPermissions( |
308 GetProfile(), extension_id(), render_view_host()); | 308 GetProfile(), extension_id(), render_view_host()); |
309 | 309 |
310 fileapi::FileSystemInfo info = | 310 fileapi::FileSystemInfo info = |
311 fileapi::GetFileSystemInfoForChromeOS(source_url_.GetOrigin()); | 311 fileapi::GetFileSystemInfoForChromeOS(source_url_.GetOrigin()); |
312 | 312 |
313 DictionaryValue* dict = new DictionaryValue(); | 313 base::DictionaryValue* dict = new base::DictionaryValue(); |
314 SetResult(dict); | 314 SetResult(dict); |
315 dict->SetString("name", info.name); | 315 dict->SetString("name", info.name); |
316 dict->SetString("root_url", info.root_url.spec()); | 316 dict->SetString("root_url", info.root_url.spec()); |
317 dict->SetInteger("error", drive::FILE_ERROR_OK); | 317 dict->SetInteger("error", drive::FILE_ERROR_OK); |
318 SendResponse(true); | 318 SendResponse(true); |
319 return true; | 319 return true; |
320 } | 320 } |
321 | 321 |
322 void FileWatchFunctionBase::Respond(bool success) { | 322 void FileWatchFunctionBase::Respond(bool success) { |
323 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 323 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
324 | 324 |
325 SetResult(Value::CreateBooleanValue(success)); | 325 SetResult(base::Value::CreateBooleanValue(success)); |
326 SendResponse(success); | 326 SendResponse(success); |
327 } | 327 } |
328 | 328 |
329 bool FileWatchFunctionBase::RunImpl() { | 329 bool FileWatchFunctionBase::RunImpl() { |
330 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 330 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
331 | 331 |
332 if (!render_view_host() || !render_view_host()->GetProcess()) | 332 if (!render_view_host() || !render_view_host()->GetProcess()) |
333 return false; | 333 return false; |
334 | 334 |
335 // First param is url of a file to watch. | 335 // First param is url of a file to watch. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 source_url, | 548 source_url, |
549 destination_url), | 549 destination_url), |
550 base::Bind(&FileBrowserPrivateStartCopyFunction::RunAfterStartCopy, | 550 base::Bind(&FileBrowserPrivateStartCopyFunction::RunAfterStartCopy, |
551 this)); | 551 this)); |
552 } | 552 } |
553 | 553 |
554 void FileBrowserPrivateStartCopyFunction::RunAfterStartCopy( | 554 void FileBrowserPrivateStartCopyFunction::RunAfterStartCopy( |
555 int operation_id) { | 555 int operation_id) { |
556 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 556 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
557 | 557 |
558 SetResult(Value::CreateIntegerValue(operation_id)); | 558 SetResult(base::Value::CreateIntegerValue(operation_id)); |
559 SendResponse(true); | 559 SendResponse(true); |
560 } | 560 } |
561 | 561 |
562 bool FileBrowserPrivateCancelCopyFunction::RunImpl() { | 562 bool FileBrowserPrivateCancelCopyFunction::RunImpl() { |
563 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 563 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
564 | 564 |
565 using extensions::api::file_browser_private::CancelCopy::Params; | 565 using extensions::api::file_browser_private::CancelCopy::Params; |
566 const scoped_ptr<Params> params(Params::Create(*args_)); | 566 const scoped_ptr<Params> params(Params::Create(*args_)); |
567 EXTENSION_FUNCTION_VALIDATE(params); | 567 EXTENSION_FUNCTION_VALIDATE(params); |
568 | 568 |
569 scoped_refptr<fileapi::FileSystemContext> file_system_context = | 569 scoped_refptr<fileapi::FileSystemContext> file_system_context = |
570 file_manager::util::GetFileSystemContextForRenderViewHost( | 570 file_manager::util::GetFileSystemContextForRenderViewHost( |
571 GetProfile(), render_view_host()); | 571 GetProfile(), render_view_host()); |
572 | 572 |
573 // We don't much take care about the result of cancellation. | 573 // We don't much take care about the result of cancellation. |
574 BrowserThread::PostTask( | 574 BrowserThread::PostTask( |
575 BrowserThread::IO, | 575 BrowserThread::IO, |
576 FROM_HERE, | 576 FROM_HERE, |
577 base::Bind(&CancelCopyOnIOThread, file_system_context, params->copy_id)); | 577 base::Bind(&CancelCopyOnIOThread, file_system_context, params->copy_id)); |
578 SendResponse(true); | 578 SendResponse(true); |
579 return true; | 579 return true; |
580 } | 580 } |
581 | 581 |
582 } // namespace extensions | 582 } // namespace extensions |
OLD | NEW |