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/extensions/extension_file_browser_private_api.h" | 5 #include "chrome/browser/extensions/extension_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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 BrowserContext::GetFileSystemContext(profile())->OpenFileSystem( | 500 BrowserContext::GetFileSystemContext(profile())->OpenFileSystem( |
501 origin_url, fileapi::kFileSystemTypeExternal, false, // create | 501 origin_url, fileapi::kFileSystemTypeExternal, false, // create |
502 LocalFileSystemCallbackDispatcher::CreateCallback( | 502 LocalFileSystemCallbackDispatcher::CreateCallback( |
503 this, | 503 this, |
504 profile(), | 504 profile(), |
505 child_id, | 505 child_id, |
506 GetExtension())); | 506 GetExtension())); |
507 } | 507 } |
508 | 508 |
509 bool RequestLocalFileSystemFunction::RunImpl() { | 509 bool RequestLocalFileSystemFunction::RunImpl() { |
510 if (!dispatcher() || !render_view_host() || !render_view_host()->process()) | 510 if (!dispatcher() || !render_view_host() || !render_view_host()->GetProcess()) |
511 return false; | 511 return false; |
512 | 512 |
513 BrowserThread::PostTask( | 513 BrowserThread::PostTask( |
514 BrowserThread::FILE, FROM_HERE, | 514 BrowserThread::FILE, FROM_HERE, |
515 base::Bind( | 515 base::Bind( |
516 &RequestLocalFileSystemFunction::RequestOnFileThread, | 516 &RequestLocalFileSystemFunction::RequestOnFileThread, |
517 this, | 517 this, |
518 source_url_, | 518 source_url_, |
519 render_view_host()->process()->GetID())); | 519 render_view_host()->GetProcess()->GetID())); |
520 // Will finish asynchronously. | 520 // Will finish asynchronously. |
521 return true; | 521 return true; |
522 } | 522 } |
523 | 523 |
524 void RequestLocalFileSystemFunction::RespondSuccessOnUIThread( | 524 void RequestLocalFileSystemFunction::RespondSuccessOnUIThread( |
525 const std::string& name, const GURL& root_path) { | 525 const std::string& name, const GURL& root_path) { |
526 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 526 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
527 result_.reset(new DictionaryValue()); | 527 result_.reset(new DictionaryValue()); |
528 DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get()); | 528 DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get()); |
529 dict->SetString("name", name); | 529 dict->SetString("name", name); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 *local_path = root_path.Append(*virtual_path); | 562 *local_path = root_path.Append(*virtual_path); |
563 return true; | 563 return true; |
564 } | 564 } |
565 | 565 |
566 void FileWatchBrowserFunctionBase::RespondOnUIThread(bool success) { | 566 void FileWatchBrowserFunctionBase::RespondOnUIThread(bool success) { |
567 result_.reset(Value::CreateBooleanValue(success)); | 567 result_.reset(Value::CreateBooleanValue(success)); |
568 SendResponse(success); | 568 SendResponse(success); |
569 } | 569 } |
570 | 570 |
571 bool FileWatchBrowserFunctionBase::RunImpl() { | 571 bool FileWatchBrowserFunctionBase::RunImpl() { |
572 if (!render_view_host() || !render_view_host()->process()) | 572 if (!render_view_host() || !render_view_host()->GetProcess()) |
573 return false; | 573 return false; |
574 | 574 |
575 // First param is url of a file to watch. | 575 // First param is url of a file to watch. |
576 std::string url; | 576 std::string url; |
577 if (!args_->GetString(0, &url) || url.empty()) | 577 if (!args_->GetString(0, &url) || url.empty()) |
578 return false; | 578 return false; |
579 | 579 |
580 GURL file_watch_url(url); | 580 GURL file_watch_url(url); |
581 BrowserThread::PostTask( | 581 BrowserThread::PostTask( |
582 BrowserThread::FILE, FROM_HERE, | 582 BrowserThread::FILE, FROM_HERE, |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 SET_STRING(IDS_FILE_BROWSER, ENQUEUE); | 1785 SET_STRING(IDS_FILE_BROWSER, ENQUEUE); |
1786 #undef SET_STRING | 1786 #undef SET_STRING |
1787 | 1787 |
1788 ChromeURLDataManager::DataSource::SetFontAndTextDirection(dict); | 1788 ChromeURLDataManager::DataSource::SetFontAndTextDirection(dict); |
1789 | 1789 |
1790 dict->SetString("PLAY_MEDIA", | 1790 dict->SetString("PLAY_MEDIA", |
1791 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); | 1791 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); |
1792 | 1792 |
1793 return true; | 1793 return true; |
1794 } | 1794 } |
OLD | NEW |