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 99dd321632bd39abd6adf71d4e2ba619edc1501b..525763f5ec0f00a66b282b3dcf078d4b132c2f1c 100644 |
--- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc |
+++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc |
@@ -1054,7 +1054,8 @@ bool CancelFileDialogFunction::RunImpl() { |
return true; |
} |
-AddMountFunction::AddMountFunction() { |
+AddMountFunction::AddMountFunction() |
+ : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
satorux1
2012/08/02 01:13:05
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(t
yoshiki
2012/08/02 05:53:42
The example usage in base/compiler_specific.h sugg
|
} |
AddMountFunction::~AddMountFunction() { |
@@ -1089,13 +1090,11 @@ bool AddMountFunction::RunImpl() { |
break; |
} |
case chromeos::MOUNT_TYPE_GDATA: { |
- gdata::GDataSystemService* system_service = |
- gdata::GDataSystemServiceFactory::GetForProfile(profile_); |
- if (system_service) { |
- system_service->docs_service()->Authenticate( |
- base::Bind(&AddMountFunction::OnGDataAuthentication, |
- this)); |
- } |
+ const bool success = true; |
+ FileBrowserEventRouterFactory::GetForProfile(profile_)-> |
+ MountDrive(base::Bind(&AddMountFunction::SendResponse, |
+ weak_ptr_factory_.GetWeakPtr(), |
+ success)); |
break; |
} |
default: { |
@@ -1105,7 +1104,7 @@ bool AddMountFunction::RunImpl() { |
GetLocalPathsOnFileThreadAndRunCallbackOnUIThread( |
file_paths, |
base::Bind(&AddMountFunction::GetLocalPathsResponseOnUIThread, |
- this, |
+ weak_ptr_factory_.GetWeakPtr(), |
mount_type_str)); |
break; |
} |
@@ -1114,33 +1113,6 @@ bool AddMountFunction::RunImpl() { |
return true; |
} |
-void AddMountFunction::RaiseGDataMountEvent(gdata::GDataErrorCode error) { |
- chromeos::MountError error_code = chromeos::MOUNT_ERROR_NONE; |
- // For the file manager to work offline, GDATA_NO_CONNECTION is allowed. |
- if (error == gdata::HTTP_SUCCESS || error == gdata::GDATA_NO_CONNECTION) { |
- error_code = chromeos::MOUNT_ERROR_NONE; |
- } else { |
- error_code = chromeos::MOUNT_ERROR_NOT_AUTHENTICATED; |
- } |
- // Pass back the gdata mount point path as source path. |
- const std::string& gdata_path = gdata::util::GetGDataMountPointPathAsString(); |
- SetResult(Value::CreateStringValue(gdata_path)); |
- DiskMountManager::MountPointInfo mount_info( |
- gdata_path, |
- gdata_path, |
- chromeos::MOUNT_TYPE_GDATA, |
- chromeos::disks::MOUNT_CONDITION_NONE); |
- // Raise mount event |
- FileBrowserEventRouterFactory::GetForProfile(profile_)-> |
- MountCompleted(DiskMountManager::MOUNTING, error_code, mount_info); |
-} |
- |
-void AddMountFunction::OnGDataAuthentication(gdata::GDataErrorCode error, |
- const std::string& token) { |
- RaiseGDataMountEvent(error); |
- SendResponse(true); |
-} |
- |
void AddMountFunction::GetLocalPathsResponseOnUIThread( |
const std::string& mount_type_str, |
const SelectedFileInfoList& files) { |