|
1 /* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- */ |
|
2 /* Copyright 2012 Mozilla Foundation and Mozilla contributors |
|
3 * |
|
4 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 * you may not use this file except in compliance with the License. |
|
6 * You may obtain a copy of the License at |
|
7 * |
|
8 * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 * |
|
10 * Unless required by applicable law or agreed to in writing, software |
|
11 * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 * See the License for the specific language governing permissions and |
|
14 * limitations under the License. |
|
15 */ |
|
16 |
|
17 #include "nsOSHelperAppService.h" |
|
18 #include "nsMIMEInfoImpl.h" |
|
19 |
|
20 class nsGonkMIMEInfo : public nsMIMEInfoImpl { |
|
21 public: |
|
22 nsGonkMIMEInfo(const nsACString& aMIMEType) : nsMIMEInfoImpl(aMIMEType) { } |
|
23 |
|
24 protected: |
|
25 virtual NS_HIDDEN_(nsresult) LoadUriInternal(nsIURI *aURI) { |
|
26 return NS_ERROR_NOT_IMPLEMENTED; |
|
27 } |
|
28 }; |
|
29 |
|
30 nsOSHelperAppService::nsOSHelperAppService() : nsExternalHelperAppService() |
|
31 { |
|
32 } |
|
33 |
|
34 nsOSHelperAppService::~nsOSHelperAppService() |
|
35 { |
|
36 } |
|
37 |
|
38 already_AddRefed<nsIMIMEInfo> |
|
39 nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType, |
|
40 const nsACString& aFileExt, |
|
41 bool* aFound) |
|
42 { |
|
43 *aFound = false; |
|
44 // Even if we return false for aFound, we need to return a working |
|
45 // nsIMIMEInfo implementation that will be used by the caller. |
|
46 nsRefPtr<nsGonkMIMEInfo> mimeInfo = new nsGonkMIMEInfo(aMIMEType); |
|
47 return mimeInfo.forget(); |
|
48 } |
|
49 |
|
50 nsresult |
|
51 nsOSHelperAppService::OSProtocolHandlerExists(const char* aScheme, |
|
52 bool* aExists) |
|
53 { |
|
54 *aExists = false; |
|
55 return NS_OK; |
|
56 } |