mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 777078 - Remove DeviceStorage .type. r=sicking
This commit is contained in:
parent
7f0d522454
commit
eff790f6d1
@ -30,7 +30,7 @@ public:
|
||||
|
||||
nsresult Init(nsPIDOMWindow* aWindow, const nsAString &aType, const PRInt32 aIndex);
|
||||
|
||||
PRInt32 SetRootFileForType(const nsAString& aType, const PRInt32 aIndex);
|
||||
void SetRootFileForType(const nsAString& aType, const PRInt32 aIndex);
|
||||
|
||||
static void CreateDeviceStoragesFor(nsPIDOMWindow* aWin,
|
||||
const nsAString &aType,
|
||||
|
@ -279,14 +279,9 @@ DeviceStorageFile::collectFilesInternal(nsTArray<nsRefPtr<DeviceStorageFile> > &
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS0(DeviceStorageFile)
|
||||
|
||||
|
||||
// TODO - eventually, we will want to factor this method
|
||||
// out into different system specific subclasses (or
|
||||
// something)
|
||||
PRInt32
|
||||
void
|
||||
nsDOMDeviceStorage::SetRootFileForType(const nsAString& aType, const PRInt32 aIndex)
|
||||
{
|
||||
PRInt32 typeResult = DEVICE_STORAGE_TYPE_DEFAULT;
|
||||
|
||||
nsCOMPtr<nsIFile> f;
|
||||
nsCOMPtr<nsIProperties> dirService = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
|
||||
NS_ASSERTION(dirService, "Must have directory service");
|
||||
@ -296,21 +291,21 @@ nsDOMDeviceStorage::SetRootFileForType(const nsAString& aType, const PRInt32 aIn
|
||||
|
||||
nsCOMPtr<nsIVolumeService> vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID);
|
||||
if (!vs) {
|
||||
return typeResult;
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIVolume> v;
|
||||
vs->GetVolumeByPath(NS_LITERAL_STRING("/sdcard"), getter_AddRefs(v));
|
||||
|
||||
if (!v) {
|
||||
return typeResult;
|
||||
return;
|
||||
}
|
||||
|
||||
PRInt32 state;
|
||||
v->GetState(&state);
|
||||
|
||||
if (state != nsIVolume::STATE_MOUNTED) {
|
||||
return typeResult;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -380,7 +375,6 @@ nsDOMDeviceStorage::SetRootFileForType(const nsAString& aType, const PRInt32 aIn
|
||||
}
|
||||
|
||||
mFile = f;
|
||||
return typeResult;
|
||||
}
|
||||
|
||||
static jsval nsIFileToJsval(nsPIDOMWindow* aWindow, DeviceStorageFile* aFile)
|
||||
@ -1320,8 +1314,7 @@ NS_IMPL_ADDREF_INHERITED(nsDOMDeviceStorage, nsDOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMDeviceStorage, nsDOMEventTargetHelper)
|
||||
|
||||
nsDOMDeviceStorage::nsDOMDeviceStorage()
|
||||
: mStorageType(DEVICE_STORAGE_TYPE_DEFAULT)
|
||||
, mIsWatchingFile(false)
|
||||
: mIsWatchingFile(false)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
@ -1329,7 +1322,7 @@ nsDOMDeviceStorage::Init(nsPIDOMWindow* aWindow, const nsAString &aType, const P
|
||||
{
|
||||
NS_ASSERTION(aWindow, "Must have a content dom");
|
||||
|
||||
mStorageType = SetRootFileForType(aType, aIndex);
|
||||
SetRootFileForType(aType, aIndex);
|
||||
if (!mFile) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
@ -1387,24 +1380,6 @@ nsDOMDeviceStorage::CreateDeviceStoragesFor(nsPIDOMWindow* aWin,
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceStorage::GetType(nsAString & aType)
|
||||
{
|
||||
switch(mStorageType) {
|
||||
case DEVICE_STORAGE_TYPE_EXTERNAL:
|
||||
aType.AssignLiteral("external");
|
||||
break;
|
||||
case DEVICE_STORAGE_TYPE_SHARED:
|
||||
aType.AssignLiteral("shared");
|
||||
break;
|
||||
case DEVICE_STORAGE_TYPE_DEFAULT:
|
||||
default:
|
||||
aType.AssignLiteral("default");
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceStorage::Add(nsIDOMBlob *aBlob, nsIDOMDOMRequest * *_retval)
|
||||
{
|
||||
|
@ -15,14 +15,9 @@ dictionary DeviceStorageEnumerationParameters
|
||||
jsval since;
|
||||
};
|
||||
|
||||
[scriptable, uuid(f57450db-07df-44ac-bf34-7ee65fe17b26), builtinclass]
|
||||
[scriptable, uuid(3dbe0137-ca73-44c5-bcde-25c297bf7c65), builtinclass]
|
||||
interface nsIDOMDeviceStorage : nsIDOMEventTarget
|
||||
{
|
||||
/*
|
||||
* Hint as to what kind of storage this object is.
|
||||
* May be "external", "shared", or "default".
|
||||
*/
|
||||
readonly attribute DOMString type;
|
||||
attribute nsIDOMEventListener onchange;
|
||||
nsIDOMDOMRequest add(in nsIDOMBlob aBlob);
|
||||
nsIDOMDOMRequest addNamed(in nsIDOMBlob aBlob, in DOMString aName);
|
||||
|
Loading…
Reference in New Issue
Block a user