Merge lp:~abreu-alexandre/webbrowser-app/front-camera-as-default-capture into lp:webbrowser-app

Proposed by Alexandre Abreu
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 1484
Merged at revision: 1489
Proposed branch: lp:~abreu-alexandre/webbrowser-app/front-camera-as-default-capture
Merge into: lp:webbrowser-app
Diff against target: 217 lines (+119/-0)
6 files modified
src/app/BrowserView.qml (+90/-0)
src/app/webbrowser/Browser.qml (+10/-0)
src/app/webcontainer/WebApp.qml (+2/-0)
src/app/webcontainer/webapp-container.cpp (+12/-0)
src/app/webcontainer/webapp-container.h (+1/-0)
src/app/webcontainer/webapp-container.qml (+4/-0)
To merge this branch: bzr merge lp:~abreu-alexandre/webbrowser-app/front-camera-as-default-capture
Reviewer Review Type Date Requested Status
Olivier Tilloy functional Approve
system-apps-ci-bot continuous-integration Needs Fixing
Review via email: mp+291527@code.launchpad.net

Commit message

Set the front camera as the default for video media requests

Description of the change

Set the front camera as the default for video media requests

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

Can you please revert the changes to webbrowser-app.pot ?

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> Can you please revert the changes to webbrowser-app.pot ?

yes, a missed bit,
done

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1401
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/514/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/516
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/516
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/509
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/509
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/504/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/504/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/504/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/504/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/504/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/504
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/504/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/514/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1474
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/516/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/518/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/518
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/511
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/511
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/506/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/506/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/506
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/506/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/506
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/506/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/506
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/506/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/506
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/506/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/516/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1475
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/517/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/519
    FAILURE: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/48/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/519
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/512
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/512
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/507/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/507/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/507/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/507/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/507/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/507
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/507/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/517/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1478
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/522/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/544
    UNSTABLE: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/57
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/544
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/532
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/532
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/528/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/528/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/528/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/528/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/528/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/528
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/528/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/522/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

I’m probably missing something: why can’t this hack reside solely in the apps’ code? At app startup, check whether a specific default camera has been requested (via command-line flag), if not default to front, then enumerate all video capture devices, and set the default one accordingly if any matches.

See also a couple of inline comments.

1479. By Alexandre Abreu

tweak camera names in comments

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> I’m probably missing something: why can’t this hack reside solely in the apps’
> code? At app startup, check whether a specific default camera has been
> requested (via command-line flag), if not default to front, then enumerate all
> video capture devices, and set the default one accordingly if any matches.
>
> See also a couple of inline comments.

It was a conscious decision not to go for that, and to make it something that works
across all apps out-of-the-box,

Revision history for this message
Alexandre Abreu (abreu-alexandre) :
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1479
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/529/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/581
    FAILURE: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/69/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/581
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/561
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/561
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/555/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/555/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/555/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/555/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/555/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/555
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/555/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/529/rebuild

review: Needs Fixing (continuous-integration)
1480. By Alexandre Abreu

Move the changes back to the app code instead of webview context

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1480
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/532/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/606/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/606
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/576
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/576
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/569
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/569/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/569
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/569/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/569/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/569
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/569/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/569
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/569/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/569
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/569/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/532/rebuild

review: Needs Fixing (continuous-integration)
1481. By Alexandre Abreu

tweak default

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1481
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/533/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/608/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/608
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/578
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/578
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/571/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/571
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/571/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/571/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/571
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/571/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/571/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/571
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/571/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/533/rebuild

review: Needs Fixing (continuous-integration)
1482. By Alexandre Abreu

Make sure that the settings are properly up to date if a default front camera is set

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1482
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/535/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/621/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/621
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/591
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/591
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/584
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/584/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/584/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/584/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/584/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/584
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/584/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/584/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/535/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

In src/app/BrowserView.qml, you want i18n.dtr("oxide-qt", "Front") to pick up the translated string from oxide.

Is there really a need for a currentWebviewContext property? Can’t you simply refer to SharedWebContext.sharedContext everywhere instead? What’s the point of having a null currentWebviewContext in WebApp.qml if there is no webview yet? The context being a singleton, its lifetime should be independent from that of the webviews using it, no?

In BrowserView.qml, __internal doesn’t need to be a property, it can simply be a child of the FocusScope.

