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

Side by Side Diff: chrome/browser/chromeos/extensions/file_browser_private_api.cc

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR, fix a weird runtime issue. Created 8 years, 9 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) 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 BrowserContext::GetFileSystemContext(profile())->OpenFileSystem( 494 BrowserContext::GetFileSystemContext(profile())->OpenFileSystem(
495 origin_url, fileapi::kFileSystemTypeExternal, false, // create 495 origin_url, fileapi::kFileSystemTypeExternal, false, // create
496 LocalFileSystemCallbackDispatcher::CreateCallback( 496 LocalFileSystemCallbackDispatcher::CreateCallback(
497 this, 497 this,
498 profile(), 498 profile(),
499 child_id, 499 child_id,
500 GetExtension())); 500 GetExtension()));
501 } 501 }
502 502
503 bool RequestLocalFileSystemFunction::RunImpl() { 503 bool RequestLocalFileSystemFunction::RunImpl() {
504 if (!dispatcher() || !render_view_host() || !render_view_host()->process()) 504 if (!dispatcher() || !render_view_host() || !render_view_host()->GetProcess())
505 return false; 505 return false;
506 506
507 BrowserThread::PostTask( 507 BrowserThread::PostTask(
508 BrowserThread::FILE, FROM_HERE, 508 BrowserThread::FILE, FROM_HERE,
509 base::Bind( 509 base::Bind(
510 &RequestLocalFileSystemFunction::RequestOnFileThread, 510 &RequestLocalFileSystemFunction::RequestOnFileThread,
511 this, 511 this,
512 source_url_, 512 source_url_,
513 render_view_host()->process()->GetID())); 513 render_view_host()->GetProcess()->GetID()));
514 // Will finish asynchronously. 514 // Will finish asynchronously.
515 return true; 515 return true;
516 } 516 }
517 517
518 void RequestLocalFileSystemFunction::RespondSuccessOnUIThread( 518 void RequestLocalFileSystemFunction::RespondSuccessOnUIThread(
519 const std::string& name, const GURL& root_path) { 519 const std::string& name, const GURL& root_path) {
520 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 520 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
521 result_.reset(new DictionaryValue()); 521 result_.reset(new DictionaryValue());
522 DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get()); 522 DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get());
523 dict->SetString("name", name); 523 dict->SetString("name", name);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 *local_path = root_path.Append(*virtual_path); 556 *local_path = root_path.Append(*virtual_path);
557 return true; 557 return true;
558 } 558 }
559 559
560 void FileWatchBrowserFunctionBase::RespondOnUIThread(bool success) { 560 void FileWatchBrowserFunctionBase::RespondOnUIThread(bool success) {
561 result_.reset(Value::CreateBooleanValue(success)); 561 result_.reset(Value::CreateBooleanValue(success));
562 SendResponse(success); 562 SendResponse(success);
563 } 563 }
564 564
565 bool FileWatchBrowserFunctionBase::RunImpl() { 565 bool FileWatchBrowserFunctionBase::RunImpl() {
566 if (!render_view_host() || !render_view_host()->process()) 566 if (!render_view_host() || !render_view_host()->GetProcess())
567 return false; 567 return false;
568 568
569 // First param is url of a file to watch. 569 // First param is url of a file to watch.
570 std::string url; 570 std::string url;
571 if (!args_->GetString(0, &url) || url.empty()) 571 if (!args_->GetString(0, &url) || url.empty())
572 return false; 572 return false;
573 573
574 GURL file_watch_url(url); 574 GURL file_watch_url(url);
575 BrowserThread::PostTask( 575 BrowserThread::PostTask(
576 BrowserThread::FILE, FROM_HERE, 576 BrowserThread::FILE, FROM_HERE,
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 ChromeURLDataManager::DataSource::SetFontAndTextDirection(dict); 1785 ChromeURLDataManager::DataSource::SetFontAndTextDirection(dict);
1786 1786
1787 dict->SetString("PLAY_MEDIA", 1787 dict->SetString("PLAY_MEDIA",
1788 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY)); 1788 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLAY));
1789 1789
1790 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableGData)) 1790 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableGData))
1791 dict->SetString("ENABLE_GDATA", "1"); 1791 dict->SetString("ENABLE_GDATA", "1");
1792 1792
1793 return true; 1793 return true;
1794 } 1794 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698