~ubuntu-branches/ubuntu/wily/unity-webapps-qml/wily-proposed

« back to all changes in this revision

Viewing changes to src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Ubuntu daily release, Alexandre Abreu
  • Date: 2014-05-06 17:27:01 UTC
  • mfrom: (1.1.29)
  • Revision ID: package-import@ubuntu.com-20140506172701-mmffqu27v3s2y500
Tags: 0.1+14.10.20140506.1-0ubuntu1
[ Ubuntu daily release ]
* New rebuild forced

[ Alexandre Abreu ]
* Add UA override capabilities to webapps; clean some code and tests,
  (LP: #1245465)

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
        roles[Urls] = "urls";
155
155
        roles[ScriptsContent] = "content";
156
156
        roles[Scripts] = "scripts";
 
157
        roles[Chrome] = "chrome";
 
158
        roles[UserAgentOverride] = "useragent";
157
159
      }
158
160
    return roles;
159
161
}
301
303
    return script;
302
304
}
303
305
 
 
306
QString
 
307
UnityWebappsAppModel::userAgentOverrideFor(const QString & webappName) const
 
308
{
 
309
    if (!exists(webappName))
 
310
        return QString();
 
311
 
 
312
    int idx = getWebappIndex(webappName);
 
313
    if (Q_UNLIKELY(idx == -1))
 
314
    {
 
315
        qDebug() << "Invalid index for a supposedly existing webapp: " << webappName;
 
316
        return QString();
 
317
    }
 
318
 
 
319
    return data(idx, UserAgentOverride).toString();
 
320
}
 
321
 
304
322
QStringList
305
323
UnityWebappsAppModel::getChromeOptionsFor(const QString & webappName) const
306
324
{
488
506
            }
489
507
            return scripts;
490
508
        }
 
509
 
491
510
    case ScriptsContent:
492
511
        return webapp.data.content;
 
512
 
 
513
    case UserAgentOverride:
 
514
        return webapp.data.manifest.userAgentOverride;
493
515
    }
494
516
 
495
517
    return QVariant();