| 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 c52d35102109abd52c973e15721189a0a5101252..c0ec4162770324195d05f46548934bbb0d8f2422 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)) {
|
| }
|
|
|
| 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) {
|
|
|