Can 'cameraIdVideoCaptureDefault' be renamed 'defaultVideoCaptureDeviceId'?
Can 'cameraPositionVideoCaptureDefault' be renamed 'defaultVideoCaptureDevicePosition'?

In BrowserView.qml, instead of connecting to 'changed' signals in an imperative manner, could you do it in a declarative way (using a Connections element)?

review: Needs Fixing
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> In src/app/BrowserView.qml, you want i18n.dtr("oxide-qt", "Front") to pick up
> the translated string from oxide.

right, done,

> Is there really a need for a currentWebviewContext property? Can’t you simply
> refer to SharedWebContext.sharedContext everywhere instead? What’s the point
> of having a null currentWebviewContext in WebApp.qml if there is no webview
> yet? The context being a singleton, its lifetime should be independent from
> that of the webviews using it, no?

no, the container does not use the shared context, and the webview is delay loaded,

> In BrowserView.qml, __internal doesn’t need to be a property, it can simply be
> a child of the FocusScope.

right, done,

> Can 'cameraIdVideoCaptureDefault' be renamed 'defaultVideoCaptureDeviceId'?
> Can 'cameraPositionVideoCaptureDefault' be renamed
> 'defaultVideoCaptureDevicePosition'?

yes, done

> In BrowserView.qml, instead of connecting to 'changed' signals in an
> imperative manner, could you do it in a declarative way (using a Connections
> element)?

thank you yes, it makes things cleaner,

1483. By Alexandre Abreu

Tweaks: renaming, use Connections, use domain based translations

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1483
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/540/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/631/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/631
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/600
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/600
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/593
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/593/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/593/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/593/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/593/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/593
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/593/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/593/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/540/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

