зеркало из https://github.com/mozilla/gecko-dev.git
Bug 949666 - Save last used upload dir with e10s. r=billm
This commit is contained in:
Родитель
f2786d3f9f
Коммит
2ee03971b2
|
@ -1032,11 +1032,12 @@ UploadLastDir::FetchDirectoryAndDisplayPicker(nsIDocument* aDoc,
|
|||
nsCOMPtr<nsIContentPrefCallback2> prefCallback =
|
||||
new UploadLastDir::ContentPrefCallback(aFilePicker, aFpCallback);
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
// FIXME (bug 949666): Run this code in the parent process.
|
||||
prefCallback->HandleCompletion(nsIContentPrefCallback2::COMPLETE_ERROR);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Attempt to get the CPS, if it's not present we'll fallback to use the Desktop folder
|
||||
nsCOMPtr<nsIContentPrefService2> contentPrefService =
|
||||
|
@ -1062,10 +1063,11 @@ UploadLastDir::StoreLastUsedDirectory(nsIDocument* aDoc, nsIFile* aDir)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
// FIXME (bug 949666): Run this code in the parent process.
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIURI> docURI = aDoc->GetDocumentURI();
|
||||
NS_PRECONDITION(docURI, "docURI is null");
|
||||
|
|
|
@ -202,7 +202,8 @@ FilePickerParent::RecvOpen(const int16_t& aSelectedType,
|
|||
const nsString& aDefaultFile,
|
||||
const nsString& aDefaultExtension,
|
||||
const InfallibleTArray<nsString>& aFilters,
|
||||
const InfallibleTArray<nsString>& aFilterNames)
|
||||
const InfallibleTArray<nsString>& aFilterNames,
|
||||
const nsString& aDisplayDirectory)
|
||||
{
|
||||
if (!CreateFilePicker()) {
|
||||
unused << Send__delete__(this, void_t(), nsIFilePicker::returnCancel);
|
||||
|
@ -219,6 +220,14 @@ FilePickerParent::RecvOpen(const int16_t& aSelectedType,
|
|||
mFilePicker->SetDefaultExtension(aDefaultExtension);
|
||||
mFilePicker->SetFilterIndex(aSelectedType);
|
||||
|
||||
if (!aDisplayDirectory.IsEmpty()) {
|
||||
nsCOMPtr<nsIFile> localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
|
||||
if (localFile) {
|
||||
localFile->InitWithPath(aDisplayDirectory);
|
||||
mFilePicker->SetDisplayDirectory(localFile);
|
||||
}
|
||||
}
|
||||
|
||||
mCallback = new FilePickerShownCallback(this);
|
||||
|
||||
mFilePicker->Open(mCallback);
|
||||
|
|
|
@ -36,7 +36,8 @@ class FilePickerParent : public PFilePickerParent
|
|||
const nsString& aDefaultFile,
|
||||
const nsString& aDefaultExtension,
|
||||
const InfallibleTArray<nsString>& aFilters,
|
||||
const InfallibleTArray<nsString>& aFilterNames) MOZ_OVERRIDE;
|
||||
const InfallibleTArray<nsString>& aFilterNames,
|
||||
const nsString& aDisplayDirectory) MOZ_OVERRIDE;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ protocol PFilePicker
|
|||
|
||||
parent:
|
||||
Open(int16_t selectedType, bool addToRecentDocs, nsString defaultFile,
|
||||
nsString defaultExtension, nsString[] filters, nsString[] filterNames);
|
||||
nsString defaultExtension, nsString[] filters, nsString[] filterNames,
|
||||
nsString displayDirectory);
|
||||
|
||||
child:
|
||||
__delete__(MaybeInputFiles files, int16_t result);
|
||||
|
|
|
@ -136,8 +136,13 @@ nsFilePickerProxy::Open(nsIFilePickerShownCallback* aCallback)
|
|||
{
|
||||
mCallback = aCallback;
|
||||
|
||||
SendOpen(mSelectedType, mAddToRecentDocs, mDefault,
|
||||
mDefaultExtension, mFilters, mFilterNames);
|
||||
nsString displayDirectory;
|
||||
if (mDisplayDirectory) {
|
||||
mDisplayDirectory->GetPath(displayDirectory);
|
||||
}
|
||||
|
||||
SendOpen(mSelectedType, mAddToRecentDocs, mDefault, mDefaultExtension,
|
||||
mFilters, mFilterNames, displayDirectory);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче