78
static QString currentArchitecturePathName()
80
#if defined(Q_PROCESSOR_X86_32)
81
return QLatin1String("i386-linux-gnu");
82
#elif defined(Q_PROCESSOR_X86_64)
83
return QLatin1String("x86_64-linux-gnu");
84
#elif defined(Q_PROCESSOR_ARM)
85
return QLatin1String("arm-linux-gnueabihf");
87
#error Unable to determine target architecture
91
static bool canUseOxide()
93
// Use a runtime hint to transparently know if oxide
94
// can be used as a backend without the user/dev having
95
// to update its app or change something in the Exec args.
96
// Version 1.1 of ubuntu apparmor policy allows this file to
97
// be accessed whereas v1.0 only knows about qtwebkit.
98
QString oxideHintLocation =
99
QString("/usr/lib/%1/oxide-qt/oxide-renderer")
100
.arg(currentArchitecturePathName());
102
return QFile(oxideHintLocation).open(QIODevice::ReadOnly);
107
80
const QString WebappContainer::URL_PATTERN_SEPARATOR = ",";
111
84
WebappContainer::WebappContainer(int& argc, char** argv):
112
85
BrowserApplication(argc, argv),
113
m_withOxide(canUseOxide()),
114
86
m_storeSessionCookies(false),
115
87
m_backForwardButtonsVisible(false),
116
88
m_addressBarVisible(false),
146
120
m_window->setProperty("chromeVisible", m_addressBarVisible);
147
121
m_window->setProperty("accountProvider", m_accountProvider);
149
qDebug() << "Using" << (m_withOxide ? "Oxide" : "QtWebkit") << "as the web engine backend";
150
m_window->setProperty("oxide", m_withOxide);
152
123
m_window->setProperty("webappUrlPatterns", m_webappUrlPatterns);
153
124
QQmlContext* context = m_engine->rootContext();
154
125
if (m_storeSessionCookies) {
301
272
out << " --webappUrlPatterns=URL_PATTERNS list of comma-separated url patterns (wildcard based) that the webapp is allowed to navigate to" << endl;
302
273
out << " --accountProvider=PROVIDER_NAME Online account provider for the application if the application is to reuse a local account." << endl;
303
274
out << " --store-session-cookies store session cookies on disk" << endl;
275
out << " --enable-media-hub-audio enable media-hub for audio playback" << endl;
304
276
out << " --user-agent-string=USER_AGENT overrides the default User Agent with the provided one." << endl;
305
277
out << "Chrome options (if none specified, no chrome is shown by default):" << endl;
306
278
out << " --enable-back-forward enable the display of the back and forward buttons (implies --enable-addressbar)" << endl;
307
279
out << " --enable-addressbar enable the display of a minimal chrome (favicon and title)" << endl;
282
void WebappContainer::earlyEnvironment()
284
Q_FOREACH(const QString& argument, m_arguments) {
285
if (argument.startsWith("--enable-media-hub-audio")) {
286
qputenv("OXIDE_ENABLE_MEDIA_HUB_AUDIO", QString("1").toLocal8Bit().constData());
310
291
void WebappContainer::parseCommandLine()
312
293
Q_FOREACH(const QString& argument, m_arguments) {
313
if (argument == "--webkit") {
316
} else if (argument == "--oxide") {
319
} else if (argument.startsWith("--webappModelSearchPath=")) {
294
if (argument.startsWith("--webappModelSearchPath=")) {
320
295
m_webappModelSearchPath = argument.split("--webappModelSearchPath=")[1];
321
296
} else if (argument.startsWith("--webapp=")) {
322
297
// We use the name as a reference instead of the URL with a subsequent step to match it with a webapp.