I just realized that i18n.dtr("oxide-qt", "Front") as a prefix won’t work (because gettext matches only exact strings, not prefixes), you need the exact i18n’d string exposed by oxide: "Front camera" (see https://git.launchpad.net/oxide/tree/shared/browser/media/oxide_video_capture_device_factory_linux.cc#n53). A comment to specify that this should remain in sync with oxide’s source code would be useful I think.

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

As a consequence of the above remark, the "Prefix" part of 'cameraNamePrefixVideoCaptureDefault' should be removed, seeing that it’s not a prefix any longer.

For consistency with the rest of the codebase, can you please rename "__internal" to "internal" (without the leading underscores) ?

Can 'currentWebviewContext' be renamed 'currentWebcontext'?

Is the 'defaultVideoCaptureMediaIdUpdated' signal really needed? Can we not connect to currentWebviewContext.onDefaultVideoCaptureDeviceIdChanged instead?

The added 'browserView' id seems to be unused. Can it be removed?

1484. By Alexandre Abreu

Update some var names; fix translation string

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

all comments addressed,

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> Is the 'defaultVideoCaptureMediaIdUpdated' signal really needed? Can we not
> connect to currentWebviewContext.onDefaultVideoCaptureDeviceIdChanged instead?

no, the intent is to update the *initial* settings when none have been set so that it
properly reflects the current device id.
This should not be done for every video capture device changed since this part
is handled by the settings page itself,

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1484
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/542/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/634/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/634
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/603
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/603
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/603
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/596/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/596/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/596/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/596/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/596/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/596/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/596/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/596/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/596
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/596/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/542/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

Code changes look ok. I haven’t tested the actual functionality on a touch device though, this should be carefully tested from a silo.

review: Approve (code)
Revision history for this message
Olivier Tilloy (osomon) wrote :

Tested from silo 19 on arale (with webbrowser-app and appear.in webapp), this seems to work as intended.

review: Approve (functional)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/app/BrowserView.qml'
--- src/app/BrowserView.qml 2016-02-09 17:04:23 +0000
+++ src/app/BrowserView.qml 2016-06-16 18:22:11 +0000
@@ -19,6 +19,7 @@
19import QtQuick 2.419import QtQuick 2.4
20import Ubuntu.Components 1.320import Ubuntu.Components 1.3
21import Ubuntu.Unity.Action 1.1 as UnityActions21import Ubuntu.Unity.Action 1.1 as UnityActions
22import com.canonical.Oxide 1.15 as Oxide
2223
23FocusScope {24FocusScope {
24 property bool developerExtrasEnabled: false25 property bool developerExtrasEnabled: false
@@ -54,4 +55,93 @@
54 id: _osk55 id: _osk
55 }56 }
56 }57 }
58
59 signal defaultVideoCaptureMediaIdUpdated(string defaultVideoCaptureDeviceId)
60
61 /**
62 * The goal of this chunk of code is to allow one to setup
63 * a default selection for the camera based on its position.
64 * As requested by:
65 * https://launchpad.net/bugs/1563398
66 *
67 * At the moment though, there is an Oxide bug that prevents
68 * camera positions to be properly reported.
69 *
70 * https://launchpad.net/bugs/1568145
71 *
72 * In order to workaround this for now, we use a hack based on the fact
73 * that in hybris backed systems, the various video capture devices' names
74 * are reported as "Front camera" & "Back camera", the string being translated.
75 * We used this dirty heuristic instead of the position as a fallback for now.
76 */
77
78 property var currentWebcontext
79 property string defaultVideoCaptureDeviceId
80 property string defaultVideoCaptureDevicePosition: "frontface"
81
82 QtObject {
83 id: internal
84
85 // "Front camera" is the user facing string returned by oxide
86 // https://git.launchpad.net/oxide/tree/shared/browser/media/oxide_video_capture_device_factory_linux.cc#n49
87 // It should be kept in sync.
88 readonly property string defaultVideoCaptureDeviceUserName:
89 (defaultVideoCaptureDevicePosition === "frontface") ?
90 i18n.dtr("oxide-qt", "Front camera") : ""
91
92 readonly property string cameraPositionUnspecified: "unspecified"
93
94 function setupDefaultVideoCaptureDevice() {
95 if ( ! currentWebcontext) {
96 return
97 }
98
99 var devices = Oxide.Oxide.availableVideoCaptureDevices
100
101 if (! currentWebcontext.defaultVideoCaptureDeviceId
102 && devices
103 && devices.length > 0) {
104
105 for (var i = 0; i < devices.length; ++i) {
106 /**
107 * defaultVideoCaptureDeviceId has precedence
108 */
109
110 if (defaultVideoCaptureDeviceId
111 && devices[i].id === defaultVideoCaptureDeviceId) {
112 currentWebcontext.defaultVideoCaptureDeviceId = devices[i].id
113 defaultVideoCaptureMediaIdUpdated(devices[i].id)
114 break
115 }
116
117 if (defaultVideoCaptureDevicePosition) {
118 if (devices[i].position === defaultVideoCaptureDevicePosition) {
119 currentWebcontext.defaultVideoCaptureDeviceId = devices[i].id
120 defaultVideoCaptureMediaIdUpdated(devices[i].id)
121 break
122 }
123
124 /**
125 * This is only there to act as a fallback with a reasonnable
126 * heuristic that tracks the case described above.
127 */
128 var displayName = devices[i].displayName
129 if (internal.defaultVideoCaptureDeviceUserName
130 && internal.cameraPositionUnspecified === devices[i].position
131 && displayName.indexOf(
132 internal.defaultVideoCaptureDeviceUserName) === 0) {
133 currentWebcontext.defaultVideoCaptureDeviceId = devices[i].id
134 defaultVideoCaptureMediaIdUpdated(devices[i].id)
135 break
136 }
137 }
138 }
139 }
140 }
141 }
142
143 Connections {
144 target: Oxide.Oxide
145 onAvailableVideoCaptureDevicesChanged: internal.setupDefaultVideoCaptureDevice()
146 }
57}147}
58148
=== modified file 'src/app/webbrowser/Browser.qml'
--- src/app/webbrowser/Browser.qml 2016-05-23 15:49:49 +0000
+++ src/app/webbrowser/Browser.qml 2016-06-16 18:22:11 +0000
@@ -19,6 +19,7 @@
19import QtQuick 2.419import QtQuick 2.4
20import QtQuick.Window 2.220import QtQuick.Window 2.2
21import Qt.labs.settings 1.021import Qt.labs.settings 1.0
22import Ubuntu.Web 0.2
22import com.canonical.Oxide 1.15 as Oxide23import com.canonical.Oxide 1.15 as Oxide
23import Ubuntu.Components 1.324import Ubuntu.Components 1.3
24import Ubuntu.Components.Popups 1.325import Ubuntu.Components.Popups 1.3
@@ -81,6 +82,15 @@
81 onMediaAccessPermissionRequested: PopupUtils.open(mediaAccessDialogComponent, null, { request: request })82 onMediaAccessPermissionRequested: PopupUtils.open(mediaAccessDialogComponent, null, { request: request })
82 }83 }
8384
85 currentWebcontext: SharedWebContext.sharedContext
86 defaultVideoCaptureDeviceId: settings.defaultVideoDevice ? settings.defaultVideoDevice : ""
87
88 onDefaultVideoCaptureMediaIdUpdated: {
89 if (!settings.defaultVideoDevice) {
90 settings.defaultVideoDevice = defaultVideoCaptureDeviceId
91 }
92 }
93
84 InputDeviceModel {94 InputDeviceModel {
85 id: miceModel95 id: miceModel
86 deviceFilter: InputInfo.Mouse96 deviceFilter: InputInfo.Mouse
8797
=== modified file 'src/app/webcontainer/WebApp.qml'
--- src/app/webcontainer/WebApp.qml 2016-04-29 20:19:23 +0000
+++ src/app/webcontainer/WebApp.qml 2016-06-16 18:22:11 +0000
@@ -62,6 +62,8 @@
62 // not possible https://bugs.launchpad.net/autopilot-qt/+bug/127395662 // not possible https://bugs.launchpad.net/autopilot-qt/+bug/1273956
63 property alias generatedUrlPatterns: urlPatternSettings.generatedUrlPatterns63 property alias generatedUrlPatterns: urlPatternSettings.generatedUrlPatterns
6464
65 currentWebcontext: currentWebview ? currentWebview.context : null
66
65 actions: [67 actions: [
66 Actions.Back {68 Actions.Back {
67 enabled: webapp.backForwardButtonsVisible && containerWebView.currentWebview && containerWebView.currentWebview.canGoBack69 enabled: webapp.backForwardButtonsVisible && containerWebView.currentWebview && containerWebView.currentWebview.canGoBack
6870
=== modified file 'src/app/webcontainer/webapp-container.cpp'
--- src/app/webcontainer/webapp-container.cpp 2016-05-09 22:51:50 +0000
+++ src/app/webcontainer/webapp-container.cpp 2016-06-16 18:22:11 +0000
@@ -154,6 +154,7 @@
154 m_window->setProperty("accountProvider", m_accountProvider);154 m_window->setProperty("accountProvider", m_accountProvider);
155 m_window->setProperty("accountSwitcher", m_accountSwitcher);155 m_window->setProperty("accountSwitcher", m_accountSwitcher);
156 m_window->setProperty("openExternalUrlInOverlay", m_openExternalUrlInOverlay);156 m_window->setProperty("openExternalUrlInOverlay", m_openExternalUrlInOverlay);
157 m_window->setProperty("defaultVideoCaptureCameraPosition", m_defaultVideoCaptureCameraPosition);
157158
158 m_window->setProperty("webappUrlPatterns", m_webappUrlPatterns);159 m_window->setProperty("webappUrlPatterns", m_webappUrlPatterns);
159 QQmlContext* context = m_engine->rootContext();160 QQmlContext* context = m_engine->rootContext();
@@ -324,6 +325,15 @@
324 out << " --enable-media-hub-audio enable media-hub for audio playback" << endl;325 out << " --enable-media-hub-audio enable media-hub for audio playback" << endl;
325 out << " --user-agent-string=USER_AGENT overrides the default User Agent with the provided one." << endl;326 out << " --user-agent-string=USER_AGENT overrides the default User Agent with the provided one." << endl;
326 out << " --open-external-url-in-overlay if url patterns are defined, all external urls are opened in overlay instead of browser" << endl;327 out << " --open-external-url-in-overlay if url patterns are defined, all external urls are opened in overlay instead of browser" << endl;
328
329 // The options should be kept in sync with:
330 // http://bazaar.launchpad.net/~oxide-developers/oxide/oxide.trunk/view/head:/qt/quick/api/oxideqquickglobal.cc#L43
331 out << " --camera-capture-default=position set a default for the camera capture device in W3C Media API, 'position' should be"
332 " 'frontface', 'backface' or 'none'. If 'none' is selected the default"
333 " selection mechanism applied in Oxide is used. If this command line option"
334 " is not used, the default is set to 'frontface'. If the position is not found"
335 " the behavior is the same as if the option was not set."<< endl;
336
327 out << "Chrome options (if none specified, no chrome is shown by default):" << endl;337 out << "Chrome options (if none specified, no chrome is shown by default):" << endl;
328 out << " --enable-back-forward enable the display of the back and forward buttons (implies --enable-addressbar)" << endl;338 out << " --enable-back-forward enable the display of the back and forward buttons (implies --enable-addressbar)" << endl;
329 out << " --enable-addressbar enable the display of a minimal chrome (favicon and title)" << endl;339 out << " --enable-addressbar enable the display of a minimal chrome (favicon and title)" << endl;
@@ -381,6 +391,8 @@
381 m_userAgentOverride = argument.split("--user-agent-string=")[1];391 m_userAgentOverride = argument.split("--user-agent-string=")[1];
382 } else if (argument == "--open-external-url-in-overlay") {392 } else if (argument == "--open-external-url-in-overlay") {
383 m_openExternalUrlInOverlay = true;393 m_openExternalUrlInOverlay = true;
394 } else if (argument.startsWith("--camera-capture-default=")) {
395 m_defaultVideoCaptureCameraPosition = argument.split("--camera-capture-default=")[1];
384 }396 }
385 }397 }
386}398}
387399
=== modified file 'src/app/webcontainer/webapp-container.h'
--- src/app/webcontainer/webapp-container.h 2016-05-05 15:20:35 +0000
+++ src/app/webcontainer/webapp-container.h 2016-06-16 18:22:11 +0000
@@ -73,6 +73,7 @@
73 QString m_userAgentOverride;73 QString m_userAgentOverride;
74 QScopedPointer<WebappContainerHelper> m_webappContainerHelper;74 QScopedPointer<WebappContainerHelper> m_webappContainerHelper;
75 QScopedPointer<SchemeFilter> m_schemeFilter;75 QScopedPointer<SchemeFilter> m_schemeFilter;
76 QString m_defaultVideoCaptureCameraPosition;
7677
77 static const QString URL_PATTERN_SEPARATOR;78 static const QString URL_PATTERN_SEPARATOR;
78 static const QString LOCAL_SCHEME_FILTER_FILENAME;79 static const QString LOCAL_SCHEME_FILTER_FILENAME;
7980
=== modified file 'src/app/webcontainer/webapp-container.qml'
--- src/app/webcontainer/webapp-container.qml 2016-04-22 13:52:07 +0000
+++ src/app/webcontainer/webapp-container.qml 2016-06-16 18:22:11 +0000
@@ -46,6 +46,7 @@
46 property string localUserAgentOverride: ""46 property string localUserAgentOverride: ""
47 property bool blockOpenExternalUrls: false47 property bool blockOpenExternalUrls: false
48 property bool openExternalUrlInOverlay: false48 property bool openExternalUrlInOverlay: false
49 property string defaultVideoCaptureCameraPosition: ""
49 property bool popupBlockerEnabled: true50 property bool popupBlockerEnabled: true
5051
51 currentWebview: webappViewLoader.item ? webappViewLoader.item.currentWebview : null52 currentWebview: webappViewLoader.item ? webappViewLoader.item.currentWebview : null
@@ -90,6 +91,9 @@
90 webappUrlPatterns: root.webappUrlPatterns91 webappUrlPatterns: root.webappUrlPatterns
91 blockOpenExternalUrls: root.blockOpenExternalUrls92 blockOpenExternalUrls: root.blockOpenExternalUrls
92 openExternalUrlInOverlay: root.openExternalUrlInOverlay93 openExternalUrlInOverlay: root.openExternalUrlInOverlay
94 defaultVideoCaptureDevicePosition: root.defaultVideoCaptureCameraPosition ?
95 root.defaultVideoCaptureCameraPosition
96 : browser.defaultVideoCaptureDevicePosition
93 popupBlockerEnabled: root.popupBlockerEnabled97 popupBlockerEnabled: root.popupBlockerEnabled
9498
95 popupRedirectionUrlPrefixPattern: root.popupRedirectionUrlPrefixPattern99 popupRedirectionUrlPrefixPattern: root.popupRedirectionUrlPrefixPattern

Subscribers

People subscribed via source and target branches

to status/vote changes: