gecko-dev/widget/nsFilePickerProxy.h
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00

81 lines
2.7 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef NSFILEPICKERPROXY_H
#define NSFILEPICKERPROXY_H
#include "nsBaseFilePicker.h"
#include "nsString.h"
#include "nsIURI.h"
#include "nsTArray.h"
#include "nsCOMArray.h"
#include "mozilla/dom/PFilePickerChild.h"
class nsIWidget;
class nsIFile;
class nsPIDOMWindow;
namespace mozilla {
namespace dom {
class File;
} // namespace dom
} // namespace mozilla
/**
This class creates a proxy file picker to be used in content processes.
The file picker just collects the initialization data and when Show() is
called, remotes everything to the chrome process which in turn can show a
platform specific file picker.
*/
class nsFilePickerProxy : public nsBaseFilePicker,
public mozilla::dom::PFilePickerChild
{
public:
nsFilePickerProxy();
NS_DECL_ISUPPORTS
// nsIFilePicker (less what's in nsBaseFilePicker)
NS_IMETHODIMP Init(nsIDOMWindow* aParent, const nsAString& aTitle, int16_t aMode) override;
NS_IMETHODIMP AppendFilter(const nsAString& aTitle, const nsAString& aFilter) override;
NS_IMETHODIMP GetDefaultString(nsAString& aDefaultString) override;
NS_IMETHODIMP SetDefaultString(const nsAString& aDefaultString) override;
NS_IMETHODIMP GetDefaultExtension(nsAString& aDefaultExtension) override;
NS_IMETHODIMP SetDefaultExtension(const nsAString& aDefaultExtension) override;
NS_IMETHODIMP GetFilterIndex(int32_t* aFilterIndex) override;
NS_IMETHODIMP SetFilterIndex(int32_t aFilterIndex) override;
NS_IMETHODIMP GetFile(nsIFile** aFile) override;
NS_IMETHODIMP GetFileURL(nsIURI** aFileURL) override;
NS_IMETHODIMP GetFiles(nsISimpleEnumerator** aFiles) override;
NS_IMETHODIMP GetDomfile(nsISupports** aFile) override;
NS_IMETHODIMP GetDomfiles(nsISimpleEnumerator** aFiles) override;
NS_IMETHODIMP Show(int16_t* aReturn) override;
NS_IMETHODIMP Open(nsIFilePickerShownCallback* aCallback) override;
// PFilePickerChild
virtual bool
Recv__delete__(const MaybeInputFiles& aFiles, const int16_t& aResult) override;
private:
~nsFilePickerProxy();
void InitNative(nsIWidget*, const nsAString&) override;
nsTArray<RefPtr<mozilla::dom::File>> mDomfiles;
nsCOMPtr<nsIFilePickerShownCallback> mCallback;
int16_t mSelectedType;
nsString mFile;
nsString mDefault;
nsString mDefaultExtension;
InfallibleTArray<nsString> mFilters;
InfallibleTArray<nsString> mFilterNames;
};
#endif // NSFILEPICKERPROXY_H