Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=40: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef mozilla_dom_telephony_telephonycall_h__ |
michael@0 | 8 | #define mozilla_dom_telephony_telephonycall_h__ |
michael@0 | 9 | |
michael@0 | 10 | #include "mozilla/dom/telephony/TelephonyCommon.h" |
michael@0 | 11 | |
michael@0 | 12 | #include "mozilla/dom/DOMError.h" |
michael@0 | 13 | |
michael@0 | 14 | class nsPIDOMWindow; |
michael@0 | 15 | |
michael@0 | 16 | namespace mozilla { |
michael@0 | 17 | namespace dom { |
michael@0 | 18 | |
michael@0 | 19 | class TelephonyCall MOZ_FINAL : public DOMEventTargetHelper |
michael@0 | 20 | { |
michael@0 | 21 | nsRefPtr<Telephony> mTelephony; |
michael@0 | 22 | nsRefPtr<TelephonyCallGroup> mGroup; |
michael@0 | 23 | |
michael@0 | 24 | uint32_t mServiceId; |
michael@0 | 25 | nsString mNumber; |
michael@0 | 26 | nsString mSecondNumber; |
michael@0 | 27 | nsString mState; |
michael@0 | 28 | bool mEmergency; |
michael@0 | 29 | nsRefPtr<DOMError> mError; |
michael@0 | 30 | bool mSwitchable; |
michael@0 | 31 | bool mMergeable; |
michael@0 | 32 | |
michael@0 | 33 | uint32_t mCallIndex; |
michael@0 | 34 | uint16_t mCallState; |
michael@0 | 35 | bool mLive; |
michael@0 | 36 | |
michael@0 | 37 | public: |
michael@0 | 38 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 39 | NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper) |
michael@0 | 40 | NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TelephonyCall, |
michael@0 | 41 | DOMEventTargetHelper) |
michael@0 | 42 | |
michael@0 | 43 | friend class Telephony; |
michael@0 | 44 | |
michael@0 | 45 | nsPIDOMWindow* |
michael@0 | 46 | GetParentObject() const |
michael@0 | 47 | { |
michael@0 | 48 | return GetOwner(); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | // WrapperCache |
michael@0 | 52 | virtual JSObject* |
michael@0 | 53 | WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
michael@0 | 54 | |
michael@0 | 55 | // WebIDL |
michael@0 | 56 | void |
michael@0 | 57 | GetNumber(nsString& aNumber) const |
michael@0 | 58 | { |
michael@0 | 59 | aNumber.Assign(mNumber); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | void |
michael@0 | 63 | GetSecondNumber(nsString& aSecondNumber) const |
michael@0 | 64 | { |
michael@0 | 65 | aSecondNumber.Assign(mSecondNumber); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | void |
michael@0 | 69 | GetState(nsString& aState) const |
michael@0 | 70 | { |
michael@0 | 71 | aState.Assign(mState); |
michael@0 | 72 | } |
michael@0 | 73 | |
michael@0 | 74 | bool |
michael@0 | 75 | Emergency() const |
michael@0 | 76 | { |
michael@0 | 77 | return mEmergency; |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | bool |
michael@0 | 81 | Switchable() const |
michael@0 | 82 | { |
michael@0 | 83 | return mSwitchable; |
michael@0 | 84 | } |
michael@0 | 85 | |
michael@0 | 86 | bool |
michael@0 | 87 | Mergeable() const |
michael@0 | 88 | { |
michael@0 | 89 | return mMergeable; |
michael@0 | 90 | } |
michael@0 | 91 | |
michael@0 | 92 | already_AddRefed<DOMError> |
michael@0 | 93 | GetError() const; |
michael@0 | 94 | |
michael@0 | 95 | already_AddRefed<TelephonyCallGroup> |
michael@0 | 96 | GetGroup() const; |
michael@0 | 97 | |
michael@0 | 98 | void |
michael@0 | 99 | Answer(ErrorResult& aRv); |
michael@0 | 100 | |
michael@0 | 101 | void |
michael@0 | 102 | HangUp(ErrorResult& aRv); |
michael@0 | 103 | |
michael@0 | 104 | void |
michael@0 | 105 | Hold(ErrorResult& aRv); |
michael@0 | 106 | |
michael@0 | 107 | void |
michael@0 | 108 | Resume(ErrorResult& aRv); |
michael@0 | 109 | |
michael@0 | 110 | IMPL_EVENT_HANDLER(statechange) |
michael@0 | 111 | IMPL_EVENT_HANDLER(dialing) |
michael@0 | 112 | IMPL_EVENT_HANDLER(alerting) |
michael@0 | 113 | IMPL_EVENT_HANDLER(connecting) |
michael@0 | 114 | IMPL_EVENT_HANDLER(connected) |
michael@0 | 115 | IMPL_EVENT_HANDLER(disconnecting) |
michael@0 | 116 | IMPL_EVENT_HANDLER(disconnected) |
michael@0 | 117 | IMPL_EVENT_HANDLER(holding) |
michael@0 | 118 | IMPL_EVENT_HANDLER(held) |
michael@0 | 119 | IMPL_EVENT_HANDLER(resuming) |
michael@0 | 120 | IMPL_EVENT_HANDLER(error) |
michael@0 | 121 | IMPL_EVENT_HANDLER(groupchange) |
michael@0 | 122 | |
michael@0 | 123 | static already_AddRefed<TelephonyCall> |
michael@0 | 124 | Create(Telephony* aTelephony, uint32_t aServiceId, |
michael@0 | 125 | const nsAString& aNumber, uint16_t aCallState, |
michael@0 | 126 | uint32_t aCallIndex = telephony::kOutgoingPlaceholderCallIndex, |
michael@0 | 127 | bool aEmergency = false, bool aIsConference = false, |
michael@0 | 128 | bool aSwitchable = true, bool aMergeable = true); |
michael@0 | 129 | |
michael@0 | 130 | void |
michael@0 | 131 | ChangeState(uint16_t aCallState) |
michael@0 | 132 | { |
michael@0 | 133 | ChangeStateInternal(aCallState, true); |
michael@0 | 134 | } |
michael@0 | 135 | |
michael@0 | 136 | uint32_t |
michael@0 | 137 | ServiceId() const |
michael@0 | 138 | { |
michael@0 | 139 | return mServiceId; |
michael@0 | 140 | } |
michael@0 | 141 | |
michael@0 | 142 | uint32_t |
michael@0 | 143 | CallIndex() const |
michael@0 | 144 | { |
michael@0 | 145 | return mCallIndex; |
michael@0 | 146 | } |
michael@0 | 147 | |
michael@0 | 148 | void |
michael@0 | 149 | UpdateCallIndex(uint32_t aCallIndex) |
michael@0 | 150 | { |
michael@0 | 151 | NS_ASSERTION(mCallIndex == telephony::kOutgoingPlaceholderCallIndex, |
michael@0 | 152 | "Call index should not be set!"); |
michael@0 | 153 | mCallIndex = aCallIndex; |
michael@0 | 154 | } |
michael@0 | 155 | |
michael@0 | 156 | uint16_t |
michael@0 | 157 | CallState() const |
michael@0 | 158 | { |
michael@0 | 159 | return mCallState; |
michael@0 | 160 | } |
michael@0 | 161 | |
michael@0 | 162 | void |
michael@0 | 163 | UpdateEmergency(bool aEmergency) |
michael@0 | 164 | { |
michael@0 | 165 | mEmergency = aEmergency; |
michael@0 | 166 | } |
michael@0 | 167 | |
michael@0 | 168 | void |
michael@0 | 169 | UpdateSecondNumber(const nsAString& aNumber) |
michael@0 | 170 | { |
michael@0 | 171 | mSecondNumber = aNumber; |
michael@0 | 172 | } |
michael@0 | 173 | |
michael@0 | 174 | void |
michael@0 | 175 | UpdateSwitchable(bool aSwitchable) { |
michael@0 | 176 | mSwitchable = aSwitchable; |
michael@0 | 177 | } |
michael@0 | 178 | |
michael@0 | 179 | void |
michael@0 | 180 | UpdateMergeable(bool aMergeable) { |
michael@0 | 181 | mMergeable = aMergeable; |
michael@0 | 182 | } |
michael@0 | 183 | |
michael@0 | 184 | void |
michael@0 | 185 | NotifyError(const nsAString& aError); |
michael@0 | 186 | |
michael@0 | 187 | void |
michael@0 | 188 | ChangeGroup(TelephonyCallGroup* aGroup); |
michael@0 | 189 | |
michael@0 | 190 | private: |
michael@0 | 191 | TelephonyCall(nsPIDOMWindow* aOwner); |
michael@0 | 192 | |
michael@0 | 193 | ~TelephonyCall(); |
michael@0 | 194 | |
michael@0 | 195 | void |
michael@0 | 196 | ChangeStateInternal(uint16_t aCallState, bool aFireEvents); |
michael@0 | 197 | |
michael@0 | 198 | nsresult |
michael@0 | 199 | DispatchCallEvent(const nsAString& aType, |
michael@0 | 200 | TelephonyCall* aCall); |
michael@0 | 201 | }; |
michael@0 | 202 | |
michael@0 | 203 | } // namespace dom |
michael@0 | 204 | } // namespace mozilla |
michael@0 | 205 | |
michael@0 | 206 | #endif // mozilla_dom_telephony_telephonycall_h__ |