Skip to content

Commit

Permalink
Merge pull request #3 from MozCloudStorage/cloud
Browse files Browse the repository at this point in the history
CloudStorageServiceAPI and CloudStorageManager integration
  • Loading branch information
edenchuang committed May 13, 2015
2 parents 0785508 + 73fe08e commit 1fbc5f1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
12 changes: 12 additions & 0 deletions dom/cloudstorage/CloudStorageRequestParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#include "CloudStorageRequestParent.h"
#include "CloudStorageLog.h"
#include "CloudStorageManager.h"

using namespace mozilla::system::cloudstorage;

namespace mozilla {
namespace dom {
Expand All @@ -28,11 +31,20 @@ CloudStorageRequestParent::HandleRequest(const CloudStorageRequest& aRequest)
case CloudStorageRequest::TEnableStorageRequest: {
// handle enable request here
LOG("Handle enable cloud storage request");
EnableStorageRequest enableReq = aRequest.get_EnableStorageRequest();
LOG("cloud name: %s, type: %d, accessToken: %s", NS_ConvertUTF16toUTF8(enableReq.cloudName()).get()
, enableReq.cloudType()
, NS_ConvertUTF16toUTF8(enableReq.accessToken()).get());
CloudStorageManager::FindAddCloudStorageByName(NS_ConvertUTF16toUTF8(enableReq.cloudName()));
CloudStorageManager::StartCloudStorage(NS_ConvertUTF16toUTF8(enableReq.cloudName()));
return true;
}
case CloudStorageRequest::TDisableStorageRequest: {
// handle disable request here
LOG("Handle disable cloud storage request");
DisableStorageRequest disableReq = aRequest.get_DisableStorageRequest();
LOG("cloud name: %s", NS_ConvertUTF16toUTF8(disableReq.cloudName()).get());
CloudStorageManager::StopCloudStorage(NS_ConvertUTF16toUTF8(disableReq.cloudName()));
return true;
}
default: MOZ_CRASH("Unknown type!"); return false;
Expand Down
4 changes: 4 additions & 0 deletions dom/system/gonk/AutoMounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@
#include "VolumeManager.h"
#include "nsIStatusReporter.h"

#include "CloudStorageManager.h"

using namespace mozilla::hal;
USING_MTP_NAMESPACE
using namespace mozilla::system::cloudstorage;

/**************************************************************************
*
Expand Down Expand Up @@ -1396,6 +1399,7 @@ static StaticRefPtr<AutoMounterSetting> sAutoMounterSetting;
void
InitAutoMounter()
{
InitCloudStorageManager();
InitVolumeManager();
sAutoMounterSetting = new AutoMounterSetting();

Expand Down
9 changes: 4 additions & 5 deletions dom/system/gonk/cloudstorage/CloudStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,15 @@ class CloudStorageRunnable : public nsRunnable
/*
RefPtr<Volume> vol = VolumeManager::FindAddVolumeByName(mCloudStorage->Name());
vol->SetCloudVolume(mCloudStorage->MountPoint());
*/
while (mCloudStorage->State() == CloudStorage::STATE_RUNNING) {
handler->HandleOneRequest();
//handler->HandleOneRequest();
sleep(1);
}
LOG("Stop cloud storage %s.", mCloudStorage->Name().get());
vol->Dump("CloudStorageRunnable");
handler->Close();
*/
} else {
LOG("Construct cloud storage handler fail");
}
delete handler;
LOG("going to finish RequestHandler.");
return NS_OK;
}
Expand Down
1 change: 1 addition & 0 deletions dom/system/gonk/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ LOCAL_INCLUDES += [
'/dom/base',
'/dom/bluetooth',
'/dom/geolocation',
'/dom/system/gonk/cloudstorage',
'/dom/wifi',
]

Expand Down

0 comments on commit 1fbc5f1

Please sign in to comment.