OLD | NEW |
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/extensions/file_browser_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 BrowserContext::GetFileSystemContext(profile())->OpenFileSystem( | 599 BrowserContext::GetFileSystemContext(profile())->OpenFileSystem( |
600 origin_url, fileapi::kFileSystemTypeExternal, false, // create | 600 origin_url, fileapi::kFileSystemTypeExternal, false, // create |
601 LocalFileSystemCallbackDispatcher::CreateCallback( | 601 LocalFileSystemCallbackDispatcher::CreateCallback( |
602 this, | 602 this, |
603 profile(), | 603 profile(), |
604 child_id, | 604 child_id, |
605 GetExtension())); | 605 GetExtension())); |
606 } | 606 } |
607 | 607 |
608 bool RequestLocalFileSystemFunction::RunImpl() { | 608 bool RequestLocalFileSystemFunction::RunImpl() { |
609 if (!dispatcher() || !render_view_host() || !render_view_host()->process()) | 609 if (!dispatcher() || !render_view_host() || !render_view_host()->GetProcess()) |
610 return false; | 610 return false; |
611 | 611 |
612 BrowserThread::PostTask( | 612 BrowserThread::PostTask( |
613 BrowserThread::FILE, FROM_HERE, | 613 BrowserThread::FILE, FROM_HERE, |
614 base::Bind( | 614 base::Bind( |
615 &RequestLocalFileSystemFunction::RequestOnFileThread, | 615 &RequestLocalFileSystemFunction::RequestOnFileThread, |
616 this, | 616 this, |
617 source_url_, | 617 source_url_, |
618 render_view_host()->process()->GetID())); | 618 render_view_host()->GetProcess()->GetID())); |
619 // Will finish asynchronously. | 619 // Will finish asynchronously. |
620 return true; | 620 return true; |
621 } | 621 } |
622 | 622 |
623 void RequestLocalFileSystemFunction::RespondSuccessOnUIThread( | 623 void RequestLocalFileSystemFunction::RespondSuccessOnUIThread( |
624 const std::string& name, const GURL& root_path) { | 624 const std::string& name, const GURL& root_path) { |
625 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 625 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
626 result_.reset(new DictionaryValue()); | 626 result_.reset(new DictionaryValue()); |
627 DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get()); | 627 DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get()); |
628 dict->SetString("name", name); | 628 dict->SetString("name", name); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 *local_path = root_path.Append(*virtual_path); | 661 *local_path = root_path.Append(*virtual_path); |
662 return true; | 662 return true; |
663 } | 663 } |
664 | 664 |
665 void FileWatchBrowserFunctionBase::RespondOnUIThread(bool success) { | 665 void FileWatchBrowserFunctionBase::RespondOnUIThread(bool success) { |
666 result_.reset(Value::CreateBooleanValue(success)); | 666 result_.reset(Value::CreateBooleanValue(success)); |
667 SendResponse(success); | 667 SendResponse(success); |
668 } | 668 } |
669 | 669 |
670 bool FileWatchBrowserFunctionBase::RunImpl() { | 670 bool FileWatchBrowserFunctionBase::RunImpl() { |
671 if (!render_view_host() || !render_view_host()->process()) | 671 if (!render_view_host() || !render_view_host()->GetProcess()) |
672 return false; | 672 return false; |
673 | 673 |
674 // First param is url of a file to watch. | 674 // First param is url of a file to watch. |
675 std::string url; | 675 std::string url; |
676 if (!args_->GetString(0, &url) || url.empty()) | 676 if (!args_->GetString(0, &url) || url.empty()) |
677 return false; | 677 return false; |
678 | 678 |
679 GURL file_watch_url(url); | 679 GURL file_watch_url(url); |
680 BrowserThread::PostTask( | 680 BrowserThread::PostTask( |
681 BrowserThread::FILE, FROM_HERE, | 681 BrowserThread::FILE, FROM_HERE, |
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 } | 1985 } |
1986 | 1986 |
1987 PinGDataFileFunction::~PinGDataFileFunction() { | 1987 PinGDataFileFunction::~PinGDataFileFunction() { |
1988 } | 1988 } |
1989 | 1989 |
1990 bool PinGDataFileFunction::DoOperation(const FilePath& /*path*/) { | 1990 bool PinGDataFileFunction::DoOperation(const FilePath& /*path*/) { |
1991 // TODO(gspencer): Actually pin the file here. | 1991 // TODO(gspencer): Actually pin the file here. |
1992 return true; | 1992 return true; |
1993 } | 1993 } |
1994 | 1994 |
OLD | NEW |