Debian Codegraph @

online-accounts-plugins/lib/LomiriOnlineAccountsPlugin/request-handler.cpp

raw symbols SCIP
1 /*
2 * This file is part of liblomiri-online-accounts-plugin
3 *
4 * Copyright (C) 2014 Canonical Ltd.
5 *
6 * Contact: Alberto Mardegan <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 3, as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "request-handler.h"cxx . . $ `<file>/online-accounts-plugins/lib/LomiriOnlineAccountsPlugin/request-handler.h`/
22
23 #include <SignOn/uisessiondata_priv.h>
24 #include <QDebug>
25 #include <QList>
26 #include <QPointer>
27 #include <unistd.h>
28
29 using namespace SignOnUi;
30
31 namespace SignOnUicxx . . $ SignOnUi/ {
32
33 static QListcxx . . $ QList#<RequestHandlercxx . . $ SignOnUi/RequestHandler# *> allRequestHandlerscxx . . $ SignOnUi/allRequestHandlers.;
34 static int countercxx . . $ SignOnUi/counter. = 1;
35
36 class RequestHandlerPrivatecxx . . $ SignOnUi/RequestHandlerPrivate#
37 {
38 Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(RequestHandler)
39
40 public:
41 RequestHandlerPrivatecxx . . $ SignOnUi/RequestHandlerPrivate#RequestHandlerPrivate(33a36a88f472ca4b).(RequestHandlercxx . . $ SignOnUi/RequestHandler# *request);
42 ~cxx . . $ SignOnUi/RequestHandlerPrivate#`~RequestHandlerPrivate`(ced63f7c635d850d).RequestHandlerPrivatecxx . . $ SignOnUi/RequestHandlerPrivate#();
43
44 private:
45 QStringcxx . . $ QString# m_matchIdcxx . . $ SignOnUi/RequestHandlerPrivate#m_matchId.;
46 QPointercxx . . $ QPointer#<QObjectcxx . . $ QObject#> m_requestcxx . . $ SignOnUi/RequestHandlerPrivate#m_request.;
47 mutable RequestHandlercxx . . $ SignOnUi/RequestHandler# *q_ptrcxx . . $ SignOnUi/RequestHandlerPrivate#q_ptr.;
48 };
49
50 class RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#
51 {
52 Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(RequestHandlerWatcher)
53
54 public:
55 RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#RequestHandlerWatcherPrivate(f009474fc38f8818).(RequestHandlerWatchercxx . . $ SignOnUi/RequestHandlerWatcher# *watcher);
56 ~cxx . . $ SignOnUi/RequestHandlerWatcherPrivate#`~RequestHandlerWatcherPrivate`(ced63f7c635d850d).RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#();
57
58 static RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate# *instancecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#instance(d1d1f0a87f3913f3).();
59 void registerHandlercxx . . $ SignOnUi/RequestHandlerWatcherPrivate#registerHandler(33a36a88f472ca4b).(RequestHandlercxx . . $ SignOnUi/RequestHandler# *handler);
60
61 private:
62 mutable RequestHandlerWatchercxx . . $ SignOnUi/RequestHandlerWatcher# *q_ptrcxx . . $ SignOnUi/RequestHandlerWatcherPrivate#q_ptr.;
63 static RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate# *m_instancecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#m_instance.;
64 };
65
66 RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate# *RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#::m_instancecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#m_instance. = 0;
67
68 } // namespace
69
70 RequestHandlerPrivatecxx . . $ SignOnUi/RequestHandlerPrivate#::RequestHandlerPrivatecxx . . $ SignOnUi/RequestHandlerPrivate#RequestHandlerPrivate(33a36a88f472ca4b).(RequestHandlercxx . . $ SignOnUi/RequestHandler# *request):
71 q_ptrcxx . . $ SignOnUi/RequestHandlerPrivate#q_ptr.(request)
72 {
73 m_matchIdcxx . . $ SignOnUi/RequestHandlerPrivate#m_matchId. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1-%2").argcxx . . $ QString#arg(64ab2ed17cc11715).(getpid()).argcxx . . $ QString#arg(64ab2ed17cc11715).(countercxx . . $ SignOnUi/counter.++);
74 }
75
76 RequestHandlerPrivatecxx . . $ SignOnUi/RequestHandlerPrivate#::~cxx . . $ SignOnUi/RequestHandlerPrivate#`~RequestHandlerPrivate`(ced63f7c635d850d).RequestHandlerPrivatecxx . . $ SignOnUi/RequestHandlerPrivate#()
77 {
78 }
79
80 RequestHandlercxx . . $ SignOnUi/RequestHandler#::RequestHandlercxx . . $ SignOnUi/RequestHandler#RequestHandler(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *parent):
81 QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent),
82 d_ptrcxx . . $ SignOnUi/RequestHandler#d_ptr.(new RequestHandlerPrivatecxx . . $ SignOnUi/RequestHandlerPrivate#RequestHandlerPrivate(33a36a88f472ca4b).(this))
83 {
84 allRequestHandlerscxx . . $ SignOnUi/allRequestHandlers..appendcxx . . $ QList#append(77d9f17553126ecb).(this);
85
86 RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate# *watcher =
87 RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#::instancecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#instance(d1d1f0a87f3913f3).();
88 if (Q_LIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:246:11`!(watcher)) {
89 watcher->registerHandlercxx . . $ SignOnUi/RequestHandlerWatcherPrivate#registerHandler(33a36a88f472ca4b).(this);
90 }
91 }
92
93 RequestHandlercxx . . $ SignOnUi/RequestHandler#::~cxx . . $ SignOnUi/RequestHandler#`~RequestHandler`(ced63f7c635d850d).RequestHandlercxx . . $ SignOnUi/RequestHandler#()
94 {
95 allRequestHandlerscxx . . $ SignOnUi/allRequestHandlers..removeOnecxx . . $ QList#removeOne(fe1ba53999e710f3).(this);
96 delete d_ptrcxx . . $ SignOnUi/RequestHandler#d_ptr.;
97 }
98
99 void RequestHandlercxx . . $ SignOnUi/RequestHandler#::setRequestcxx . . $ SignOnUi/RequestHandler#setRequest(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *request)
100 {
101 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(RequestHandler);
102
103 if (request ==cxx . . $ `operator==`(4a5b7cdf3c1bd30d). d->m_requestcxx . . $ SignOnUi/RequestHandlerPrivate#m_request.) return;
104
105 if (d->m_requestcxx . . $ SignOnUi/RequestHandlerPrivate#m_request. != 0 && request != 0) {
106 qCriticalcxx . . $ `<external>/10450329605257866924/qlogging.h:167:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "RequestHandler is already assigned a request";
107 return;
108 }
109 d->m_requestcxx . . $ SignOnUi/RequestHandlerPrivate#m_request. =cxx . . $ QPointer#`operator=`(500fb76d9e491ab0). request;
110 Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! requestChangedcxx . . $ SignOnUi/RequestHandler#requestChanged(49f6e7a06ebc5aa8).();
111 }
112
113 QObjectcxx . . $ QObject# *RequestHandlercxx . . $ SignOnUi/RequestHandler#::requestcxx . . $ SignOnUi/RequestHandler#request(2dbb680a34285c44).() const
114 {
115 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const RequestHandler);
116 return d->m_requestcxx . . $ SignOnUi/RequestHandlerPrivate#m_request.;
117 }
118
119 QStringcxx . . $ QString# RequestHandlercxx . . $ SignOnUi/RequestHandler#::matchIdcxx . . $ SignOnUi/RequestHandler#matchId(6ef7b6c27b00b43d).() const
120 {
121 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const RequestHandler);
122 return dcxx . . $ QString#QString(132dd6869045752b).->m_matchIdcxx . . $ SignOnUi/RequestHandlerPrivate#m_matchId.;
123 }
124
125 RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#::RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#RequestHandlerWatcherPrivate(f009474fc38f8818).(RequestHandlerWatchercxx . . $ SignOnUi/RequestHandlerWatcher# *watcher):
126 q_ptrcxx . . $ SignOnUi/RequestHandlerWatcherPrivate#q_ptr.(watcher)
127 {
128 if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(m_instance)) {
129 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "RequestHandlerWatcher should be instantiated once!";
130 }
131
132 m_instancecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#m_instance. = this;
133 }
134
135 RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#::~cxx . . $ SignOnUi/RequestHandlerWatcherPrivate#`~RequestHandlerWatcherPrivate`(ced63f7c635d850d).RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#()
136 {
137 m_instancecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#m_instance. = 0;
138 }
139
140 RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate# *RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#::instancecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#instance(d1d1f0a87f3913f3).()
141 {
142 return m_instancecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#m_instance.;
143 }
144
145 void RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#::registerHandlercxx . . $ SignOnUi/RequestHandlerWatcherPrivate#registerHandler(33a36a88f472ca4b).(RequestHandlercxx . . $ SignOnUi/RequestHandler# *handler)
146 {
147 Q_Qcxx . . $ `<external>/15045578679651060896/qglobal.h:1178:9`!(RequestHandlerWatcher);
148
149 Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! q->newHandlercxx . . $ SignOnUi/RequestHandlerWatcher#newHandler(33a36a88f472ca4b).(handler);
150 }
151
152 RequestHandlerWatchercxx . . $ SignOnUi/RequestHandlerWatcher#::RequestHandlerWatchercxx . . $ SignOnUi/RequestHandlerWatcher#RequestHandlerWatcher(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *parent):
153 QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent),
154 d_ptrcxx . . $ SignOnUi/RequestHandlerWatcher#d_ptr.(new RequestHandlerWatcherPrivatecxx . . $ SignOnUi/RequestHandlerWatcherPrivate#RequestHandlerWatcherPrivate(f009474fc38f8818).(this))
155 {
156 }
157
158 RequestHandlerWatchercxx . . $ SignOnUi/RequestHandlerWatcher#::~cxx . . $ SignOnUi/RequestHandlerWatcher#`~RequestHandlerWatcher`(ced63f7c635d850d).RequestHandlerWatchercxx . . $ SignOnUi/RequestHandlerWatcher#()
159 {
160 delete d_ptrcxx . . $ SignOnUi/RequestHandlerWatcher#d_ptr.;
161 }
162
163 RequestHandlercxx . . $ SignOnUi/RequestHandler# *RequestHandlerWatchercxx . . $ SignOnUi/RequestHandlerWatcher#::findMatchingcxx . . $ SignOnUi/RequestHandlerWatcher#findMatching(f85eb24b3e476fd).(const QVariantMapcxx . . $ QVariantMap# &parameters)
164 {
165 /* Find if there's any RequestHandler expecting to handle the SignOnUi
166 * request having "parameters" as parameters.
167 * This is simply done by matching on the X-RequestHandler key (aka
168 * matchKey()), if present. We expect that account plugins add that field
169 * to their AuthSession requests which they want to handle themselves.
170 */
171 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ `operator<<`(d06749710cb27f7f). parameters;
172 if (!parameters.containscxx . . $ QMap#contains(8877ebe272b9620d).(SSOUI_KEY_CLIENT_DATAcxx . . $ `<external>/351535377674478989/uisessiondata_priv.h:72:9`!)) return 0;
173 QVariantMapcxx . . $ QVariantMap# clientData = parameters[cxx . . $ QMap#`operator[]`(bfda1f1f965926d4).SSOUI_KEY_CLIENT_DATAcxx . . $ `<external>/351535377674478989/uisessiondata_priv.h:72:9`!].toMapcxx . . $ QVariant#toMap(87f780dbe64191c4).();
174 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "client data:" <<cxx . . $ `operator<<`(d06749710cb27f7f). clientData;
175 QStringcxx . . $ QString# matchId = clientData.valuecxx . . $ QMap#value(866b0a4e5fb46e14).(RequestHandlercxx . . $ SignOnUi/RequestHandler#::matchKeycxx . . $ SignOnUi/RequestHandler#matchKey(4365c3963150523e).()).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).();
176 if (matchId.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) return 0;
177
178 Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(RequestHandler *handler, allRequestHandlers) {
179 if (handler->matchIdcxx . . $ SignOnUi/RequestHandler#matchId(6ef7b6c27b00b43d).() ==cxx . . $ `operator==`(5bc2975d2d751687). matchId) return handler;
180 }
181 return 0;
182 }