1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/uriloader/exthandler/gonk/nsOSHelperAppService.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- */ 1.5 +/* Copyright 2012 Mozilla Foundation and Mozilla contributors 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +#include "nsOSHelperAppService.h" 1.21 +#include "nsMIMEInfoImpl.h" 1.22 + 1.23 +class nsGonkMIMEInfo : public nsMIMEInfoImpl { 1.24 +public: 1.25 + nsGonkMIMEInfo(const nsACString& aMIMEType) : nsMIMEInfoImpl(aMIMEType) { } 1.26 + 1.27 +protected: 1.28 + virtual NS_HIDDEN_(nsresult) LoadUriInternal(nsIURI *aURI) { 1.29 + return NS_ERROR_NOT_IMPLEMENTED; 1.30 + } 1.31 +}; 1.32 + 1.33 +nsOSHelperAppService::nsOSHelperAppService() : nsExternalHelperAppService() 1.34 +{ 1.35 +} 1.36 + 1.37 +nsOSHelperAppService::~nsOSHelperAppService() 1.38 +{ 1.39 +} 1.40 + 1.41 +already_AddRefed<nsIMIMEInfo> 1.42 +nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType, 1.43 + const nsACString& aFileExt, 1.44 + bool* aFound) 1.45 +{ 1.46 + *aFound = false; 1.47 + // Even if we return false for aFound, we need to return a working 1.48 + // nsIMIMEInfo implementation that will be used by the caller. 1.49 + nsRefPtr<nsGonkMIMEInfo> mimeInfo = new nsGonkMIMEInfo(aMIMEType); 1.50 + return mimeInfo.forget(); 1.51 +} 1.52 + 1.53 +nsresult 1.54 +nsOSHelperAppService::OSProtocolHandlerExists(const char* aScheme, 1.55 + bool* aExists) 1.56 +{ 1.57 + *aExists = false; 1.58 + return NS_OK; 1.59 +}