|
1 /* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*- |
|
2 * This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef nsMIMEInfoAndroid_h |
|
7 #define nsMIMEInfoAndroid_h |
|
8 |
|
9 #include "nsMIMEInfoImpl.h" |
|
10 #include "nsIMutableArray.h" |
|
11 #include "nsAndroidHandlerApp.h" |
|
12 |
|
13 class nsMIMEInfoAndroid MOZ_FINAL : public nsIMIMEInfo |
|
14 { |
|
15 public: |
|
16 static bool |
|
17 GetMimeInfoForMimeType(const nsACString& aMimeType, |
|
18 nsMIMEInfoAndroid** aMimeInfo); |
|
19 static bool |
|
20 GetMimeInfoForFileExt(const nsACString& aFileExt, |
|
21 nsMIMEInfoAndroid** aMimeInfo); |
|
22 |
|
23 static nsresult |
|
24 GetMimeInfoForURL(const nsACString &aURL, bool *found, |
|
25 nsIHandlerInfo **info); |
|
26 |
|
27 NS_DECL_ISUPPORTS |
|
28 NS_DECL_NSIMIMEINFO |
|
29 NS_DECL_NSIHANDLERINFO |
|
30 |
|
31 nsMIMEInfoAndroid(const nsACString& aMIMEType); |
|
32 |
|
33 protected: |
|
34 virtual NS_HIDDEN_(nsresult) LaunchDefaultWithFile(nsIFile* aFile); |
|
35 virtual NS_HIDDEN_(nsresult) LoadUriInternal(nsIURI *aURI); |
|
36 nsCOMPtr<nsIMutableArray> mHandlerApps; |
|
37 nsCString mType; |
|
38 nsTArray<nsCString> mExtensions; |
|
39 bool mAlwaysAsk; |
|
40 nsHandlerInfoAction mPrefAction; |
|
41 nsString mDescription; |
|
42 nsCOMPtr<nsIHandlerApp> mPrefApp; |
|
43 |
|
44 class SystemChooser MOZ_FINAL : public nsIHandlerApp { |
|
45 public: |
|
46 NS_DECL_ISUPPORTS |
|
47 NS_DECL_NSIHANDLERAPP |
|
48 SystemChooser(nsMIMEInfoAndroid* aOuter): mOuter(aOuter) {}; |
|
49 |
|
50 private: |
|
51 nsMIMEInfoAndroid* mOuter; |
|
52 |
|
53 }; |
|
54 }; |
|
55 |
|
56 #endif /* nsMIMEInfoAndroid_h */ |