Index: chrome/browser/chromeos/extensions/file_browser_private_api.cc |
diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc |
index 78910ac18e7f946940971327ef9b374c098e432b..a49a35e53b081f063c807258f3c1a58dcb985b2c 100644 |
--- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc |
+++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc |
@@ -485,7 +485,7 @@ void RequestLocalFileSystemFunction::RespondSuccessOnUIThread( |
// proper authentication. |
if (gdata::util::IsGDataAvailable(profile_)) |
AddGDataMountPoint(profile_, extension_id(), render_view_host()); |
- result_.reset(new DictionaryValue()); |
+ SetSingleResult(new DictionaryValue()); |
DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get()); |
dict->SetString("name", name); |
dict->SetString("path", root_path.spec()); |
@@ -525,7 +525,7 @@ bool FileWatchBrowserFunctionBase::GetLocalFilePath( |
} |
void FileWatchBrowserFunctionBase::RespondOnUIThread(bool success) { |
- result_.reset(Value::CreateBooleanValue(success)); |
+ SetSingleResult(Value::CreateBooleanValue(success)); |
SendResponse(success); |
} |
@@ -661,7 +661,7 @@ bool GetFileTasksFileBrowserFunction::RunImpl() { |
} |
ListValue* result_list = new ListValue(); |
- result_.reset(result_list); |
+ SetSingleResult(result_list); |
file_handler_util::LastUsedHandlerList common_tasks; |
if (!file_handler_util::FindCommonTasks(profile_, file_urls, &common_tasks)) |
@@ -761,7 +761,7 @@ bool ExecuteTasksFileBrowserFunction::RunImpl() { |
base::Bind(&ExecuteTasksFileBrowserFunction::OnTaskExecuted, this))) |
return false; |
- result_.reset(new base::FundamentalValue(true)); |
+ SetSingleResult(new base::FundamentalValue(true)); |
return true; |
} |
@@ -781,7 +781,7 @@ bool SetDefaultTaskFileBrowserFunction::RunImpl() { |
&file_handler_util::UpdateFileHandlerUsageStats, |
profile_, task_id)); |
- result_.reset(new base::FundamentalValue(true)); |
+ SetSingleResult(new base::FundamentalValue(true)); |
return true; |
} |
@@ -995,7 +995,7 @@ void ViewFilesFunction::GetLocalPathsResponseOnUIThread( |
if (!handled && files.size() == 1) |
success = false; |
} |
- result_.reset(Value::CreateBooleanValue(success)); |
+ SetSingleResult(Value::CreateBooleanValue(success)); |
SendResponse(true); |
} |
@@ -1068,7 +1068,7 @@ bool AddMountFunction::RunImpl() { |
} |
// Set default return source path to the empty string. |
- result_.reset(Value::CreateStringValue("")); |
+ SetSingleResult(Value::CreateStringValue("")); |
chromeos::MountType mount_type = |
DiskMountManager::MountTypeFromString(mount_type_str); |
@@ -1114,7 +1114,7 @@ void AddMountFunction::RaiseGDataMountEvent(gdata::GDataErrorCode error) { |
} |
// Pass back the gdata mount point path as source path. |
const std::string& gdata_path = gdata::util::GetGDataMountPointPathAsString(); |
- result_.reset(Value::CreateStringValue(gdata_path)); |
+ SetSingleResult(Value::CreateStringValue(gdata_path)); |
DiskMountManager::MountPointInfo mount_info( |
gdata_path, |
gdata_path, |
@@ -1166,7 +1166,7 @@ void AddMountFunction::OnMountedStateSet(const std::string& mount_type, |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); |
// Pass back the actual source path of the mount point. |
- result_.reset(Value::CreateStringValue(file_path.value())); |
+ SetSingleResult(Value::CreateStringValue(file_path.value())); |
SendResponse(true); |
// MountPath() takes a std::string. |
disk_mount_manager->MountPath(file_path.AsUTF8Unsafe(), |
@@ -1222,7 +1222,7 @@ bool GetMountPointsFunction::RunImpl() { |
return false; |
base::ListValue *mounts = new base::ListValue(); |
- result_.reset(mounts); |
+ SetSingleResult(mounts); |
DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); |
DiskMountManager::MountPointMap mount_points = |
@@ -1333,7 +1333,7 @@ void GetSizeStatsFunction::GetSizeStatsCallbackOnUIThread( |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
base::DictionaryValue* sizes = new base::DictionaryValue(); |
- result_.reset(sizes); |
+ SetSingleResult(sizes); |
sizes->SetInteger("totalSizeKB", total_size_kb); |
sizes->SetInteger("remainingSizeKB", remaining_size_kb); |
@@ -1419,14 +1419,14 @@ void GetVolumeMetadataFunction::GetLocalPathsResponseOnUIThread( |
return; |
} |
- result_.reset(); |
+ SetSingleResult(); |
const DiskMountManager::Disk* volume = GetVolumeAsDisk( |
files[0].path.value()); |
if (volume) { |
DictionaryValue* volume_info = |
CreateValueFromDisk(profile_, volume); |
- result_.reset(volume_info); |
+ SetSingleResult(volume_info); |
} |
SendResponse(true); |
@@ -1443,13 +1443,13 @@ bool ToggleFullscreenFunction::RunImpl() { |
bool IsFullscreenFunction::RunImpl() { |
Browser* browser = GetCurrentBrowser(); |
- result_.reset(Value::CreateBooleanValue( |
+ SetSingleResult(Value::CreateBooleanValue( |
browser && browser->window() && browser->window()->IsFullscreen())); |
return true; |
} |
bool FileDialogStringsFunction::RunImpl() { |
- result_.reset(new DictionaryValue()); |
+ SetSingleResult(new DictionaryValue()); |
DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get()); |
#define SET_STRING(ns, id) \ |
@@ -1752,7 +1752,7 @@ void GetGDataFilePropertiesFunction::PrepareResults() { |
void GetGDataFilePropertiesFunction::GetNextFileProperties() { |
if (current_index_ >= path_list_->GetSize()) { |
// Exit of asynchronous look and return the result. |
- result_.reset(file_properties_.release()); |
+ SetSingleResult(file_properties_.release()); |
SendResponse(true); |
return; |
} |
@@ -1974,7 +1974,7 @@ void GetFileLocationsFunction::GetLocalPathsResponseOnUIThread( |
} |
} |
- result_.reset(locations); |
+ SetSingleResult(locations); |
SendResponse(true); |
} |
@@ -2023,7 +2023,7 @@ void GetGDataFilesFunction::GetLocalPathsResponseOnUIThread( |
void GetGDataFilesFunction::GetFileOrSendResponse() { |
// Send the response if all files are obtained. |
if (remaining_gdata_paths_.empty()) { |
- result_.reset(local_paths_); |
+ SetSingleResult(local_paths_); |
SendResponse(true); |
return; |
} |
@@ -2093,7 +2093,7 @@ bool GetFileTransfersFunction::RunImpl() { |
return false; |
} |
- result_.reset(progress_status_list.release()); |
+ SetSingleResult(progress_status_list.release()); |
SendResponse(true); |
return true; |
} |
@@ -2157,7 +2157,7 @@ void CancelFileTransfersFunction::GetLocalPathsResponseOnUIThread( |
responses->Append(result.release()); |
} |
- result_.reset(responses.release()); |
+ SetSingleResult(responses.release()); |
SendResponse(true); |
} |
@@ -2258,7 +2258,7 @@ bool GetGDataPreferencesFunction::RunImpl() { |
value->SetBoolean("hostedFilesDisabled", |
service->GetBoolean(prefs::kDisableGDataHostedFiles)); |
- result_.reset(value.release()); |
+ SetSingleResult(value.release()); |
return true; |
} |
@@ -2310,7 +2310,7 @@ void GetPathForDriveSearchResultFunction::OnEntryFound( |
return; |
} |
- result_.reset(Value::CreateStringValue(entry_path.value())); |
+ SetSingleResult(Value::CreateStringValue(entry_path.value())); |
SendResponse(true); |
} |
@@ -2370,7 +2370,7 @@ void SearchDriveFunction::OnSearch( |
entries->Append(entry); |
} |
- result_.reset(entries); |
+ SetSingleResult(entries); |
SendResponse(true); |
} |
@@ -2394,7 +2394,7 @@ bool GetNetworkConnectionStateFunction::RunImpl() { |
type_string = "ethernet"; // Currently we do not care about other types. |
value->SetString("type", type_string); |
- result_.reset(value.release()); |
+ SetSingleResult(value.release()); |
return true; |
} |