mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1081810 - Part 1: Implement IccCardLockError in C++. r=smaug
This commit is contained in:
parent
2d80518cfd
commit
42a597087e
48
dom/icc/IccCardLockError.cpp
Normal file
48
dom/icc/IccCardLockError.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
/* 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/. */
|
||||
|
||||
#include "mozilla/dom/IccCardLockError.h"
|
||||
#include "mozilla/dom/IccCardLockErrorBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(IccCardLockError, DOMError)
|
||||
|
||||
/* static */ already_AddRefed<IccCardLockError>
|
||||
IccCardLockError::Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aLockType,
|
||||
const nsAString& aName,
|
||||
int16_t aRetryCount,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!window) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<IccCardLockError> result =
|
||||
new IccCardLockError(window, aName, aLockType, aRetryCount);
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
IccCardLockError::IccCardLockError(nsPIDOMWindow* aWindow,
|
||||
const nsAString& aName,
|
||||
const nsAString& aLockType,
|
||||
int16_t aRetryCount)
|
||||
: DOMError(aWindow, aName)
|
||||
, mLockType(aLockType)
|
||||
, mRetryCount(aRetryCount)
|
||||
{
|
||||
}
|
||||
|
||||
JSObject*
|
||||
IccCardLockError::WrapObject(JSContext* aCx)
|
||||
{
|
||||
return IccCardLockErrorBinding::Wrap(aCx, this);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
54
dom/icc/IccCardLockError.h
Normal file
54
dom/icc/IccCardLockError.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* 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 mozilla_dom_IccCardLockError_h
|
||||
#define mozilla_dom_IccCardLockError_h
|
||||
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class IccCardLockError MOZ_FINAL : public DOMError
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
IccCardLockError(nsPIDOMWindow* aWindow, const nsAString& aName,
|
||||
const nsAString& aLockType, int16_t aRetryCount);
|
||||
|
||||
static already_AddRefed<IccCardLockError>
|
||||
Constructor(const GlobalObject& aGlobal, const nsAString& aLockType,
|
||||
const nsAString& aName, int16_t aRetryCount,
|
||||
ErrorResult& aRv);
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL interface
|
||||
|
||||
void
|
||||
GetLockType(nsString& aLockType) const
|
||||
{
|
||||
aLockType = mLockType;
|
||||
}
|
||||
|
||||
int16_t
|
||||
RetryCount() const
|
||||
{
|
||||
return mRetryCount;
|
||||
}
|
||||
|
||||
private:
|
||||
~IccCardLockError() {}
|
||||
|
||||
private:
|
||||
nsString mLockType;
|
||||
int16_t mRetryCount;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_IccCardLockError_h
|
@ -8,6 +8,7 @@ DIRS += ['interfaces']
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'Icc.h',
|
||||
'IccCardLockError.h',
|
||||
'IccInfo.h',
|
||||
'IccManager.h',
|
||||
]
|
||||
@ -15,6 +16,7 @@ EXPORTS.mozilla.dom += [
|
||||
UNIFIED_SOURCES += [
|
||||
'Assertions.cpp',
|
||||
'Icc.cpp',
|
||||
'IccCardLockError.cpp',
|
||||
"IccInfo.cpp",
|
||||
'IccListener.cpp',
|
||||
'IccManager.cpp',
|
||||
|
@ -41,8 +41,6 @@ function debug(s) {
|
||||
|
||||
const RILCONTENTHELPER_CID =
|
||||
Components.ID("{472816e1-1fd6-4405-996c-806f9ea68174}");
|
||||
const ICCCARDLOCKERROR_CID =
|
||||
Components.ID("{08a71987-408c-44ff-93fd-177c0a85c3dd}");
|
||||
|
||||
const RIL_IPC_MSG_NAMES = [
|
||||
"RIL:CardStateChanged",
|
||||
@ -136,20 +134,6 @@ CdmaIccInfo.prototype = {
|
||||
prlVersion: 0
|
||||
};
|
||||
|
||||
function IccCardLockError() {
|
||||
}
|
||||
IccCardLockError.prototype = {
|
||||
classDescription: "IccCardLockError",
|
||||
classID: ICCCARDLOCKERROR_CID,
|
||||
contractID: "@mozilla.org/dom/icccardlock-error;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
|
||||
__init: function(lockType, errorMsg, retryCount) {
|
||||
this.__DOM_IMPL__.init(errorMsg);
|
||||
this.lockType = lockType;
|
||||
this.retryCount = retryCount;
|
||||
},
|
||||
};
|
||||
|
||||
function RILContentHelper() {
|
||||
this.updateDebugFlag();
|
||||
|
||||
@ -847,5 +831,4 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RILContentHelper,
|
||||
IccCardLockError]);
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RILContentHelper]);
|
||||
|
@ -19,7 +19,5 @@ category profile-after-change RadioInterfaceLayer @mozilla.org/ril;1
|
||||
|
||||
# RILContentHelper.js
|
||||
component {472816e1-1fd6-4405-996c-806f9ea68174} RILContentHelper.js
|
||||
component {08a71987-408c-44ff-93fd-177c0a85c3dd} RILContentHelper.js
|
||||
contract @mozilla.org/ril/content-helper;1 {472816e1-1fd6-4405-996c-806f9ea68174}
|
||||
contract @mozilla.org/dom/icccardlock-error;1 {08a71987-408c-44ff-93fd-177c0a85c3dd}
|
||||
category profile-after-change RILContentHelper @mozilla.org/ril/content-helper;1
|
||||
|
@ -1,11 +1,10 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*/
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
[JSImplementation="@mozilla.org/dom/icccardlock-error;1",
|
||||
Constructor(DOMString lockType, DOMString errorName, short retryCount)]
|
||||
[Constructor(DOMString lockType, DOMString errorName, short retryCount),
|
||||
Pref="dom.icc.enabled"]
|
||||
interface IccCardLockError : DOMError {
|
||||
readonly attribute DOMString lockType;
|
||||
readonly attribute short retryCount;
|
||||
|
Loading…
Reference in New Issue
Block a user