Merge m-c to inbound, a=merge

This commit is contained in:
Wes Kocher 2015-11-19 13:47:54 -08:00
commit af004452e1
98 changed files with 1779 additions and 1172 deletions

View File

@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Bug 1198458 Fix failures in TaskCluster builds due to analog_agc.cc moving
bug 1168113's backout needs a CLOBBER to clear up some TC bustage

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="94a821b49f4dca3f9321cd80e13c44c4a6696952"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="94a821b49f4dca3f9321cd80e13c44c4a6696952"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="94a821b49f4dca3f9321cd80e13c44c4a6696952"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cb4604d5a578efd027277059ce3e0f6e3af59bd1"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="94a821b49f4dca3f9321cd80e13c44c4a6696952"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f80d4c8bcb2f5a08015100048b3ae54c0d7999bd"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="94a821b49f4dca3f9321cd80e13c44c4a6696952"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -129,7 +129,7 @@
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="72ffdf71c68a96309212eb13d63560d66db14c9e"/>
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="58800ecb50e4e41cfb0a36cb43c82b73fb3612e5"/>
<project name="platform_bionic" path="bionic" remote="b2g" revision="3e85c4683c121530c1c3a48c696a569bf5f587e2"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="5a50f96a1d7c788817abb7c57acbb75172c1f48d"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="b2f83825411be614e8f7ec75fc731fc9c67a7078"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="f37bd545063039e30a92f2550ae78c0e6e4e2d08"/>
<project name="platform_external_wpa_supplicant_8" path="external/wpa_supplicant_8" remote="b2g" revision="0c6a6547cd1fd302fa2b0f6e375654df36bf0ec4"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="29cbaa03a380ab69d47c476dd433059f7680837c"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="94a821b49f4dca3f9321cd80e13c44c4a6696952"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="94a821b49f4dca3f9321cd80e13c44c4a6696952"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cb4604d5a578efd027277059ce3e0f6e3af59bd1"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="94a821b49f4dca3f9321cd80e13c44c4a6696952"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf",
"git_revision": "94a821b49f4dca3f9321cd80e13c44c4a6696952",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "38edf6a5a770747986828cae0e7316b90794dc19",
"revision": "1f6ce210fb439cf48b7fd29dcf2e46914177aba9",
"repo_path": "integration/gaia-central"
}

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="94a821b49f4dca3f9321cd80e13c44c4a6696952"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>

View File

@ -18,7 +18,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="94a821b49f4dca3f9321cd80e13c44c4a6696952"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f80d4c8bcb2f5a08015100048b3ae54c0d7999bd"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ffaade435bb9c3005fd6c9b7ee1cd17b90e08cbf"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="94a821b49f4dca3f9321cd80e13c44c4a6696952"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>

View File

@ -1571,6 +1571,7 @@ var UI = {
let banner = iQ("<div>")
.text(notificationText)
.addClass("banner")
.css({background: 'linear-gradient(#ffe13e, #ffc703)', color: 'rgba(0,0,0,0.95)'})
.append(button)
.appendTo("body");

View File

@ -69,7 +69,7 @@
}
@conditionalForwardWithUrlbar@ > #forward-button[disabled] + #urlbar > #notification-popup-box[hidden] + #identity-box {
padding-inline-start: calc(var(--backbutton-urlbar-overlap) + 4px);
padding-inline-start: calc(var(--backbutton-urlbar-overlap) + 5px);
}
@conditionalForwardWithUrlbar@:hover:not([switchingtabs]) > #forward-button[disabled] + #urlbar > #notification-popup-box[hidden] + #identity-box {
@ -81,7 +81,7 @@
@conditionalForwardWithUrlbar@:not(:hover) > #forward-button[disabled] + #urlbar > #notification-popup-box[hidden] + #identity-box {
/* when not hovered anymore, trigger a new non-delayed transition to react to the forward button hiding */
padding-inline-start: calc(var(--backbutton-urlbar-overlap) + 4.01px);
padding-inline-start: calc(var(--backbutton-urlbar-overlap) + 5.01px);
}
/* MAIN IDENTITY ICON */

View File

@ -2055,30 +2055,13 @@ richlistitem[type~="action"][actiontype$="tab"] > .ac-url-box > .ac-action-icon
.tabbrowser-arrowscrollbox > .scrollbutton-up,
.tabbrowser-arrowscrollbox > .scrollbutton-down {
list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-left.png");
list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-left.svg");
margin: 0 0 var(--tab-toolbar-navbar-overlap);
}
#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-arrowscrollbox > .scrollbutton-up,
#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-arrowscrollbox > .scrollbutton-down {
list-style-image: url(chrome://browser/skin/tabbrowser/tab-arrow-left-inverted.png);
}
@media (min-resolution: 1.1dppx) {
.tabbrowser-arrowscrollbox > .scrollbutton-up,
.tabbrowser-arrowscrollbox > .scrollbutton-down {
list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-left@2x.png");
}
.tabbrowser-arrowscrollbox > .scrollbutton-up > .toolbarbutton-icon,
.tabbrowser-arrowscrollbox > .scrollbutton-down > .toolbarbutton-icon {
width: 15px;
}
#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-arrowscrollbox > .scrollbutton-up,
#TabsToolbar[brighttext] > #tabbrowser-tabs > .tabbrowser-arrowscrollbox > .scrollbutton-down {
list-style-image: url(chrome://browser/skin/tabbrowser/tab-arrow-left-inverted@2x.png);
}
list-style-image: url(chrome://browser/skin/tabbrowser/tab-arrow-left-inverted.svg);
}
.tabbrowser-arrowscrollbox > .scrollbutton-up[disabled],
@ -2108,14 +2091,14 @@ richlistitem[type~="action"][actiontype$="tab"] > .ac-url-box > .ac-action-icon
.tabs-newtab-button,
#TabsToolbar > #new-tab-button,
#TabsToolbar > toolbarpaletteitem > #new-tab-button {
list-style-image: url(chrome://browser/skin/tabbrowser/newtab.png);
list-style-image: url(chrome://browser/skin/tabbrowser/newtab.svg);
-moz-image-region: auto;
}
#TabsToolbar[brighttext] .tabs-newtab-button,
#TabsToolbar[brighttext] > #new-tab-button,
#TabsToolbar[brighttext] > toolbarpaletteitem > #new-tab-button {
list-style-image: url(chrome://browser/skin/tabbrowser/newtab-inverted.png);
list-style-image: url(chrome://browser/skin/tabbrowser/newtab-inverted.svg);
}
.tabs-newtab-button > .toolbarbutton-icon,
@ -2124,20 +2107,6 @@ richlistitem[type~="action"][actiontype$="tab"] > .ac-url-box > .ac-action-icon
width: 16px;
}
@media (min-resolution: 1.1dppx) {
.tabs-newtab-button,
#TabsToolbar > #new-tab-button,
#TabsToolbar > toolbarpaletteitem > #new-tab-button {
list-style-image: url(chrome://browser/skin/tabbrowser/newtab@2x.png);
}
#TabsToolbar[brighttext] .tabs-newtab-button,
#TabsToolbar[brighttext] > #new-tab-button,
#TabsToolbar[brighttext] > toolbarpaletteitem > #new-tab-button {
list-style-image: url(chrome://browser/skin/tabbrowser/newtab-inverted@2x.png);
}
}
#TabsToolbar > #new-tab-button {
width: 26px;
}

View File

@ -183,26 +183,19 @@ browser.jar:
skin/classic/browser/preferences/checkbox-xp.png (preferences/checkbox-xp.png)
skin/classic/browser/social/services-16.png (social/services-16.png)
skin/classic/browser/social/services-64.png (social/services-64.png)
skin/classic/browser/tabbrowser/newtab.png (tabbrowser/newtab.png)
skin/classic/browser/tabbrowser/newtab@2x.png (tabbrowser/newtab@2x.png)
skin/classic/browser/tabbrowser/newtab-XPVista7.png (tabbrowser/newtab-XPVista7.png)
skin/classic/browser/tabbrowser/newtab-XPVista7@2x.png (tabbrowser/newtab-XPVista7@2x.png)
skin/classic/browser/tabbrowser/newtab-inverted.png (tabbrowser/newtab-inverted.png)
skin/classic/browser/tabbrowser/newtab-inverted@2x.png (tabbrowser/newtab-inverted@2x.png)
skin/classic/browser/tabbrowser/newtab-inverted-XPVista7.png (tabbrowser/newtab-inverted-XPVista7.png)
skin/classic/browser/tabbrowser/newtab-inverted-XPVista7@2x.png (tabbrowser/newtab-inverted-XPVista7@2x.png)
skin/classic/browser/tabbrowser/newtab.svg (tabbrowser/newtab.svg)
skin/classic/browser/tabbrowser/newtab-XPVista7.svg (tabbrowser/newtab-XPVista7.svg)
skin/classic/browser/tabbrowser/newtab-inverted.svg (tabbrowser/newtab-inverted.svg)
skin/classic/browser/tabbrowser/newtab-inverted-XPVista7.svg (tabbrowser/newtab-inverted-XPVista7.svg)
skin/classic/browser/tabbrowser/connecting.png (tabbrowser/connecting.png)
skin/classic/browser/tabbrowser/connecting@2x.png (tabbrowser/connecting@2x.png)
skin/classic/browser/tabbrowser/loading.png (tabbrowser/loading.png)
skin/classic/browser/tabbrowser/loading@2x.png (tabbrowser/loading@2x.png)
skin/classic/browser/tabbrowser/tab-active-middle.png (tabbrowser/tab-active-middle.png)
skin/classic/browser/tabbrowser/tab-active-middle@2x.png (tabbrowser/tab-active-middle@2x.png)
skin/classic/browser/tabbrowser/tab-arrow-left.png (tabbrowser/tab-arrow-left.png)
skin/classic/browser/tabbrowser/tab-arrow-left@2x.png (tabbrowser/tab-arrow-left@2x.png)
skin/classic/browser/tabbrowser/tab-arrow-left-XPVista7.png (tabbrowser/tab-arrow-left-XPVista7.png)
skin/classic/browser/tabbrowser/tab-arrow-left-XPVista7@2x.png (tabbrowser/tab-arrow-left-XPVista7@2x.png)
skin/classic/browser/tabbrowser/tab-arrow-left-inverted.png (tabbrowser/tab-arrow-left-inverted.png)
skin/classic/browser/tabbrowser/tab-arrow-left-inverted@2x.png (tabbrowser/tab-arrow-left-inverted@2x.png)
skin/classic/browser/tabbrowser/tab-arrow-left.svg (tabbrowser/tab-arrow-left.svg)
skin/classic/browser/tabbrowser/tab-arrow-left-XPVista7.svg (tabbrowser/tab-arrow-left-XPVista7.svg)
skin/classic/browser/tabbrowser/tab-arrow-left-inverted.svg (tabbrowser/tab-arrow-left-inverted.svg)
skin/classic/browser/tabbrowser/tab-background-start.png (tabbrowser/tab-background-start.png)
skin/classic/browser/tabbrowser/tab-background-start@2x.png (tabbrowser/tab-background-start@2x.png)
skin/classic/browser/tabbrowser/tab-background-middle.png (tabbrowser/tab-background-middle.png)
@ -320,12 +313,9 @@ browser.jar:
% override chrome://browser/skin/urlbar-history-dropmarker@2x.png chrome://browser/skin/urlbar-history-dropmarker-XPVista7@2x.png os=WINNT osversion<=6.1
% override chrome://browser/skin/downloads/download-glow-menuPanel.png chrome://browser/skin/downloads/download-glow-menuPanel-XPVista7.png os=WINNT osversion<=6.1
% override chrome://browser/skin/places/autocomplete-star.png chrome://browser/skin/places/autocomplete-star-XPVista7.png os=WINNT osversion<=6.1
% override chrome://browser/skin/tabbrowser/newtab.png chrome://browser/skin/tabbrowser/newtab-XPVista7.png os=WINNT osversion<=6.1
% override chrome://browser/skin/tabbrowser/newtab@2x.png chrome://browser/skin/tabbrowser/newtab-XPVista7@2x.png os=WINNT osversion<=6.1
% override chrome://browser/skin/tabbrowser/newtab-inverted.png chrome://browser/skin/tabbrowser/newtab-inverted-XPVista7.png os=WINNT osversion<=6.1
% override chrome://browser/skin/tabbrowser/newtab-inverted@2x.png chrome://browser/skin/tabbrowser/newtab-inverted-XPVista7@2x.png os=WINNT osversion<=6.1
% override chrome://browser/skin/tabbrowser/tab-arrow-left.png chrome://browser/skin/tabbrowser/tab-arrow-left-XPVista7.png os=WINNT osversion<=6.1
% override chrome://browser/skin/tabbrowser/tab-arrow-left@2x.png chrome://browser/skin/tabbrowser/tab-arrow-left-XPVista7@2x.png os=WINNT osversion<=6.1
% override chrome://browser/skin/tabbrowser/newtab.svg chrome://browser/skin/tabbrowser/newtab-XPVista7.svg os=WINNT osversion<=6.1
% override chrome://browser/skin/tabbrowser/newtab-inverted.svg chrome://browser/skin/tabbrowser/newtab-inverted-XPVista7.svg os=WINNT osversion<=6.1
% override chrome://browser/skin/tabbrowser/tab-arrow-left.svg chrome://browser/skin/tabbrowser/tab-arrow-left-XPVista7.svg os=WINNT osversion<=6.1
% override chrome://browser/skin/menuPanel.png chrome://browser/skin/menuPanel-aero.png os=WINNT osversion=6
% override chrome://browser/skin/menuPanel.png chrome://browser/skin/menuPanel-aero.png os=WINNT osversion=6.1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

View File

@ -0,0 +1,16 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="18" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="gradient" x1="0%" x2="0%" y1="0%" y2="100%">
<stop offset="0%" stop-color="#1c2835"/>
<stop offset="60%" stop-color="#606e7b"/>
<stop offset="100%" stop-color="#465765"/>
</linearGradient>
</defs>
<g fill="url(#gradient)">
<rect width="10" height="2" x="3" y="8"/>
<rect width="2" height="10" x="7" y="4"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

View File

@ -0,0 +1,13 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="18" xmlns="http://www.w3.org/2000/svg">
<g stroke="#7f7f7f" stroke-width="2" fill="none">
<rect x="7" y="4" width="2" height="10" rx="0.25" ry="0.25"/>
<rect x="3" y="8" width="10" height="2" rx="0.25" ry="0.25"/>
</g>
<g fill="#fff">
<rect width="2" height="10" x="7" y="4"/>
<rect width="10" height="2" x="3" y="8"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

View File

@ -0,0 +1,13 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="18" xmlns="http://www.w3.org/2000/svg">
<g stroke="#7f7f7f" stroke-width="2" fill="none">
<rect x="7" y="3" width="2" height="12" rx="0.25" ry="0.25"/>
<rect x="2" y="8" width="12" height="2" rx="0.25" ry="0.25"/>
</g>
<g fill="#fff">
<rect x="7" y="3" width="2" height="12"/>
<rect x="2" y="8" width="12" height="2"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 B

View File

@ -0,0 +1,7 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="16" height="18" xmlns="http://www.w3.org/2000/svg" fill="#4c4c4c">
<rect x="7" y="3" width="2" height="12"/>
<rect x="2" y="8" width="12" height="2"/>
</svg>

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 B

View File

@ -0,0 +1,12 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="15" height="17" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="fill" x1="50%" y1="0%" x2="50%" y2="100%">
<stop stop-color="#3f4f5a" offset="0"/>
<stop stop-color="#7e8c97" offset="1"/>
</linearGradient>
</defs>
<path d="M11 4L9.5 2.5l-5.875 6 5.875 6L11 13 6.625 8.5z" fill="url(#fill)"/>
</svg>

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

View File

@ -0,0 +1,7 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="15" height="17" xmlns="http://www.w3.org/2000/svg">
<path fill="#666" stroke-width="1.5" stroke="#666" d="M11 4L9.5 2.5l-5.875 6 5.875 6L11 13 6.625 8.5z"/>
<path fill="#fff" d="M11 4L9.5 2.5l-5.875 6 5.875 6L11 13 6.625 8.5z"/>
</svg>

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 657 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

View File

@ -0,0 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg width="15" height="17" xmlns="http://www.w3.org/2000/svg">
<path d="M11 4L9.5 2.5l-5.875 6 5.875 6L11 13 6.625 8.5z" fill="#4c4c4c"/>
</svg>

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B

View File

@ -11,6 +11,7 @@
"Assert": true,
"BrowserTestUtils": true,
"content": true,
"ContentTask": true,
"document": true,
"EventUtils": true,
"executeSoon": true,

View File

@ -1,5 +1,17 @@
<html>
<head></head>
<head>
<style>
img {
height: 100px;
width: 100px;
}
.overflow {
overflow: scroll;
height: 200%;
width: 200%;
}
</style>
</head>
<body>
<img id="testImage" ></img>
</body>

View File

@ -1,6 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* global helpers, btoa, whenDelayedStartupFinished, OpenBrowserWindow */
// Test that screenshot command works properly
const TEST_URI = "http://example.com/browser/devtools/client/commandline/" +
"test/browser_cmd_screenshot.html";
@ -27,6 +29,7 @@ function* spawnTest() {
function* addTabWithToolbarRunTests(win) {
let options = yield helpers.openTab(TEST_URI, { chromeWindow: win });
let browser = options.browser;
yield helpers.openToolbar(options);
// Test input status
@ -114,16 +117,32 @@ function* addTabWithToolbarRunTests(win) {
]);
// Test capture to clipboard
let clipid = Ci.nsIClipboard;
let clip = Cc["@mozilla.org/widget/clipboard;1"].getService(clipid);
let trans = Cc["@mozilla.org/widget/transferable;1"]
.createInstance(Ci.nsITransferable);
trans.init(null);
trans.addDataFlavor("image/png");
yield helpers.audit(options, [
{
setup: 'screenshot --fullpage --clipboard',
setup: "screenshot --clipboard",
check: {
args: {
clipboard: { value: true },
chrome: { value: false },
},
},
exec: {
output: new RegExp("^Copied to clipboard.$"),
},
post: Task.async(function*() {
let imgSize = yield getImageSizeFromClipboard();
let winSize = yield ContentTask.spawn(browser, {}, function*() {
return {
width: content.innerWidth,
height: content.innerHeight,
};
});
is(imgSize.width, winSize.width, "Image width matches window size");
is(imgSize.height, winSize.height, "Image height matches window size");
})
},
{
setup: "screenshot --fullpage --clipboard",
check: {
args: {
fullpage: { value: true },
@ -134,15 +153,151 @@ function* addTabWithToolbarRunTests(win) {
exec: {
output: new RegExp("^Copied to clipboard.$"),
},
post: function() {
clip.getData(trans, clipid.kGlobalClipboard);
let str = new Object();
let strLength = new Object();
trans.getTransferData("image/png", str, strLength);
post: Task.async(function*() {
let imgSize = yield getImageSizeFromClipboard();
let pageSize = yield ContentTask.spawn(browser, {}, function*() {
return {
width: content.innerWidth +
content.scrollMaxX - content.scrollMinX,
height: content.innerHeight +
content.scrollMaxY - content.scrollMinY,
};
});
is(imgSize.width, pageSize.width, "Image width matches page size");
is(imgSize.height, pageSize.height, "Image height matches page size");
})
},
{
setup: "screenshot --selector img#testImage --clipboard",
check: {
args: {
clipboard: { value: true },
chrome: { value: false },
},
},
exec: {
output: new RegExp("^Copied to clipboard.$"),
},
post: Task.async(function*() {
let imgSize = yield getImageSizeFromClipboard();
let elemSize = yield ContentTask.spawn(browser, {}, function*() {
let img = content.document.querySelector("img#testImage");
return {
width: img.clientWidth,
height: img.clientHeight,
};
});
is(imgSize.width, elemSize.width,
"Image width matches element size");
is(imgSize.height, elemSize.height,
"Image height matches element size");
})
},
]);
ok(str.value, "screenshot exists");
ok(strLength.value > 0, "screenshot has length");
}
// Trigger scrollbars by forcing document to overflow
// This only affects results on OSes with scrollbars that reduce document size
// (non-floating scrollbars). With default OS settings, this means Windows
// and Linux are affected, but Mac is not. For Mac to exhibit this behavior,
// change System Preferences -> General -> Show scroll bars to Always.
yield ContentTask.spawn(browser, {}, function*() {
content.document.body.classList.add("overflow");
});
let scrollbarSize = yield ContentTask.spawn(browser, {}, function*() {
const winUtils = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let scrollbarHeight = {};
let scrollbarWidth = {};
winUtils.getScrollbarSize(true, scrollbarWidth, scrollbarHeight);
return {
width: scrollbarWidth.value,
height: scrollbarHeight.value,
};
});
info(`Scrollbar size: ${scrollbarSize.width}x${scrollbarSize.height}`);
// Test capture to clipboard in presence of scrollbars
yield helpers.audit(options, [
{
setup: "screenshot --clipboard",
check: {
args: {
clipboard: { value: true },
chrome: { value: false },
},
},
exec: {
output: new RegExp("^Copied to clipboard.$"),
},
post: Task.async(function*() {
let imgSize = yield getImageSizeFromClipboard();
let winSize = yield ContentTask.spawn(browser, {}, function*() {
return {
width: content.innerWidth,
height: content.innerHeight,
};
});
is(imgSize.width, winSize.width - scrollbarSize.width,
"Image width matches window size minus scrollbar size");
is(imgSize.height, winSize.height - scrollbarSize.height,
"Image height matches window size minus scrollbar size");
})
},
{
setup: "screenshot --fullpage --clipboard",
check: {
args: {
fullpage: { value: true },
clipboard: { value: true },
chrome: { value: false },
},
},
exec: {
output: new RegExp("^Copied to clipboard.$"),
},
post: Task.async(function*() {
let imgSize = yield getImageSizeFromClipboard();
let pageSize = yield ContentTask.spawn(browser, {}, function*() {
return {
width: content.innerWidth +
content.scrollMaxX - content.scrollMinX,
height: content.innerHeight +
content.scrollMaxY - content.scrollMinY,
};
});
is(imgSize.width, pageSize.width - scrollbarSize.width,
"Image width matches page size minus scrollbar size");
is(imgSize.height, pageSize.height - scrollbarSize.height,
"Image height matches page size minus scrollbar size");
})
},
{
setup: "screenshot --selector img#testImage --clipboard",
check: {
args: {
clipboard: { value: true },
chrome: { value: false },
},
},
exec: {
output: new RegExp("^Copied to clipboard.$"),
},
post: Task.async(function*() {
let imgSize = yield getImageSizeFromClipboard();
let elemSize = yield ContentTask.spawn(browser, {}, function*() {
let img = content.document.querySelector("img#testImage");
return {
width: img.clientWidth,
height: img.clientHeight,
};
});
is(imgSize.width, elemSize.width,
"Image width matches element size");
is(imgSize.height, elemSize.height,
"Image height matches element size");
})
},
]);
@ -164,3 +319,70 @@ function addWindow(windowOptions) {
});
});
}
let getImageSizeFromClipboard = Task.async(function*() {
let clipid = Ci.nsIClipboard;
let clip = Cc["@mozilla.org/widget/clipboard;1"].getService(clipid);
let trans = Cc["@mozilla.org/widget/transferable;1"]
.createInstance(Ci.nsITransferable);
let flavor = "image/png";
trans.init(null);
trans.addDataFlavor(flavor);
clip.getData(trans, clipid.kGlobalClipboard);
let data = new Object();
let dataLength = new Object();
trans.getTransferData(flavor, data, dataLength);
ok(data.value, "screenshot exists");
ok(dataLength.value > 0, "screenshot has length");
let image = data.value;
let dataURI = `data:${flavor};base64,`;
// Due to the differences in how images could be stored in the clipboard the
// checks below are needed. The clipboard could already provide the image as
// byte streams, but also as pointer, or as image container. If it's not
// possible obtain a byte stream, the function returns `null`.
if (image instanceof Ci.nsISupportsInterfacePointer) {
image = image.data;
}
if (image instanceof Ci.imgIContainer) {
image = Cc["@mozilla.org/image/tools;1"]
.getService(Ci.imgITools)
.encodeImage(image, flavor);
}
if (image instanceof Ci.nsIInputStream) {
let binaryStream = Cc["@mozilla.org/binaryinputstream;1"]
.createInstance(Ci.nsIBinaryInputStream);
binaryStream.setInputStream(image);
let rawData = binaryStream.readBytes(binaryStream.available());
let charCodes = Array.from(rawData, c => c.charCodeAt(0) & 0xff);
let encodedData = String.fromCharCode(...charCodes);
encodedData = btoa(encodedData);
dataURI = dataURI + encodedData;
} else {
throw new Error("Unable to read image data");
}
let img = document.createElementNS("http://www.w3.org/1999/xhtml", "img");
let loaded = new Promise(resolve => {
img.addEventListener("load", function onLoad() {
img.removeEventListener("load", onLoad);
resolve();
});
});
img.src = dataURI;
document.documentElement.appendChild(img);
yield loaded;
img.remove();
return {
width: img.width,
height: img.height,
};
});

View File

@ -406,6 +406,10 @@ MarkupView.prototype = {
_isImagePreviewTarget: function(target) {
// From the target passed here, let's find the parent MarkupContainer
// and ask it if the tooltip should be shown
if (this.isDragging) {
return promise.reject(false);
}
let parent = target, container;
while (parent !== this.doc.body) {
if (parent.container) {

View File

@ -51,6 +51,7 @@ skip-if = e10s && os == 'win'
[browser_markupview_dragdrop_escapeKeyPress.js]
[browser_markupview_dragdrop_invalidNodes.js]
[browser_markupview_dragdrop_reorder.js]
[browser_markupview_dragdrop_tooltip.js]
[browser_markupview_events.js]
skip-if = e10s # Bug 1040751 - CodeMirror editor.destroy() isn't e10s compatible
[browser_markupview_events_form.js]

View File

@ -0,0 +1,37 @@
"use strict";
// Test that tooltips don't appear when dragging over tooltip targets.
const TEST_URL = "data:text/html;charset=utf8,<img src=\"about:logo\" /><div>";
add_task(function*() {
let {inspector} = yield addTab(TEST_URL).then(openInspector);
let {markup} = inspector;
info("Get the tooltip target element for the image's src attribute");
let img = yield getContainerForSelector("img", inspector);
let target = img.editor.getAttributeElement("src").querySelector(".link");
info("Check that the src attribute of the image is a valid tooltip target");
let isValid = yield markup.tooltip.isValidHoverTarget(target);
ok(isValid, "The element is a valid tooltip target");
info("Start dragging the test div");
yield simulateNodeDrag(inspector, "div");
info("Now check that the src attribute of the image isn't a valid target");
try{
yield markup.tooltip.isValidHoverTarget(target);
isValid = true;
} catch(e) {
isValid = false;
}
ok(!isValid, "The element is not a valid tooltip target");
info("Stop dragging the test div");
yield simulateNodeDrop(inspector, "div");
info("Check again the src attribute of the image");
isValid = yield markup.tooltip.isValidHoverTarget(target);
ok(isValid, "The element is a valid tooltip target");
});

View File

@ -8,8 +8,6 @@
#eyedropper-button::before {
background-image: url("chrome://devtools/skin/images/command-eyedropper.png");
background-size: 64px 16px;
background-position: 0 center;
}
@media (min-resolution: 1.1dppx) {

View File

@ -423,16 +423,18 @@ WebConsoleActor.prototype =
*/
makeDebuggeeValue: function WCA_makeDebuggeeValue(aValue, aUseObjectGlobal)
{
let global = this.window;
if (aUseObjectGlobal && typeof aValue == "object") {
try {
global = Cu.getGlobalForObject(aValue);
let global = Cu.getGlobalForObject(aValue);
let dbgGlobal = this.dbg.makeGlobalObjectReference(global);
return dbgGlobal.makeDebuggeeValue(aValue);
}
catch (ex) {
// The above can throw an exception if aValue is not an actual object.
// The above can throw an exception if aValue is not an actual object
// or 'Object in compartment marked as invisible to Debugger'
}
}
let dbgGlobal = this.dbg.makeGlobalObjectReference(global);
let dbgGlobal = this.dbg.makeGlobalObjectReference(this.window);
return dbgGlobal.makeDebuggeeValue(aValue);
},

View File

@ -45,6 +45,17 @@
width: 200px;
}
.long-animation {
display: inline-block;
width: 50px;
height: 50px;
border-radius: 50%;
background: gold;
animation: move 100s;
}
.short-animation {
display: inline-block;
@ -139,6 +150,7 @@
<div class="simple-animation"></div>
<div class="multiple-animations"></div>
<div class="transition"></div>
<div class="long-animation"></div>
<div class="short-animation"></div>
<div class="delayed-animation"></div>
<div class="delayed-transition"></div>

View File

@ -17,37 +17,39 @@ add_task(function*() {
});
function* playStateIsUpdatedDynamically(walker, animations) {
let node = yield walker.querySelector(walker.rootNode, ".short-animation");
// Restart the animation to make sure we can get the player (it might already
// be finished by now). Do this by toggling the class and forcing a sync
// reflow using the CPOW.
let cpow = content.document.querySelector(".short-animation");
cpow.classList.remove("short-animation");
let reflow = cpow.offsetWidth;
cpow.classList.add("short-animation");
info("Getting the test node (which runs a very long animation)");
// The animation lasts for 100s, to avoid intermittents.
let node = yield walker.querySelector(walker.rootNode, ".long-animation");
info("Getting the animation player front for this node");
let [player] = yield animations.getAnimationPlayersForNode(node);
yield player.ready();
let state = yield player.getCurrentState();
is(state.playState, "running",
"The playState is running while the transition is running");
"The playState is running while the animation is running");
info("Wait until the animation stops (more than 1000ms)");
// Waiting 1.5sec for good measure
yield wait(1500);
state = yield player.getCurrentState();
info("Change the animation's currentTime to be near the end and wait for " +
"it to finish");
let onFinished = waitForAnimationPlayState(player, "finished");
// Set the currentTime to 98s, knowing that the animation lasts for 100s.
yield player.setCurrentTime(98 * 1000);
state = yield onFinished;
is(state.playState, "finished",
"The animation has ended and the state has been updated");
ok(state.currentTime > player.initialState.currentTime,
"The currentTime has been updated");
}
function wait(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
function* waitForAnimationPlayState(player, playState) {
let state = {};
while (state.playState !== playState) {
state = yield player.getCurrentState();
yield wait(500);
}
return state;
}
function wait(ms) {
return new Promise(r => setTimeout(r, ms));
}

View File

@ -325,8 +325,13 @@ exports.getProperty = function getProperty(aObj, aKey) {
exports.hasSafeGetter = function hasSafeGetter(aDesc) {
// Scripted functions that are CCWs will not appear scripted until after
// unwrapping.
let fn = aDesc.get.unwrap();
return fn && fn.callable && fn.class == "Function" && fn.script === undefined;
try {
let fn = aDesc.get.unwrap();
return fn && fn.callable && fn.class == "Function" && fn.script === undefined;
} catch(e) {
// Avoid exception 'Object in compartment marked as invisible to Debugger'
return false;
}
};
/**

View File

@ -283,13 +283,16 @@ function createScreenshotData(document, args) {
height = window.innerHeight;
}
const winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
const scrollbarHeight = {};
const scrollbarWidth = {};
winUtils.getScrollbarSize(false, scrollbarWidth, scrollbarHeight);
width -= scrollbarWidth.value;
height -= scrollbarHeight.value;
// Only adjust for scrollbars when considering the full window
if (!args.selector) {
const winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
const scrollbarHeight = {};
const scrollbarWidth = {};
winUtils.getScrollbarSize(false, scrollbarWidth, scrollbarHeight);
width -= scrollbarWidth.value;
height -= scrollbarHeight.value;
}
const canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
const ctx = canvas.getContext("2d");

View File

@ -116,7 +116,7 @@ exports.staticRequire = function(requistingModule, name) {
return new Promise(function(resolve, reject) {
var filename = resourceDirName(requistingModule.id) + '/' + name;
filename = filename.replace(/\/\.\//g, '/');
filename = 'resource://devtools/' + filename;
filename = 'resource://devtools/shared/gcli/source/lib/' + filename;
var xhr = Cc['@mozilla.org/xmlextras/xmlhttprequest;1']
.createInstance(Ci.nsIXMLHttpRequest);

View File

@ -28,6 +28,10 @@ function doConsoleCalls(aState)
top.console.dir(top.document, top.location);
top.console.log("foo", longString);
let sandbox = new Cu.Sandbox(null, { invisibleToDebugger: true });
let sandboxObj = sandbox.eval("new Object");
top.console.log(sandboxObj);
function fromAsmJS() {
top.console.error("foobarBaz-asmjs-error", undefined);
}
@ -119,6 +123,19 @@ function doConsoleCalls(aState)
},
],
},
{
level: "log",
filename: /test_consoleapi/,
functionName: "doConsoleCalls",
timeStamp: /^\d+$/,
arguments: [
{
type: "object",
actor: /[a-z]/,
class: "Object",
},
],
},
{
level: "error",
filename: /test_consoleapi/,

View File

@ -17,21 +17,16 @@ using namespace mozilla::ipc;
const int BluetoothDaemonCoreModule::MAX_NUM_CLIENTS = 1;
BluetoothNotificationHandler* BluetoothDaemonCoreModule::sNotificationHandler;
BluetoothCoreNotificationHandler*
BluetoothDaemonCoreModule::sNotificationHandler;
void
BluetoothDaemonCoreModule::SetNotificationHandler(
BluetoothNotificationHandler* aNotificationHandler)
BluetoothCoreNotificationHandler* aNotificationHandler)
{
sNotificationHandler = aNotificationHandler;
}
BluetoothNotificationHandler*
BluetoothDaemonCoreModule::GetNotificationHandler()
{
return sNotificationHandler;
}
void
BluetoothDaemonCoreModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
@ -53,7 +48,7 @@ BluetoothDaemonCoreModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
//
nsresult
BluetoothDaemonCoreModule::EnableCmd(BluetoothResultHandler* aRes)
BluetoothDaemonCoreModule::EnableCmd(BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -70,7 +65,7 @@ BluetoothDaemonCoreModule::EnableCmd(BluetoothResultHandler* aRes)
}
nsresult
BluetoothDaemonCoreModule::DisableCmd(BluetoothResultHandler* aRes)
BluetoothDaemonCoreModule::DisableCmd(BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -88,7 +83,7 @@ BluetoothDaemonCoreModule::DisableCmd(BluetoothResultHandler* aRes)
nsresult
BluetoothDaemonCoreModule::GetAdapterPropertiesCmd(
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -105,8 +100,8 @@ BluetoothDaemonCoreModule::GetAdapterPropertiesCmd(
}
nsresult
BluetoothDaemonCoreModule::GetAdapterPropertyCmd(BluetoothPropertyType aType,
BluetoothResultHandler* aRes)
BluetoothDaemonCoreModule::GetAdapterPropertyCmd(
BluetoothPropertyType aType, BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -128,7 +123,7 @@ BluetoothDaemonCoreModule::GetAdapterPropertyCmd(BluetoothPropertyType aType,
nsresult
BluetoothDaemonCoreModule::SetAdapterPropertyCmd(
const BluetoothProperty& aProperty, BluetoothResultHandler* aRes)
const BluetoothProperty& aProperty, BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -150,7 +145,7 @@ BluetoothDaemonCoreModule::SetAdapterPropertyCmd(
nsresult
BluetoothDaemonCoreModule::GetRemoteDevicePropertiesCmd(
const BluetoothAddress& aRemoteAddr, BluetoothResultHandler* aRes)
const BluetoothAddress& aRemoteAddr, BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -174,7 +169,7 @@ nsresult
BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
const BluetoothAddress& aRemoteAddr,
BluetoothPropertyType aType,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -198,7 +193,7 @@ nsresult
BluetoothDaemonCoreModule::SetRemoteDevicePropertyCmd(
const BluetoothAddress& aRemoteAddr,
const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -221,7 +216,7 @@ BluetoothDaemonCoreModule::SetRemoteDevicePropertyCmd(
nsresult
BluetoothDaemonCoreModule::GetRemoteServiceRecordCmd(
const BluetoothAddress& aRemoteAddr, const BluetoothUuid& aUuid,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -243,7 +238,7 @@ BluetoothDaemonCoreModule::GetRemoteServiceRecordCmd(
nsresult
BluetoothDaemonCoreModule::GetRemoteServicesCmd(
const BluetoothAddress& aRemoteAddr, BluetoothResultHandler* aRes)
const BluetoothAddress& aRemoteAddr, BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -263,7 +258,7 @@ BluetoothDaemonCoreModule::GetRemoteServicesCmd(
}
nsresult
BluetoothDaemonCoreModule::StartDiscoveryCmd(BluetoothResultHandler* aRes)
BluetoothDaemonCoreModule::StartDiscoveryCmd(BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -280,7 +275,7 @@ BluetoothDaemonCoreModule::StartDiscoveryCmd(BluetoothResultHandler* aRes)
}
nsresult
BluetoothDaemonCoreModule::CancelDiscoveryCmd(BluetoothResultHandler* aRes)
BluetoothDaemonCoreModule::CancelDiscoveryCmd(BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -299,7 +294,7 @@ BluetoothDaemonCoreModule::CancelDiscoveryCmd(BluetoothResultHandler* aRes)
nsresult
BluetoothDaemonCoreModule::CreateBondCmd(const BluetoothAddress& aBdAddr,
BluetoothTransport aTransport,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -325,7 +320,7 @@ BluetoothDaemonCoreModule::CreateBondCmd(const BluetoothAddress& aBdAddr,
nsresult
BluetoothDaemonCoreModule::RemoveBondCmd(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -347,7 +342,7 @@ BluetoothDaemonCoreModule::RemoveBondCmd(const BluetoothAddress& aBdAddr,
nsresult
BluetoothDaemonCoreModule::CancelBondCmd(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -371,7 +366,7 @@ nsresult
BluetoothDaemonCoreModule::PinReplyCmd(const BluetoothAddress& aBdAddr,
bool aAccept,
const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -395,7 +390,7 @@ nsresult
BluetoothDaemonCoreModule::SspReplyCmd(const BluetoothAddress& aBdAddr,
BluetoothSspVariant aVariant,
bool aAccept, uint32_t aPasskey,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -416,8 +411,8 @@ BluetoothDaemonCoreModule::SspReplyCmd(const BluetoothAddress& aBdAddr,
}
nsresult
BluetoothDaemonCoreModule::DutModeConfigureCmd(bool aEnable,
BluetoothResultHandler* aRes)
BluetoothDaemonCoreModule::DutModeConfigureCmd(
bool aEnable, BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -440,7 +435,7 @@ BluetoothDaemonCoreModule::DutModeConfigureCmd(bool aEnable,
nsresult
BluetoothDaemonCoreModule::DutModeSendCmd(uint16_t aOpcode,
uint8_t* aBuf, uint8_t aLen,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -464,7 +459,7 @@ BluetoothDaemonCoreModule::DutModeSendCmd(uint16_t aOpcode,
nsresult
BluetoothDaemonCoreModule::LeTestModeCmd(uint16_t aOpcode,
uint8_t* aBuf, uint8_t aLen,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
MOZ_ASSERT(NS_IsMainThread());
@ -491,207 +486,207 @@ BluetoothDaemonCoreModule::LeTestModeCmd(uint16_t aOpcode,
void
BluetoothDaemonCoreModule::ErrorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ErrorRunnable::Dispatch(
aRes, &BluetoothResultHandler::OnError, UnpackPDUInitOp(aPDU));
aRes, &BluetoothCoreResultHandler::OnError, UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::EnableRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::Enable, UnpackPDUInitOp(aPDU));
aRes, &BluetoothCoreResultHandler::Enable, UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::DisableRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::Disable, UnpackPDUInitOp(aPDU));
aRes, &BluetoothCoreResultHandler::Disable, UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::GetAdapterPropertiesRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::GetAdapterProperties,
aRes, &BluetoothCoreResultHandler::GetAdapterProperties,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::GetAdapterPropertyRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::GetAdapterProperty,
aRes, &BluetoothCoreResultHandler::GetAdapterProperty,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::SetAdapterPropertyRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::SetAdapterProperty,
aRes, &BluetoothCoreResultHandler::SetAdapterProperty,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::GetRemoteDevicePropertiesRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::GetRemoteDeviceProperties,
aRes, &BluetoothCoreResultHandler::GetRemoteDeviceProperties,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::GetRemoteDevicePropertyRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::GetRemoteDeviceProperty,
aRes, &BluetoothCoreResultHandler::GetRemoteDeviceProperty,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::SetRemoteDevicePropertyRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::SetRemoteDeviceProperty,
aRes, &BluetoothCoreResultHandler::SetRemoteDeviceProperty,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::GetRemoteServiceRecordRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::GetRemoteServiceRecord,
aRes, &BluetoothCoreResultHandler::GetRemoteServiceRecord,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::GetRemoteServicesRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::GetRemoteServices,
aRes, &BluetoothCoreResultHandler::GetRemoteServices,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::StartDiscoveryRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::StartDiscovery,
aRes, &BluetoothCoreResultHandler::StartDiscovery,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::CancelDiscoveryRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::CancelDiscovery,
aRes, &BluetoothCoreResultHandler::CancelDiscovery,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::CreateBondRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::CreateBond,
aRes, &BluetoothCoreResultHandler::CreateBond,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::RemoveBondRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::RemoveBond,
aRes, &BluetoothCoreResultHandler::RemoveBond,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::CancelBondRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::CancelBond,
aRes, &BluetoothCoreResultHandler::CancelBond,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::PinReplyRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::PinReply,
aRes, &BluetoothCoreResultHandler::PinReply,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::SspReplyRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::SspReply,
aRes, &BluetoothCoreResultHandler::SspReply,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::DutModeConfigureRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::DutModeConfigure,
aRes, &BluetoothCoreResultHandler::DutModeConfigure,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::DutModeSendRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::DutModeSend,
aRes, &BluetoothCoreResultHandler::DutModeSend,
UnpackPDUInitOp(aPDU));
}
void
BluetoothDaemonCoreModule::LeTestModeRsp(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes)
BluetoothCoreResultHandler* aRes)
{
ResultRunnable::Dispatch(
aRes, &BluetoothResultHandler::LeTestMode,
aRes, &BluetoothCoreResultHandler::LeTestMode,
UnpackPDUInitOp(aPDU));
}
@ -703,7 +698,7 @@ BluetoothDaemonCoreModule::HandleRsp(
static void (BluetoothDaemonCoreModule::* const HandleRsp[])(
const DaemonSocketPDUHeader&,
DaemonSocketPDU&,
BluetoothResultHandler*) = {
BluetoothCoreResultHandler*) = {
[OPCODE_ERROR] =
&BluetoothDaemonCoreModule::ErrorRsp,
[OPCODE_ENABLE] =
@ -755,8 +750,8 @@ BluetoothDaemonCoreModule::HandleRsp(
return;
}
RefPtr<BluetoothResultHandler> res =
static_cast<BluetoothResultHandler*>(aRes);
RefPtr<BluetoothCoreResultHandler> res =
static_cast<BluetoothCoreResultHandler*>(aRes);
if (!res) {
return; // Return early if no result handler has been set for response
@ -771,7 +766,7 @@ BluetoothDaemonCoreModule::HandleRsp(
class BluetoothDaemonCoreModule::NotificationHandlerWrapper final
{
public:
typedef BluetoothNotificationHandler ObjectType;
typedef BluetoothCoreNotificationHandler ObjectType;
static ObjectType* GetInstance()
{
@ -786,7 +781,7 @@ BluetoothDaemonCoreModule::AdapterStateChangedNtf(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
AdapterStateChangedNotification::Dispatch(
&BluetoothNotificationHandler::AdapterStateChangedNotification,
&BluetoothCoreNotificationHandler::AdapterStateChangedNotification,
UnpackPDUInitOp(aPDU));
}
@ -835,7 +830,7 @@ BluetoothDaemonCoreModule::AdapterPropertiesNtf(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
AdapterPropertiesNotification::Dispatch(
&BluetoothNotificationHandler::AdapterPropertiesNotification,
&BluetoothCoreNotificationHandler::AdapterPropertiesNotification,
AdapterPropertiesInitOp(aPDU));
}
@ -890,7 +885,7 @@ BluetoothDaemonCoreModule::RemoteDevicePropertiesNtf(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
RemoteDevicePropertiesNotification::Dispatch(
&BluetoothNotificationHandler::RemoteDevicePropertiesNotification,
&BluetoothCoreNotificationHandler::RemoteDevicePropertiesNotification,
RemoteDevicePropertiesInitOp(aPDU));
}
@ -932,7 +927,7 @@ BluetoothDaemonCoreModule::DeviceFoundNtf(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
DeviceFoundNotification::Dispatch(
&BluetoothNotificationHandler::DeviceFoundNotification,
&BluetoothCoreNotificationHandler::DeviceFoundNotification,
DeviceFoundInitOp(aPDU));
}
@ -941,7 +936,7 @@ BluetoothDaemonCoreModule::DiscoveryStateChangedNtf(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
DiscoveryStateChangedNotification::Dispatch(
&BluetoothNotificationHandler::DiscoveryStateChangedNotification,
&BluetoothCoreNotificationHandler::DiscoveryStateChangedNotification,
UnpackPDUInitOp(aPDU));
}
@ -950,7 +945,7 @@ BluetoothDaemonCoreModule::PinRequestNtf(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
PinRequestNotification::Dispatch(
&BluetoothNotificationHandler::PinRequestNotification,
&BluetoothCoreNotificationHandler::PinRequestNotification,
UnpackPDUInitOp(aPDU));
}
@ -959,7 +954,7 @@ BluetoothDaemonCoreModule::SspRequestNtf(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
SspRequestNotification::Dispatch(
&BluetoothNotificationHandler::SspRequestNotification,
&BluetoothCoreNotificationHandler::SspRequestNotification,
UnpackPDUInitOp(aPDU));
}
@ -968,7 +963,7 @@ BluetoothDaemonCoreModule::BondStateChangedNtf(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
BondStateChangedNotification::Dispatch(
&BluetoothNotificationHandler::BondStateChangedNotification,
&BluetoothCoreNotificationHandler::BondStateChangedNotification,
UnpackPDUInitOp(aPDU));
}
@ -977,7 +972,7 @@ BluetoothDaemonCoreModule::AclStateChangedNtf(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
AclStateChangedNotification::Dispatch(
&BluetoothNotificationHandler::AclStateChangedNotification,
&BluetoothCoreNotificationHandler::AclStateChangedNotification,
UnpackPDUInitOp(aPDU));
}
@ -1023,7 +1018,7 @@ BluetoothDaemonCoreModule::DutModeRecvNtf(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
DutModeRecvNotification::Dispatch(
&BluetoothNotificationHandler::DutModeRecvNotification,
&BluetoothCoreNotificationHandler::DutModeRecvNotification,
DutModeRecvInitOp(aPDU));
}
@ -1032,7 +1027,7 @@ BluetoothDaemonCoreModule::LeTestModeNtf(
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
{
LeTestModeNotification::Dispatch(
&BluetoothNotificationHandler::LeTestModeNotification,
&BluetoothCoreNotificationHandler::LeTestModeNotification,
UnpackPDUInitOp(aPDU));
}
@ -1068,4 +1063,294 @@ BluetoothDaemonCoreModule::HandleNtf(
(this->*(HandleNtf[index]))(aHeader, aPDU);
}
//
// Core interface
//
BluetoothDaemonCoreInterface::BluetoothDaemonCoreInterface(
BluetoothDaemonCoreModule* aModule)
: mModule(aModule)
{ }
BluetoothDaemonCoreInterface::~BluetoothDaemonCoreInterface()
{ }
void
BluetoothDaemonCoreInterface::SetNotificationHandler(
BluetoothCoreNotificationHandler* aNotificationHandler)
{
MOZ_ASSERT(mModule);
mModule->SetNotificationHandler(aNotificationHandler);
}
/* Enable / Disable */
void
BluetoothDaemonCoreInterface::Enable(BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->EnableCmd(aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonCoreInterface::Disable(BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->DisableCmd(aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Adapter Properties */
void
BluetoothDaemonCoreInterface::GetAdapterProperties(
BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->GetAdapterPropertiesCmd(aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonCoreInterface::GetAdapterProperty(
BluetoothPropertyType aType, BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->GetAdapterPropertyCmd(aType, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonCoreInterface::SetAdapterProperty(
const BluetoothProperty& aProperty, BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->SetAdapterPropertyCmd(aProperty, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Remote Device Properties */
void
BluetoothDaemonCoreInterface::GetRemoteDeviceProperties(
const BluetoothAddress& aRemoteAddr, BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->GetRemoteDevicePropertiesCmd(aRemoteAddr, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonCoreInterface::GetRemoteDeviceProperty(
const BluetoothAddress& aRemoteAddr, BluetoothPropertyType aType,
BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->GetRemoteDevicePropertyCmd(aRemoteAddr, aType, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonCoreInterface::SetRemoteDeviceProperty(
const BluetoothAddress& aRemoteAddr, const BluetoothProperty& aProperty,
BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->SetRemoteDevicePropertyCmd(aRemoteAddr,
aProperty,
aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Remote Services */
void
BluetoothDaemonCoreInterface::GetRemoteServiceRecord(
const BluetoothAddress& aRemoteAddr, const BluetoothUuid& aUuid,
BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->GetRemoteServiceRecordCmd(aRemoteAddr, aUuid, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonCoreInterface::GetRemoteServices(
const BluetoothAddress& aRemoteAddr, BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->GetRemoteServicesCmd(aRemoteAddr, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Discovery */
void
BluetoothDaemonCoreInterface::StartDiscovery(BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->StartDiscoveryCmd(aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonCoreInterface::CancelDiscovery(BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->CancelDiscoveryCmd(aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Bonds */
void
BluetoothDaemonCoreInterface::CreateBond(const BluetoothAddress& aBdAddr,
BluetoothTransport aTransport,
BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->CreateBondCmd(aBdAddr, aTransport, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonCoreInterface::RemoveBond(const BluetoothAddress& aBdAddr,
BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->RemoveBondCmd(aBdAddr, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonCoreInterface::CancelBond(
const BluetoothAddress& aBdAddr, BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->CancelBondCmd(aBdAddr, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Connection */
void
BluetoothDaemonCoreInterface::GetConnectionState(
const BluetoothAddress& aBdAddr, BluetoothCoreResultHandler* aRes)
{
// NO-OP: no corresponding interface of current BlueZ
}
/* Authentication */
void
BluetoothDaemonCoreInterface::PinReply(const BluetoothAddress& aBdAddr,
bool aAccept,
const BluetoothPinCode& aPinCode,
BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->PinReplyCmd(aBdAddr, aAccept, aPinCode, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonCoreInterface::SspReply(const BluetoothAddress& aBdAddr,
BluetoothSspVariant aVariant,
bool aAccept, uint32_t aPasskey,
BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->SspReplyCmd(aBdAddr, aVariant, aAccept, aPasskey,
aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* DUT Mode */
void
BluetoothDaemonCoreInterface::DutModeConfigure(
bool aEnable, BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->DutModeConfigureCmd(aEnable, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonCoreInterface::DutModeSend(uint16_t aOpcode,
uint8_t* aBuf,
uint8_t aLen,
BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->DutModeSendCmd(aOpcode, aBuf, aLen, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* LE Mode */
void
BluetoothDaemonCoreInterface::LeTestMode(uint16_t aOpcode,
uint8_t* aBuf,
uint8_t aLen,
BluetoothCoreResultHandler* aRes)
{
nsresult rv = mModule->LeTestModeCmd(aOpcode, aBuf, aLen, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Energy Information */
void
BluetoothDaemonCoreInterface::ReadEnergyInfo(BluetoothCoreResultHandler* aRes)
{
// NO-OP: no corresponding interface of current BlueZ
}
void
BluetoothDaemonCoreInterface::DispatchError(BluetoothCoreResultHandler* aRes,
BluetoothStatus aStatus)
{
DaemonResultRunnable1<
BluetoothCoreResultHandler, void,
BluetoothStatus, BluetoothStatus>::Dispatch(
aRes, &BluetoothCoreResultHandler::OnError,
ConstantInitOp1<BluetoothStatus>(aStatus));
}
void
BluetoothDaemonCoreInterface::DispatchError(BluetoothCoreResultHandler* aRes,
nsresult aRv)
{
BluetoothStatus status;
if (NS_WARN_IF(NS_FAILED(Convert(aRv, status)))) {
status = STATUS_FAIL;
}
DispatchError(aRes, status);
}
END_BLUETOOTH_NAMESPACE

View File

@ -65,74 +65,73 @@ public:
DaemonSocketResultHandler* aRes) = 0;
void SetNotificationHandler(
BluetoothNotificationHandler* aNotificationHandler);
BluetoothNotificationHandler* GetNotificationHandler();
BluetoothCoreNotificationHandler* aNotificationHandler);
//
// Commands
//
nsresult EnableCmd(BluetoothResultHandler* aRes);
nsresult EnableCmd(BluetoothCoreResultHandler* aRes);
nsresult DisableCmd(BluetoothResultHandler* aRes);
nsresult DisableCmd(BluetoothCoreResultHandler* aRes);
nsresult GetAdapterPropertiesCmd(BluetoothResultHandler* aRes);
nsresult GetAdapterPropertiesCmd(BluetoothCoreResultHandler* aRes);
nsresult GetAdapterPropertyCmd(BluetoothPropertyType aType,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult SetAdapterPropertyCmd(const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult GetRemoteDevicePropertiesCmd(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult GetRemoteDevicePropertyCmd(const BluetoothAddress& aRemoteAddr,
BluetoothPropertyType aType,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult SetRemoteDevicePropertyCmd(const BluetoothAddress& aRemoteAddr,
const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult GetRemoteServiceRecordCmd(const BluetoothAddress& aRemoteAddr,
const BluetoothUuid& aUuid,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult GetRemoteServicesCmd(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult StartDiscoveryCmd(BluetoothResultHandler* aRes);
nsresult StartDiscoveryCmd(BluetoothCoreResultHandler* aRes);
nsresult CancelDiscoveryCmd(BluetoothResultHandler* aRes);
nsresult CancelDiscoveryCmd(BluetoothCoreResultHandler* aRes);
nsresult CreateBondCmd(const BluetoothAddress& aBdAddr,
BluetoothTransport aTransport,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult RemoveBondCmd(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult CancelBondCmd(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult PinReplyCmd(const BluetoothAddress& aBdAddr, bool aAccept,
const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult SspReplyCmd(const BluetoothAddress& aBdAddr,
BluetoothSspVariant aVariant,
bool aAccept, uint32_t aPasskey,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult DutModeConfigureCmd(bool aEnable, BluetoothResultHandler* aRes);
nsresult DutModeConfigureCmd(bool aEnable,
BluetoothCoreResultHandler* aRes);
nsresult DutModeSendCmd(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
nsresult LeTestModeCmd(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
protected:
void HandleSvc(const DaemonSocketPDUHeader& aHeader,
@ -145,91 +144,90 @@ private:
//
typedef mozilla::ipc::DaemonResultRunnable0<
BluetoothResultHandler, void>
BluetoothCoreResultHandler, void>
ResultRunnable;
typedef mozilla::ipc::DaemonResultRunnable1<
BluetoothResultHandler, void, BluetoothStatus, BluetoothStatus>
BluetoothCoreResultHandler, void, BluetoothStatus, BluetoothStatus>
ErrorRunnable;
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void EnableRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void DisableRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void GetAdapterPropertiesRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void GetAdapterPropertyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void SetAdapterPropertyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void GetRemoteDevicePropertiesRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void
GetRemoteDevicePropertyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
void GetRemoteDevicePropertyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothCoreResultHandler* aRes);
void SetRemoteDevicePropertyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void GetRemoteServiceRecordRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void GetRemoteServicesRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void StartDiscoveryRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void CancelDiscoveryRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void CreateBondRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void RemoveBondRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void CancelBondRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void PinReplyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void SspReplyRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void DutModeConfigureRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void DutModeSendRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void LeTestModeRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU,
BluetoothResultHandler* aRes);
BluetoothCoreResultHandler* aRes);
void HandleRsp(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, DaemonSocketResultHandler* aRes);
@ -339,7 +337,104 @@ private:
void HandleNtf(const DaemonSocketPDUHeader& aHeader,
DaemonSocketPDU& aPDU, DaemonSocketResultHandler* aRes);
static BluetoothNotificationHandler* sNotificationHandler;
static BluetoothCoreNotificationHandler* sNotificationHandler;
};
class BluetoothDaemonCoreInterface final
: public BluetoothCoreInterface
{
public:
BluetoothDaemonCoreInterface(BluetoothDaemonCoreModule* aModule);
~BluetoothDaemonCoreInterface();
void SetNotificationHandler(
BluetoothCoreNotificationHandler* aNotificationHandler) override;
/* Enable / Disable */
void Enable(BluetoothCoreResultHandler* aRes) override;
void Disable(BluetoothCoreResultHandler* aRes) override;
/* Adapter Properties */
void GetAdapterProperties(BluetoothCoreResultHandler* aRes) override;
void GetAdapterProperty(BluetoothPropertyType aType,
BluetoothCoreResultHandler* aRes) override;
void SetAdapterProperty(const BluetoothProperty& aProperty,
BluetoothCoreResultHandler* aRes) override;
/* Remote Device Properties */
void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr,
BluetoothCoreResultHandler* aRes) override;
void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
BluetoothPropertyType aType,
BluetoothCoreResultHandler* aRes) override;
void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const BluetoothProperty& aProperty,
BluetoothCoreResultHandler* aRes) override;
/* Remote Services */
void GetRemoteServiceRecord(const BluetoothAddress& aRemoteAddr,
const BluetoothUuid& aUuid,
BluetoothCoreResultHandler* aRes) override;
void GetRemoteServices(const BluetoothAddress& aRemoteAddr,
BluetoothCoreResultHandler* aRes) override;
/* Discovery */
void StartDiscovery(BluetoothCoreResultHandler* aRes) override;
void CancelDiscovery(BluetoothCoreResultHandler* aRes) override;
/* Bonds */
void CreateBond(const BluetoothAddress& aBdAddr,
BluetoothTransport aTransport,
BluetoothCoreResultHandler* aRes) override;
void RemoveBond(const BluetoothAddress& aBdAddr,
BluetoothCoreResultHandler* aRes) override;
void CancelBond(const BluetoothAddress& aBdAddr,
BluetoothCoreResultHandler* aRes) override;
/* Connection */
void GetConnectionState(const BluetoothAddress& aBdAddr,
BluetoothCoreResultHandler* aRes) override;
/* Authentication */
void PinReply(const BluetoothAddress& aBdAddr, bool aAccept,
const BluetoothPinCode& aPinCode,
BluetoothCoreResultHandler* aRes) override;
void SspReply(const BluetoothAddress& aBdAddr,
BluetoothSspVariant aVariant,
bool aAccept, uint32_t aPasskey,
BluetoothCoreResultHandler* aRes) override;
/* DUT Mode */
void DutModeConfigure(bool aEnable, BluetoothCoreResultHandler* aRes);
void DutModeSend(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
BluetoothCoreResultHandler* aRes) override;
/* LE Mode */
void LeTestMode(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
BluetoothCoreResultHandler* aRes) override;
/* Energy Information */
void ReadEnergyInfo(BluetoothCoreResultHandler* aRes) override;
private:
void DispatchError(BluetoothCoreResultHandler* aRes,
BluetoothStatus aStatus);
void DispatchError(BluetoothCoreResultHandler* aRes,
nsresult aRv);
BluetoothDaemonCoreModule* mModule;
};
END_BLUETOOTH_NAMESPACE

View File

@ -28,6 +28,9 @@ using namespace mozilla::ipc;
static const int sRetryInterval = 100; // ms
BluetoothNotificationHandler*
BluetoothDaemonInterface::sNotificationHandler;
//
// Protocol handling
//
@ -435,6 +438,10 @@ BluetoothDaemonInterface::Init(
#define BASE_SOCKET_NAME "bluetoothd"
static unsigned long POSTFIX_LENGTH = 16;
// First of all, we set the notification handler. Backend crashes
// will be reported this way.
sNotificationHandler = aNotificationHandler;
// If we could not cleanup properly before and an old
// instance of the daemon is still running, we kill it
// here.
@ -445,8 +452,6 @@ BluetoothDaemonInterface::Init(
if (!mProtocol) {
mProtocol = new BluetoothDaemonProtocol();
}
static_cast<BluetoothDaemonCoreModule*>(mProtocol)->SetNotificationHandler(
aNotificationHandler);
if (!mListenSocket) {
mListenSocket = new ListenSocket(this, LISTEN_SOCKET);
@ -556,8 +561,7 @@ private:
void
BluetoothDaemonInterface::Cleanup(BluetoothResultHandler* aRes)
{
static_cast<BluetoothDaemonCoreModule*>(mProtocol)->SetNotificationHandler(
nullptr);
sNotificationHandler = nullptr;
// Cleanup, step 1: Unregister Socket module
nsresult rv = mProtocol->UnregisterModuleCmd(
@ -570,264 +574,6 @@ BluetoothDaemonInterface::Cleanup(BluetoothResultHandler* aRes)
mResultHandlerQ.AppendElement(aRes);
}
void
BluetoothDaemonInterface::Enable(BluetoothResultHandler* aRes)
{
nsresult rv =
static_cast<BluetoothDaemonCoreModule*>(mProtocol)->EnableCmd(aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonInterface::Disable(BluetoothResultHandler* aRes)
{
nsresult rv =
static_cast<BluetoothDaemonCoreModule*>(mProtocol)->DisableCmd(aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Adapter Properties */
void
BluetoothDaemonInterface::GetAdapterProperties(BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->GetAdapterPropertiesCmd(aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonInterface::GetAdapterProperty(BluetoothPropertyType aType,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->GetAdapterPropertyCmd(aType, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonInterface::SetAdapterProperty(
const BluetoothProperty& aProperty, BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->SetAdapterPropertyCmd(aProperty, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Remote Device Properties */
void
BluetoothDaemonInterface::GetRemoteDeviceProperties(
const BluetoothAddress& aRemoteAddr, BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->GetRemoteDevicePropertiesCmd(aRemoteAddr, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonInterface::GetRemoteDeviceProperty(
const BluetoothAddress& aRemoteAddr, BluetoothPropertyType aType,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->GetRemoteDevicePropertyCmd(aRemoteAddr, aType, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonInterface::SetRemoteDeviceProperty(
const BluetoothAddress& aRemoteAddr, const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->SetRemoteDevicePropertyCmd(aRemoteAddr, aProperty, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Remote Services */
void
BluetoothDaemonInterface::GetRemoteServiceRecord(
const BluetoothAddress& aRemoteAddr, const BluetoothUuid& aUuid,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->GetRemoteServiceRecordCmd(aRemoteAddr, aUuid, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonInterface::GetRemoteServices(
const BluetoothAddress& aRemoteAddr, BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->GetRemoteServicesCmd(aRemoteAddr, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Discovery */
void
BluetoothDaemonInterface::StartDiscovery(BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->StartDiscoveryCmd(aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonInterface::CancelDiscovery(BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->CancelDiscoveryCmd(aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Bonds */
void
BluetoothDaemonInterface::CreateBond(const BluetoothAddress& aBdAddr,
BluetoothTransport aTransport,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->CreateBondCmd(aBdAddr, aTransport, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonInterface::RemoveBond(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->RemoveBondCmd(aBdAddr, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonInterface::CancelBond(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->CancelBondCmd(aBdAddr, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Connection */
void
BluetoothDaemonInterface::GetConnectionState(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes)
{
// NO-OP: no corresponding interface of current BlueZ
}
/* Authentication */
void
BluetoothDaemonInterface::PinReply(const BluetoothAddress& aBdAddr,
bool aAccept,
const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->PinReplyCmd(aBdAddr, aAccept, aPinCode, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonInterface::SspReply(const BluetoothAddress& aBdAddr,
BluetoothSspVariant aVariant,
bool aAccept, uint32_t aPasskey,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->SspReplyCmd(aBdAddr, aVariant, aAccept, aPasskey, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* DUT Mode */
void
BluetoothDaemonInterface::DutModeConfigure(bool aEnable,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->DutModeConfigureCmd(aEnable, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
void
BluetoothDaemonInterface::DutModeSend(uint16_t aOpcode, uint8_t* aBuf,
uint8_t aLen,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->DutModeSendCmd(aOpcode, aBuf, aLen, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* LE Mode */
void
BluetoothDaemonInterface::LeTestMode(uint16_t aOpcode, uint8_t* aBuf,
uint8_t aLen,
BluetoothResultHandler* aRes)
{
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->LeTestModeCmd(aOpcode, aBuf, aLen, aRes);
if (NS_FAILED(rv)) {
DispatchError(aRes, rv);
}
}
/* Energy Information */
void
BluetoothDaemonInterface::ReadEnergyInfo(BluetoothResultHandler* aRes)
{
// NO-OP: no corresponding interface of current BlueZ
}
void
BluetoothDaemonInterface::DispatchError(BluetoothResultHandler* aRes,
BluetoothStatus aStatus)
@ -865,6 +611,18 @@ BluetoothDaemonInterface::GetBluetoothSetupInterface()
return mSetupInterface;
}
BluetoothCoreInterface*
BluetoothDaemonInterface::GetBluetoothCoreInterface()
{
if (mCoreInterface) {
return mCoreInterface;
}
mCoreInterface = new BluetoothDaemonCoreInterface(mProtocol);
return mCoreInterface;
}
BluetoothSocketInterface*
BluetoothDaemonInterface::GetBluetoothSocketInterface()
{
@ -1057,22 +815,17 @@ BluetoothDaemonInterface::OnDisconnect(int aIndex)
break;
}
BluetoothNotificationHandler* notificationHandler =
static_cast<BluetoothDaemonCoreModule*>(mProtocol)->
GetNotificationHandler();
/* For recovery make sure all sockets disconnected, in order to avoid
* the remaining disconnects interfere with the restart procedure.
*/
if (notificationHandler && mResultHandlerQ.IsEmpty()) {
if (sNotificationHandler && mResultHandlerQ.IsEmpty()) {
if (mListenSocket->GetConnectionStatus() == SOCKET_DISCONNECTED &&
mCmdChannel->GetConnectionStatus() == SOCKET_DISCONNECTED &&
mNtfChannel->GetConnectionStatus() == SOCKET_DISCONNECTED) {
// Assume daemon crashed during regular service; notify
// BluetoothServiceBluedroid to prepare restart-daemon procedure
notificationHandler->BackendErrorNotification(true);
static_cast<BluetoothDaemonCoreModule*>(mProtocol)->
SetNotificationHandler(nullptr);
sNotificationHandler->BackendErrorNotification(true);
sNotificationHandler = nullptr;
}
}
}

View File

@ -24,6 +24,7 @@ BEGIN_BLUETOOTH_NAMESPACE
class BluetoothDaemonA2dpInterface;
class BluetoothDaemonAvrcpInterface;
class BluetoothDaemonCoreInterface;
class BluetoothDaemonGattInterface;
class BluetoothDaemonHandsfreeInterface;
class BluetoothDaemonProtocol;
@ -50,85 +51,10 @@ public:
BluetoothResultHandler* aRes) override;
void Cleanup(BluetoothResultHandler* aRes) override;
void Enable(BluetoothResultHandler* aRes) override;
void Disable(BluetoothResultHandler* aRes) override;
/* Adapter Properties */
void GetAdapterProperties(BluetoothResultHandler* aRes) override;
void GetAdapterProperty(BluetoothPropertyType aType,
BluetoothResultHandler* aRes) override;
void SetAdapterProperty(const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) override;
/* Remote Device Properties */
void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes) override;
void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
BluetoothPropertyType aType,
BluetoothResultHandler* aRes) override;
void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) override;
/* Remote Services */
void GetRemoteServiceRecord(const BluetoothAddress& aRemoteAddr,
const BluetoothUuid& aUuid,
BluetoothResultHandler* aRes) override;
void GetRemoteServices(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes) override;
/* Discovery */
void StartDiscovery(BluetoothResultHandler* aRes) override;
void CancelDiscovery(BluetoothResultHandler* aRes) override;
/* Bonds */
void CreateBond(const BluetoothAddress& aBdAddr,
BluetoothTransport aTransport,
BluetoothResultHandler* aRes) override;
void RemoveBond(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes) override;
void CancelBond(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes) override;
/* Connection */
void GetConnectionState(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes) override;
/* Authentication */
void PinReply(const BluetoothAddress& aBdAddr, bool aAccept,
const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes) override;
void SspReply(const BluetoothAddress& aBdAddr,
BluetoothSspVariant aVariant,
bool aAccept, uint32_t aPasskey,
BluetoothResultHandler* aRes) override;
/* DUT Mode */
void DutModeConfigure(bool aEnable, BluetoothResultHandler* aRes);
void DutModeSend(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
BluetoothResultHandler* aRes) override;
/* LE Mode */
void LeTestMode(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
BluetoothResultHandler* aRes) override;
/* Energy Information */
void ReadEnergyInfo(BluetoothResultHandler* aRes) override;
/* Service Interfaces */
BluetoothSetupInterface* GetBluetoothSetupInterface() override;
BluetoothCoreInterface* GetBluetoothCoreInterface() override;
BluetoothSocketInterface* GetBluetoothSocketInterface() override;
BluetoothHandsfreeInterface* GetBluetoothHandsfreeInterface() override;
BluetoothA2dpInterface* GetBluetoothA2dpInterface() override;
@ -156,6 +82,8 @@ private:
void DispatchError(BluetoothResultHandler* aRes, BluetoothStatus aStatus);
void DispatchError(BluetoothResultHandler* aRes, nsresult aRv);
static BluetoothNotificationHandler* sNotificationHandler;
nsCString mListenSocketName;
RefPtr<mozilla::ipc::ListenSocket> mListenSocket;
RefPtr<mozilla::ipc::DaemonSocket> mCmdChannel;
@ -165,6 +93,7 @@ private:
nsTArray<RefPtr<BluetoothResultHandler> > mResultHandlerQ;
nsAutoPtr<BluetoothDaemonSetupInterface> mSetupInterface;
nsAutoPtr<BluetoothDaemonCoreInterface> mCoreInterface;
nsAutoPtr<BluetoothDaemonSocketInterface> mSocketInterface;
nsAutoPtr<BluetoothDaemonHandsfreeInterface> mHandsfreeInterface;
nsAutoPtr<BluetoothDaemonA2dpInterface> mA2dpInterface;

View File

@ -68,10 +68,11 @@ using namespace mozilla::ipc;
USING_BLUETOOTH_NAMESPACE
static BluetoothInterface* sBtInterface;
static BluetoothCoreInterface* sBtCoreInterface;
static nsTArray<RefPtr<BluetoothProfileController> > sControllerArray;
class BluetoothServiceBluedroid::EnableResultHandler final
: public BluetoothResultHandler
: public BluetoothCoreResultHandler
{
public:
void OnError(BluetoothStatus aStatus) override
@ -115,7 +116,16 @@ public:
private:
void Proceed() const
{
sBtInterface->Enable(new EnableResultHandler());
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE_VOID(bs);
sBtCoreInterface = sBtInterface->GetBluetoothCoreInterface();
NS_ENSURE_TRUE_VOID(sBtCoreInterface);
sBtCoreInterface->SetNotificationHandler(
reinterpret_cast<BluetoothServiceBluedroid*>(bs));
sBtCoreInterface->Enable(new EnableResultHandler());
}
unsigned char mNumProfiles;
@ -182,7 +192,7 @@ BluetoothServiceBluedroid::StartGonkBluetooth()
}
class BluetoothServiceBluedroid::DisableResultHandler final
: public BluetoothResultHandler
: public BluetoothCoreResultHandler
{
public:
void OnError(BluetoothStatus aStatus) override
@ -212,7 +222,7 @@ BluetoothServiceBluedroid::StopGonkBluetooth()
return NS_OK;
}
sBtInterface->Disable(new DisableResultHandler());
sBtCoreInterface->Disable(new DisableResultHandler());
return NS_OK;
}
@ -816,9 +826,8 @@ public:
RefPtr<BluetoothReplyRunnable> mRunnable;
};
class BluetoothServiceBluedroid::GetRemoteDevicePropertiesResultHandler
final
: public BluetoothResultHandler
class BluetoothServiceBluedroid::GetRemoteDevicePropertiesResultHandler final
: public BluetoothCoreResultHandler
{
public:
GetRemoteDevicePropertiesResultHandler(
@ -883,7 +892,7 @@ BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal(
GetDeviceRequest request(1, aRunnable);
mGetDeviceRequests.AppendElement(request);
sBtInterface->GetRemoteDeviceProperties(address,
sBtCoreInterface->GetRemoteDeviceProperties(address,
new GetRemoteDevicePropertiesResultHandler(mGetDeviceRequests, address));
return NS_OK;
@ -909,7 +918,7 @@ BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal(
for (uint8_t i = 0; i < aDeviceAddress.Length(); i++) {
// Retrieve all properties of devices
sBtInterface->GetRemoteDeviceProperties(aDeviceAddress[i],
sBtCoreInterface->GetRemoteDeviceProperties(aDeviceAddress[i],
new GetRemoteDevicePropertiesResultHandler(mGetDeviceRequests,
aDeviceAddress[i]));
}
@ -918,7 +927,7 @@ BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal(
}
class BluetoothServiceBluedroid::DispatchReplyErrorResultHandler final
: public BluetoothResultHandler
: public BluetoothCoreResultHandler
{
public:
DispatchReplyErrorResultHandler(
@ -951,7 +960,7 @@ BluetoothServiceBluedroid::StartDiscoveryInternal(
ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
mChangeDiscoveryRunnables.AppendElement(aRunnable);
sBtInterface->StartDiscovery(
sBtCoreInterface->StartDiscovery(
new DispatchReplyErrorResultHandler(mChangeDiscoveryRunnables, aRunnable));
}
@ -972,7 +981,7 @@ BluetoothServiceBluedroid::FetchUuidsInternal(
}
mFetchUuidsRunnables.AppendElement(aRunnable);
sBtInterface->GetRemoteServices(aDeviceAddress,
sBtCoreInterface->GetRemoteServices(aDeviceAddress,
new DispatchReplyErrorResultHandler(mFetchUuidsRunnables, aRunnable));
return NS_OK;
@ -987,7 +996,7 @@ BluetoothServiceBluedroid::StopDiscoveryInternal(
ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
mChangeDiscoveryRunnables.AppendElement(aRunnable);
sBtInterface->CancelDiscovery(
sBtCoreInterface->CancelDiscovery(
new DispatchReplyErrorResultHandler(mChangeDiscoveryRunnables, aRunnable));
}
@ -1008,7 +1017,7 @@ BluetoothServiceBluedroid::SetProperty(BluetoothObjectType aType,
}
mSetAdapterPropertyRunnables.AppendElement(aRunnable);
sBtInterface->SetAdapterProperty(
sBtCoreInterface->SetAdapterProperty(
property,
new DispatchReplyErrorResultHandler(mSetAdapterPropertyRunnables,
aRunnable));
@ -1034,7 +1043,7 @@ struct BluetoothServiceBluedroid::GetRemoteServiceRecordRequest final
};
class BluetoothServiceBluedroid::GetRemoteServiceRecordResultHandler final
: public BluetoothResultHandler
: public BluetoothCoreResultHandler
{
public:
GetRemoteServiceRecordResultHandler(
@ -1067,7 +1076,7 @@ public:
void CancelDiscovery() override
{
// Disabled discovery mode, now perform SDP operation.
sBtInterface->GetRemoteServiceRecord(mDeviceAddress, mUuid, this);
sBtCoreInterface->GetRemoteServiceRecord(mDeviceAddress, mUuid, this);
}
private:
@ -1097,7 +1106,7 @@ BluetoothServiceBluedroid::GetServiceChannel(
mGetRemoteServiceRecordArray.AppendElement(
GetRemoteServiceRecordRequest(aDeviceAddress, aServiceUuid, aManager));
RefPtr<BluetoothResultHandler> res =
RefPtr<BluetoothCoreResultHandler> res =
new GetRemoteServiceRecordResultHandler(mGetRemoteServiceRecordArray,
aDeviceAddress, aServiceUuid);
@ -1105,9 +1114,9 @@ BluetoothServiceBluedroid::GetServiceChannel(
* won't be performed while the adapter is in discovery mode.
*/
if (mDiscovering) {
sBtInterface->CancelDiscovery(res);
sBtCoreInterface->CancelDiscovery(res);
} else {
sBtInterface->GetRemoteServiceRecord(aDeviceAddress, aServiceUuid, res);
sBtCoreInterface->GetRemoteServiceRecord(aDeviceAddress, aServiceUuid, res);
}
return NS_OK;
@ -1128,7 +1137,7 @@ struct BluetoothServiceBluedroid::GetRemoteServicesRequest final
};
class BluetoothServiceBluedroid::GetRemoteServicesResultHandler final
: public BluetoothResultHandler
: public BluetoothCoreResultHandler
{
public:
GetRemoteServicesResultHandler(
@ -1161,7 +1170,7 @@ public:
void CancelDiscovery() override
{
// Disabled discovery mode, now perform SDP operation.
sBtInterface->GetRemoteServices(mDeviceAddress, this);
sBtCoreInterface->GetRemoteServices(mDeviceAddress, this);
}
private:
@ -1190,7 +1199,7 @@ BluetoothServiceBluedroid::UpdateSdpRecords(
mGetRemoteServicesArray.AppendElement(
GetRemoteServicesRequest(aDeviceAddress, aManager));
RefPtr<BluetoothResultHandler> res =
RefPtr<BluetoothCoreResultHandler> res =
new GetRemoteServicesResultHandler(mGetRemoteServicesArray,
aDeviceAddress, aManager);
@ -1198,9 +1207,9 @@ BluetoothServiceBluedroid::UpdateSdpRecords(
* won't be performed while the adapter is in discovery mode.
*/
if (mDiscovering) {
sBtInterface->CancelDiscovery(res);
sBtCoreInterface->CancelDiscovery(res);
} else {
sBtInterface->GetRemoteServices(aDeviceAddress, res);
sBtCoreInterface->GetRemoteServices(aDeviceAddress, res);
}
return true;
@ -1216,7 +1225,7 @@ BluetoothServiceBluedroid::CreatePairedDeviceInternal(
ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK);
mCreateBondRunnables.AppendElement(aRunnable);
sBtInterface->CreateBond(aDeviceAddress, TRANSPORT_AUTO,
sBtCoreInterface->CreateBond(aDeviceAddress, TRANSPORT_AUTO,
new DispatchReplyErrorResultHandler(mCreateBondRunnables, aRunnable));
return NS_OK;
@ -1231,14 +1240,14 @@ BluetoothServiceBluedroid::RemoveDeviceInternal(
ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK);
mRemoveBondRunnables.AppendElement(aRunnable);
sBtInterface->RemoveBond(aDeviceAddress,
sBtCoreInterface->RemoveBond(aDeviceAddress,
new DispatchReplyErrorResultHandler(mRemoveBondRunnables, aRunnable));
return NS_OK;
}
class BluetoothServiceBluedroid::PinReplyResultHandler final
: public BluetoothResultHandler
: public BluetoothCoreResultHandler
{
public:
PinReplyResultHandler(BluetoothReplyRunnable* aRunnable)
@ -1268,8 +1277,8 @@ BluetoothServiceBluedroid::PinReplyInternal(
ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
sBtInterface->PinReply(aDeviceAddress, aAccept, aPinCode,
new PinReplyResultHandler(aRunnable));
sBtCoreInterface->PinReply(aDeviceAddress, aAccept, aPinCode,
new PinReplyResultHandler(aRunnable));
}
void
@ -1289,7 +1298,7 @@ BluetoothServiceBluedroid::SetPasskeyInternal(
}
class BluetoothServiceBluedroid::SspReplyResultHandler final
: public BluetoothResultHandler
: public BluetoothCoreResultHandler
{
public:
SspReplyResultHandler(BluetoothReplyRunnable* aRunnable)
@ -1319,8 +1328,9 @@ BluetoothServiceBluedroid::SspReplyInternal(
ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
sBtInterface->SspReply(aDeviceAddress, aVariant, aAccept, 0 /* passkey */,
new SspReplyResultHandler(aRunnable));
sBtCoreInterface->SspReply(aDeviceAddress, aVariant, aAccept,
0 /* passkey */,
new SspReplyResultHandler(aRunnable));
}
void
@ -1926,6 +1936,7 @@ private:
return;
}
sBtCoreInterface = nullptr;
sBtInterface->Cleanup(new CleanupResultHandler());
}
@ -1935,7 +1946,7 @@ private:
class BluetoothServiceBluedroid::SetAdapterPropertyDiscoverableResultHandler
final
: public BluetoothResultHandler
: public BluetoothCoreResultHandler
{
public:
void OnError(BluetoothStatus aStatus) override
@ -2027,8 +2038,9 @@ BluetoothServiceBluedroid::AdapterStateChangedNotification(bool aState)
// Bluetooth scan mode is SCAN_MODE_CONNECTABLE by default, i.e., it should
// be connectable and non-discoverable.
NS_ENSURE_TRUE_VOID(sBtInterface);
sBtInterface->SetAdapterProperty(
NS_ENSURE_TRUE_VOID(sBtCoreInterface);
sBtCoreInterface->SetAdapterProperty(
BluetoothProperty(PROPERTY_ADAPTER_SCAN_MODE, SCAN_MODE_CONNECTABLE),
new SetAdapterPropertyDiscoverableResultHandler());

View File

@ -15,8 +15,10 @@
BEGIN_BLUETOOTH_NAMESPACE
class BluetoothServiceBluedroid : public BluetoothService
, public BluetoothNotificationHandler
class BluetoothServiceBluedroid
: public BluetoothService
, public BluetoothCoreNotificationHandler
, public BluetoothNotificationHandler
{
class CleanupResultHandler;
class DisableResultHandler;

View File

@ -45,6 +45,193 @@ BluetoothSetupResultHandler::Configuration()
BluetoothSetupInterface::~BluetoothSetupInterface()
{ }
//
// Bluetooth Core Interface
//
// Notification handling
//
BluetoothCoreNotificationHandler::BluetoothCoreNotificationHandler()
{ }
BluetoothCoreNotificationHandler::~BluetoothCoreNotificationHandler()
{ }
void
BluetoothCoreNotificationHandler::AdapterStateChangedNotification(bool aState)
{ }
void
BluetoothCoreNotificationHandler::AdapterPropertiesNotification(
BluetoothStatus aStatus,int aNumProperties,
const BluetoothProperty* aProperties)
{ }
void
BluetoothCoreNotificationHandler::RemoteDevicePropertiesNotification(
BluetoothStatus aStatus, const BluetoothAddress& aBdAddr,
int aNumProperties, const BluetoothProperty* aProperties)
{ }
void
BluetoothCoreNotificationHandler::DeviceFoundNotification(
int aNumProperties, const BluetoothProperty* aProperties)
{ }
void
BluetoothCoreNotificationHandler::DiscoveryStateChangedNotification(
bool aState)
{ }
void
BluetoothCoreNotificationHandler::PinRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod)
{ }
void
BluetoothCoreNotificationHandler::SspRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod, BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
{ }
void
BluetoothCoreNotificationHandler::BondStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothBondState aState)
{ }
void
BluetoothCoreNotificationHandler::AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothAclState aState)
{ }
void
BluetoothCoreNotificationHandler::DutModeRecvNotification(
uint16_t aOpcode,
const uint8_t* aBuf,
uint8_t aLen)
{ }
void
BluetoothCoreNotificationHandler::LeTestModeNotification(
BluetoothStatus aStatus,
uint16_t aNumPackets)
{ }
void
BluetoothCoreNotificationHandler::EnergyInfoNotification(
const BluetoothActivityEnergyInfo& aInfo)
{ }
// Result handling
//
void
BluetoothCoreResultHandler::OnError(BluetoothStatus aStatus)
{
BT_LOGR("Received error code %d", aStatus);
}
void
BluetoothCoreResultHandler::Enable()
{ }
void
BluetoothCoreResultHandler::Disable()
{ }
void
BluetoothCoreResultHandler::GetAdapterProperties()
{ }
void
BluetoothCoreResultHandler::GetAdapterProperty()
{ }
void
BluetoothCoreResultHandler::SetAdapterProperty()
{ }
void
BluetoothCoreResultHandler::GetRemoteDeviceProperties()
{ }
void
BluetoothCoreResultHandler::GetRemoteDeviceProperty()
{ }
void
BluetoothCoreResultHandler::SetRemoteDeviceProperty()
{ }
void
BluetoothCoreResultHandler::GetRemoteServiceRecord()
{ }
void
BluetoothCoreResultHandler::GetRemoteServices()
{ }
void
BluetoothCoreResultHandler::StartDiscovery()
{ }
void
BluetoothCoreResultHandler::CancelDiscovery()
{ }
void
BluetoothCoreResultHandler::CreateBond()
{ }
void
BluetoothCoreResultHandler::RemoveBond()
{ }
void
BluetoothCoreResultHandler::CancelBond()
{ }
void
BluetoothCoreResultHandler::GetConnectionState()
{ }
void
BluetoothCoreResultHandler::PinReply()
{ }
void
BluetoothCoreResultHandler::SspReply()
{ }
void
BluetoothCoreResultHandler::DutModeConfigure()
{ }
void
BluetoothCoreResultHandler::DutModeSend()
{ }
void
BluetoothCoreResultHandler::LeTestMode()
{ }
void
BluetoothCoreResultHandler::ReadEnergyInfo()
{ }
// Interface
//
BluetoothCoreInterface::BluetoothCoreInterface()
{ }
BluetoothCoreInterface::~BluetoothCoreInterface()
{ }
//
// Socket Interface
//
@ -811,7 +998,7 @@ BluetoothGattInterface::~BluetoothGattInterface()
{ }
//
// Bluetooth Core Interface
// Bluetooth Interface
//
// Notification handling
@ -823,71 +1010,6 @@ BluetoothNotificationHandler::BluetoothNotificationHandler()
BluetoothNotificationHandler::~BluetoothNotificationHandler()
{ }
void
BluetoothNotificationHandler::AdapterStateChangedNotification(bool aState)
{ }
void
BluetoothNotificationHandler::AdapterPropertiesNotification(
BluetoothStatus aStatus,int aNumProperties,
const BluetoothProperty* aProperties)
{ }
void
BluetoothNotificationHandler::RemoteDevicePropertiesNotification(
BluetoothStatus aStatus, const BluetoothAddress& aBdAddr,
int aNumProperties, const BluetoothProperty* aProperties)
{ }
void
BluetoothNotificationHandler::DeviceFoundNotification(
int aNumProperties, const BluetoothProperty* aProperties)
{ }
void
BluetoothNotificationHandler::DiscoveryStateChangedNotification(bool aState)
{ }
void
BluetoothNotificationHandler::PinRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod)
{ }
void
BluetoothNotificationHandler::SspRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod, BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
{ }
void
BluetoothNotificationHandler::BondStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothBondState aState)
{ }
void
BluetoothNotificationHandler::AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothAclState aState)
{ }
void
BluetoothNotificationHandler::DutModeRecvNotification(uint16_t aOpcode,
const uint8_t* aBuf,
uint8_t aLen)
{ }
void
BluetoothNotificationHandler::LeTestModeNotification(BluetoothStatus aStatus,
uint16_t aNumPackets)
{ }
void
BluetoothNotificationHandler::EnergyInfoNotification(
const BluetoothActivityEnergyInfo& aInfo)
{ }
void
BluetoothNotificationHandler::BackendErrorNotification(bool aCrashed)
{ }
@ -909,94 +1031,6 @@ void
BluetoothResultHandler::Cleanup()
{ }
void
BluetoothResultHandler::Enable()
{ }
void
BluetoothResultHandler::Disable()
{ }
void
BluetoothResultHandler::GetAdapterProperties()
{ }
void
BluetoothResultHandler::GetAdapterProperty()
{ }
void
BluetoothResultHandler::SetAdapterProperty()
{ }
void
BluetoothResultHandler::GetRemoteDeviceProperties()
{ }
void
BluetoothResultHandler::GetRemoteDeviceProperty()
{ }
void
BluetoothResultHandler::SetRemoteDeviceProperty()
{ }
void
BluetoothResultHandler::GetRemoteServiceRecord()
{ }
void
BluetoothResultHandler::GetRemoteServices()
{ }
void
BluetoothResultHandler::StartDiscovery()
{ }
void
BluetoothResultHandler::CancelDiscovery()
{ }
void
BluetoothResultHandler::CreateBond()
{ }
void
BluetoothResultHandler::RemoveBond()
{ }
void
BluetoothResultHandler::CancelBond()
{ }
void
BluetoothResultHandler::GetConnectionState()
{ }
void
BluetoothResultHandler::PinReply()
{ }
void
BluetoothResultHandler::SspReply()
{ }
void
BluetoothResultHandler::DutModeConfigure()
{ }
void
BluetoothResultHandler::DutModeSend()
{ }
void
BluetoothResultHandler::LeTestMode()
{ }
void
BluetoothResultHandler::ReadEnergyInfo()
{ }
// Interface
//

View File

@ -49,6 +49,188 @@ protected:
virtual ~BluetoothSetupInterface();
};
//
// Bluetooth Core Interface
//
class BluetoothCoreNotificationHandler
{
public:
virtual void AdapterStateChangedNotification(bool aState);
virtual void AdapterPropertiesNotification(
BluetoothStatus aStatus, int aNumProperties,
const BluetoothProperty* aProperties);
virtual void RemoteDevicePropertiesNotification(
BluetoothStatus aStatus, const BluetoothAddress& aBdAddr,
int aNumProperties, const BluetoothProperty* aProperties);
virtual void DeviceFoundNotification(
int aNumProperties, const BluetoothProperty* aProperties);
virtual void DiscoveryStateChangedNotification(bool aState);
virtual void PinRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const BluetoothRemoteName& aBdName,
uint32_t aCod);
virtual void SspRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const BluetoothRemoteName& aBdName,
uint32_t aCod,
BluetoothSspVariant aPairingVariant,
uint32_t aPassKey);
virtual void BondStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothBondState aState);
virtual void AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothAclState aState);
virtual void DutModeRecvNotification(uint16_t aOpcode,
const uint8_t* aBuf, uint8_t aLen);
virtual void LeTestModeNotification(BluetoothStatus aStatus,
uint16_t aNumPackets);
virtual void EnergyInfoNotification(const BluetoothActivityEnergyInfo& aInfo);
protected:
BluetoothCoreNotificationHandler();
virtual ~BluetoothCoreNotificationHandler();
};
class BluetoothCoreResultHandler
: public mozilla::ipc::DaemonSocketResultHandler
{
public:
virtual void OnError(BluetoothStatus aStatus);
virtual void Enable();
virtual void Disable();
virtual void GetAdapterProperties();
virtual void GetAdapterProperty();
virtual void SetAdapterProperty();
virtual void GetRemoteDeviceProperties();
virtual void GetRemoteDeviceProperty();
virtual void SetRemoteDeviceProperty();
virtual void GetRemoteServiceRecord();
virtual void GetRemoteServices();
virtual void StartDiscovery();
virtual void CancelDiscovery();
virtual void CreateBond();
virtual void RemoveBond();
virtual void CancelBond();
virtual void GetConnectionState();
virtual void PinReply();
virtual void SspReply();
virtual void DutModeConfigure();
virtual void DutModeSend();
virtual void LeTestMode();
virtual void ReadEnergyInfo();
protected:
virtual ~BluetoothCoreResultHandler() { }
};
class BluetoothCoreInterface
{
public:
virtual void SetNotificationHandler(
BluetoothCoreNotificationHandler* aNotificationHandler) = 0;
/* Enable/Disable */
virtual void Enable(BluetoothCoreResultHandler* aRes) = 0;
virtual void Disable(BluetoothCoreResultHandler* aRes) = 0;
/* Adapter Properties */
virtual void GetAdapterProperties(BluetoothCoreResultHandler* aRes) = 0;
virtual void GetAdapterProperty(BluetoothPropertyType,
BluetoothCoreResultHandler* aRes) = 0;
virtual void SetAdapterProperty(const BluetoothProperty& aProperty,
BluetoothCoreResultHandler* aRes) = 0;
/* Remote Device Properties */
virtual void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr,
BluetoothCoreResultHandler* aRes) = 0;
virtual void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
BluetoothPropertyType aType,
BluetoothCoreResultHandler* aRes) = 0;
virtual void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const BluetoothProperty& aProperty,
BluetoothCoreResultHandler* aRes) = 0;
/* Remote Services */
virtual void GetRemoteServiceRecord(const BluetoothAddress& aRemoteAddr,
const BluetoothUuid& aUuid,
BluetoothCoreResultHandler* aRes) = 0;
virtual void GetRemoteServices(const BluetoothAddress& aRemoteAddr,
BluetoothCoreResultHandler* aRes) = 0;
/* Discovery */
virtual void StartDiscovery(BluetoothCoreResultHandler* aRes) = 0;
virtual void CancelDiscovery(BluetoothCoreResultHandler* aRes) = 0;
/* Bonds */
virtual void CreateBond(const BluetoothAddress& aBdAddr,
BluetoothTransport aTransport,
BluetoothCoreResultHandler* aRes) = 0;
virtual void RemoveBond(const BluetoothAddress& aBdAddr,
BluetoothCoreResultHandler* aRes) = 0;
virtual void CancelBond(const BluetoothAddress& aBdAddr,
BluetoothCoreResultHandler* aRes) = 0;
/* Connection */
virtual void GetConnectionState(const BluetoothAddress& aBdAddr,
BluetoothCoreResultHandler* aRes) = 0;
/* Authentication */
virtual void PinReply(const BluetoothAddress& aBdAddr, bool aAccept,
const BluetoothPinCode& aPinCode,
BluetoothCoreResultHandler* aRes) = 0;
virtual void SspReply(const BluetoothAddress& aBdAddr,
BluetoothSspVariant aVariant,
bool aAccept, uint32_t aPasskey,
BluetoothCoreResultHandler* aRes) = 0;
/* DUT Mode */
virtual void DutModeConfigure(bool aEnable,
BluetoothCoreResultHandler* aRes) = 0;
virtual void DutModeSend(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
BluetoothCoreResultHandler* aRes) = 0;
/* LE Mode */
virtual void LeTestMode(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
BluetoothCoreResultHandler* aRes) = 0;
/* Energy Info */
virtual void ReadEnergyInfo(BluetoothCoreResultHandler* aRes) = 0;
protected:
BluetoothCoreInterface();
virtual ~BluetoothCoreInterface();
};
//
// Socket Interface
//
@ -931,49 +1113,12 @@ protected:
};
//
// Bluetooth Core Interface
// Bluetooth Interface
//
class BluetoothNotificationHandler
{
public:
virtual void AdapterStateChangedNotification(bool aState);
virtual void AdapterPropertiesNotification(
BluetoothStatus aStatus, int aNumProperties,
const BluetoothProperty* aProperties);
virtual void RemoteDevicePropertiesNotification(
BluetoothStatus aStatus, const BluetoothAddress& aBdAddr,
int aNumProperties, const BluetoothProperty* aProperties);
virtual void DeviceFoundNotification(
int aNumProperties, const BluetoothProperty* aProperties);
virtual void DiscoveryStateChangedNotification(bool aState);
virtual void PinRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const BluetoothRemoteName& aBdName,
uint32_t aCod);
virtual void SspRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const BluetoothRemoteName& aBdName,
uint32_t aCod,
BluetoothSspVariant aPairingVariant,
uint32_t aPassKey);
virtual void BondStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothBondState aState);
virtual void AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothAclState aState);
virtual void DutModeRecvNotification(uint16_t aOpcode,
const uint8_t* aBuf, uint8_t aLen);
virtual void LeTestModeNotification(BluetoothStatus aStatus,
uint16_t aNumPackets);
virtual void EnergyInfoNotification(const BluetoothActivityEnergyInfo& aInfo);
virtual void BackendErrorNotification(bool aCrashed);
protected:
@ -989,38 +1134,6 @@ public:
virtual void Init();
virtual void Cleanup();
virtual void Enable();
virtual void Disable();
virtual void GetAdapterProperties();
virtual void GetAdapterProperty();
virtual void SetAdapterProperty();
virtual void GetRemoteDeviceProperties();
virtual void GetRemoteDeviceProperty();
virtual void SetRemoteDeviceProperty();
virtual void GetRemoteServiceRecord();
virtual void GetRemoteServices();
virtual void StartDiscovery();
virtual void CancelDiscovery();
virtual void CreateBond();
virtual void RemoveBond();
virtual void CancelBond();
virtual void GetConnectionState();
virtual void PinReply();
virtual void SspReply();
virtual void DutModeConfigure();
virtual void DutModeSend();
virtual void LeTestMode();
virtual void ReadEnergyInfo();
protected:
virtual ~BluetoothResultHandler() { }
@ -1035,86 +1148,10 @@ public:
BluetoothResultHandler* aRes) = 0;
virtual void Cleanup(BluetoothResultHandler* aRes) = 0;
virtual void Enable(BluetoothResultHandler* aRes) = 0;
virtual void Disable(BluetoothResultHandler* aRes) = 0;
/* Adapter Properties */
virtual void GetAdapterProperties(BluetoothResultHandler* aRes) = 0;
virtual void GetAdapterProperty(BluetoothPropertyType,
BluetoothResultHandler* aRes) = 0;
virtual void SetAdapterProperty(const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) = 0;
/* Remote Device Properties */
virtual void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes) = 0;
virtual void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
BluetoothPropertyType aType,
BluetoothResultHandler* aRes) = 0;
virtual void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) = 0;
/* Remote Services */
virtual void GetRemoteServiceRecord(const BluetoothAddress& aRemoteAddr,
const BluetoothUuid& aUuid,
BluetoothResultHandler* aRes) = 0;
virtual void GetRemoteServices(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes) = 0;
/* Discovery */
virtual void StartDiscovery(BluetoothResultHandler* aRes) = 0;
virtual void CancelDiscovery(BluetoothResultHandler* aRes) = 0;
/* Bonds */
virtual void CreateBond(const BluetoothAddress& aBdAddr,
BluetoothTransport aTransport,
BluetoothResultHandler* aRes) = 0;
virtual void RemoveBond(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes) = 0;
virtual void CancelBond(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes) = 0;
/* Connection */
virtual void GetConnectionState(const BluetoothAddress& aBdAddr,
BluetoothResultHandler* aRes) = 0;
/* Authentication */
virtual void PinReply(const BluetoothAddress& aBdAddr, bool aAccept,
const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes) = 0;
virtual void SspReply(const BluetoothAddress& aBdAddr,
BluetoothSspVariant aVariant,
bool aAccept, uint32_t aPasskey,
BluetoothResultHandler* aRes) = 0;
/* DUT Mode */
virtual void DutModeConfigure(bool aEnable,
BluetoothResultHandler* aRes) = 0;
virtual void DutModeSend(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
BluetoothResultHandler* aRes) = 0;
/* LE Mode */
virtual void LeTestMode(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
BluetoothResultHandler* aRes) = 0;
/* Energy Info */
virtual void ReadEnergyInfo(BluetoothResultHandler* aRes) = 0;
/* Profile Interfaces */
virtual BluetoothSetupInterface* GetBluetoothSetupInterface() = 0;
virtual BluetoothCoreInterface* GetBluetoothCoreInterface() = 0;
virtual BluetoothSocketInterface* GetBluetoothSocketInterface() = 0;
virtual BluetoothHandsfreeInterface* GetBluetoothHandsfreeInterface() = 0;
virtual BluetoothA2dpInterface* GetBluetoothA2dpInterface() = 0;

View File

@ -140,8 +140,7 @@ function setAndFireTechLostHandler() {
var tests = [
testNfcNotEnabledError,
// This testcase is temporarily removed due to Bug 1055959, will reopen when it is fixed
// testNfcBadSessionIdError
testNfcBadSessionIdError,
testNoErrorInTechMsg
];

View File

@ -405,7 +405,7 @@ if CONFIG['MOZ_ENABLE_D3D10_LAYER']:
DEFINES['MOZ_ENABLE_D3D10_LAYER'] = True
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
if CONFIG['ANDROID_VERSION'] > '17':
if CONFIG['ANDROID_VERSION'] >= '17':
includes = [
'frameworks/av/include/media/stagefright',
'frameworks/native/include/media/openmax',

View File

@ -18,16 +18,12 @@ import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.db.BrowserContract.Combined;
import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.db.SuggestedSites;
import org.mozilla.gecko.db.TabsAccessor;
import org.mozilla.gecko.distribution.Distribution;
import org.mozilla.gecko.favicons.Favicons;
import org.mozilla.gecko.favicons.LoadFaviconTask;
import org.mozilla.gecko.favicons.OnFaviconLoadedListener;
import org.mozilla.gecko.favicons.decoders.IconDirectoryEntry;
import org.mozilla.gecko.firstrun.FirstrunPane;
import org.mozilla.gecko.fxa.FirefoxAccounts;
import org.mozilla.gecko.fxa.FxAccountConstants;
import org.mozilla.gecko.fxa.activities.FxAccountWebFlowActivity;
import org.mozilla.gecko.gfx.DynamicToolbarAnimator;
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import org.mozilla.gecko.gfx.LayerView;
@ -86,7 +82,6 @@ import org.mozilla.gecko.widget.ButtonToast;
import org.mozilla.gecko.widget.ButtonToast.ToastListener;
import org.mozilla.gecko.widget.GeckoActionProvider;
import android.accounts.Account;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ContentResolver;
@ -109,8 +104,6 @@ import android.nfc.NfcEvent;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.support.annotation.NonNull;
import android.support.annotation.WorkerThread;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
@ -2833,9 +2826,12 @@ public class BrowserApp extends GeckoApp
// Action providers are available only ICS+.
if (Versions.feature14Plus) {
GeckoMenuItem share = (GeckoMenuItem) mMenu.findItem(R.id.share);
final GeckoMenuItem quickShare = (GeckoMenuItem) mMenu.findItem(R.id.quickshare);
GeckoActionProvider provider = GeckoActionProvider.getForType(GeckoActionProvider.DEFAULT_MIME_TYPE, this);
share.setActionProvider(provider);
quickShare.setActionProvider(provider);
}
return true;
@ -2930,7 +2926,7 @@ public class BrowserApp extends GeckoApp
final MenuItem back = aMenu.findItem(R.id.back);
final MenuItem forward = aMenu.findItem(R.id.forward);
final MenuItem share = aMenu.findItem(R.id.share);
final MenuItem sendToDevice = aMenu.findItem(R.id.send_to_device);
final MenuItem quickShare = aMenu.findItem(R.id.quickshare);
final MenuItem saveAsPDF = aMenu.findItem(R.id.save_as_pdf);
final MenuItem print = aMenu.findItem(R.id.print);
final MenuItem charEncoding = aMenu.findItem(R.id.char_encoding);
@ -2956,7 +2952,7 @@ public class BrowserApp extends GeckoApp
back.setEnabled(false);
forward.setEnabled(false);
share.setEnabled(false);
sendToDevice.setEnabled(false);
quickShare.setEnabled(false);
saveAsPDF.setEnabled(false);
print.setEnabled(false);
findInPage.setEnabled(false);
@ -3041,10 +3037,8 @@ public class BrowserApp extends GeckoApp
// Disable share menuitem for about:, chrome:, file:, and resource: URIs
final boolean shareVisible = RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_SHARE);
share.setVisible(shareVisible);
sendToDevice.setVisible(shareVisible);
final boolean shareEnabled = StringUtils.isShareableUrl(url) && shareVisible;
share.setEnabled(shareEnabled);
sendToDevice.setEnabled(shareEnabled);
MenuUtils.safeSetEnabled(aMenu, R.id.downloads, RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_DOWNLOADS));
// NOTE: Use MenuUtils.safeSetEnabled because some actions might
@ -3058,6 +3052,10 @@ public class BrowserApp extends GeckoApp
// Action providers are available only ICS+.
if (Versions.feature14Plus) {
quickShare.setVisible(shareVisible);
quickShare.setEnabled(shareEnabled);
// This provider also applies to the quick share menu item.
final GeckoActionProvider provider = ((GeckoMenuItem) share).getGeckoActionProvider();
if (provider != null) {
Intent shareIntent = provider.getIntent();
@ -3211,20 +3209,6 @@ public class BrowserApp extends GeckoApp
return true;
}
if (itemId == R.id.send_to_device) {
tab = Tabs.getInstance().getSelectedTab();
if (tab != null) {
final Tab selectedTab = tab;
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
public void run() {
handleSendToDevice(selectedTab);
}
});
}
return true;
}
if (itemId == R.id.share) {
tab = Tabs.getInstance().getSelectedTab();
if (tab != null) {
@ -3363,46 +3347,6 @@ public class BrowserApp extends GeckoApp
return super.onOptionsItemSelected(item);
}
/**
* Handles a press to the send to device button in the browser menu. The
* expected states when the user presses the button are:
* * Not signed in: open to FxA sign-up
* * Signed in but no other devices: display toast with a message
* explaining they should connect another device to use this feature
* * Signed in but >= 1 other device: display device list
*/
@WorkerThread
private void handleSendToDevice(@NonNull final Tab selectedTab) {
final Account account = FirefoxAccounts.getFirefoxAccount(this);
if (account == null) {
// TODO (bug 1217164): Go back to previous tab on back press
final Intent intent = new Intent(FxAccountConstants.ACTION_FXA_GET_STARTED);
intent.putExtra(FxAccountWebFlowActivity.EXTRA_ENDPOINT, FxAccountConstants.ENDPOINT_PREFERENCES);
startActivity(intent);
return;
}
final BrowserDB browserDB = GeckoProfile.get(this).getDB();
final TabsAccessor tabsAccessor = browserDB.getTabsAccessor();
final int remoteClientCount = tabsAccessor.getRemoteClientCount(this);
if (remoteClientCount == 0) {
final Toast toast = Toast.makeText(this, R.string.menu_no_synced_devices, Toast.LENGTH_LONG);
toast.show();
} else {
String url = selectedTab.getURL();
if (url != null) {
if (AboutPages.isAboutReader(url)) {
url = ReaderModeUtils.getUrlFromAboutReader(url);
}
final Intent sendToDeviceIntent = GeckoAppShell.getShareIntent(getContext(), url,
"text/plain", selectedTab.getDisplayTitle());
sendToDeviceIntent.setClass(getContext(), ShareDialog.class);
startActivity(sendToDeviceIntent);
}
}
}
@Override
public boolean onMenuItemLongClick(MenuItem item) {
if (item.getItemId() == R.id.reload) {

View File

@ -72,20 +72,6 @@ public class LocalTabsAccessor implements TabsAccessor {
clientsRecencyUriWithProfile = DBUtils.appendProfileWithDefault(profileName, BrowserContract.Clients.CONTENT_RECENCY_URI);
}
@Override
public int getRemoteClientCount(final Context context) {
final Cursor remoteClientsCursor = getRemoteClientsByRecencyCursor(context);
if (remoteClientsCursor == null) {
return 0;
}
try {
return remoteClientsCursor.getCount();
} finally {
remoteClientsCursor.close();
}
}
/**
* Extracts a List of just RemoteClients from a cursor.
* The supplied cursor should be grouped by guid and sorted by most recently used.

View File

@ -117,11 +117,6 @@ class StubTabsAccessor implements TabsAccessor {
public StubTabsAccessor() {
}
@Override
public int getRemoteClientCount(Context context) {
return 0;
}
@Override
public List<RemoteClient> getClientsWithoutTabsByRecencyFromCursor(Cursor cursor) {
return new ArrayList<>();

View File

@ -17,7 +17,6 @@ public interface TabsAccessor {
public void onQueryTabsComplete(List<RemoteClient> clients);
}
public int getRemoteClientCount(Context context);
public Cursor getRemoteClientsByRecencyCursor(Context context);
public Cursor getRemoteTabsCursor(Context context);
public Cursor getRemoteTabsCursor(Context context, int limit);

View File

@ -11,11 +11,15 @@ import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.util.SparseBooleanArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
@ -84,7 +88,33 @@ public class ImportPanel extends FirstrunPanel {
}
});
builder.create().show();
final AlertDialog dialog = builder.create();
dialog.show();
final Button importButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
final ListView listView = dialog.getListView();
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
if (AppConstants.Versions.feature11Plus) {
if (listView.getCheckedItemCount() == 0) {
importButton.setEnabled(false);
} else {
importButton.setEnabled(true);
}
} else {
final SparseBooleanArray checkedItems = listView.getCheckedItemPositions();
for (int j = 0; j < checkedItems.size(); j++) {
if (checkedItems.valueAt(j) == true) {
importButton.setEnabled(true);
return;
}
}
importButton.setEnabled(false);
}
}
});
}
});

View File

@ -142,12 +142,6 @@
are found. -->
<!ENTITY overlay_no_synced_devices "No Firefox Account connected devices found">
<!-- Localization note (menu_no_synced_devices): Used in a toast when the user
clicks on the button to send a tab to another device and there are no
other devices present. This label should briefly inform the user that they
need another connected device in order to use the feature. -->
<!ENTITY menu_no_synced_devices "Send this tab to another connected device">
<!ENTITY pref_category_search3 "Search">
<!ENTITY pref_category_search_summary "Customize your search providers">
<!ENTITY pref_category_accessibility "Accessibility">

View File

@ -101,8 +101,8 @@ public class GeckoMenu extends ListView
// Map of "ifRoom" action-items in action-bar and their views.
private final Map<GeckoMenuItem, View> mSecondaryActionItems;
// Map of "ifRoom|withText" action-items in action-bar and their views.
private final Map<GeckoMenuItem, View> mShareActionItems;
// Map of "collapseActionView" action-items in action-bar and their views.
private final Map<GeckoMenuItem, View> mQuickShareActionItems;
// Reference to a callback for menu events.
private Callback mCallback;
@ -116,8 +116,8 @@ public class GeckoMenu extends ListView
// Reference to "ifRoom" action-items bar in action-bar.
private final ActionItemBarPresenter mSecondaryActionItemBar;
// Reference to "ifRoom|withText" action-items bar in action-bar.
private final ActionItemBarPresenter mShareActionItemBar;
// Reference to "collapseActionView" action-items bar in action-bar.
private final ActionItemBarPresenter mQuickShareActionItemBar;
// Adapter to hold the list of menu items.
private final MenuItemsAdapter mAdapter;
@ -148,11 +148,11 @@ public class GeckoMenu extends ListView
mItemsById = new SparseArray<MenuItem>();
mPrimaryActionItems = new HashMap<GeckoMenuItem, View>();
mSecondaryActionItems = new HashMap<GeckoMenuItem, View>();
mShareActionItems = new HashMap<GeckoMenuItem, View>();
mQuickShareActionItems = new HashMap<GeckoMenuItem, View>();
mPrimaryActionItemBar = (DefaultActionItemBar) LayoutInflater.from(context).inflate(R.layout.menu_action_bar, null);
mSecondaryActionItemBar = (DefaultActionItemBar) LayoutInflater.from(context).inflate(R.layout.menu_secondary_action_bar, null);
mShareActionItemBar = (DefaultActionItemBar) LayoutInflater.from(context).inflate(R.layout.menu_secondary_action_bar, null);
mQuickShareActionItemBar = (DefaultActionItemBar) LayoutInflater.from(context).inflate(R.layout.menu_secondary_action_bar, null);
}
private static void assertOnUiThread() {
@ -227,17 +227,23 @@ public class GeckoMenu extends ListView
mSecondaryActionItems.put(menuItem, actionView);
mItems.add(menuItem);
}
} else if (actionEnum == GeckoMenuItem.SHOW_AS_ACTION_IF_ROOM_WITH_TEXT) {
if (added = mShareActionItemBar.addActionItem(actionView)) {
if (mShareActionItems.size() == 0) {
// Reset the adapter before adding the header view to a list.
setAdapter(null);
addHeaderView((DefaultActionItemBar) mShareActionItemBar);
setAdapter(mAdapter);
}
} else if (actionEnum == GeckoMenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW) {
if (actionView instanceof MenuItemActionView) {
final MenuItemActionView quickShareView = (MenuItemActionView) actionView;
mShareActionItems.put(menuItem, actionView);
mItems.add(menuItem);
// We don't want to add the quick share bar if we don't have any quick share items.
if (quickShareView.getActionButtonCount() > 0 &&
(added = mQuickShareActionItemBar.addActionItem(quickShareView))) {
if (mQuickShareActionItems.size() == 0) {
// Reset the adapter before adding the header view to a list.
setAdapter(null);
addHeaderView((DefaultActionItemBar) mQuickShareActionItemBar);
setAdapter(mAdapter);
}
mQuickShareActionItems.put(menuItem, quickShareView);
mItems.add(menuItem);
}
}
}
@ -259,14 +265,14 @@ public class GeckoMenu extends ListView
return false;
}
});
} else if (actionView instanceof MenuItemSwitcherLayout) {
((MenuItemSwitcherLayout) actionView).setMenuItemClickListener(new View.OnClickListener() {
} else if (actionView instanceof MenuItemActionView) {
((MenuItemActionView) actionView).setMenuItemClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
handleMenuItemClick(menuItem);
}
});
((MenuItemSwitcherLayout) actionView).setMenuItemLongClickListener(new View.OnLongClickListener() {
((MenuItemActionView) actionView).setMenuItemLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
if (handleMenuItemLongClick(menuItem)) {
@ -333,10 +339,10 @@ public class GeckoMenu extends ListView
setAdapter(mAdapter);
}
private void removeShareActionBarView() {
private void removeQuickShareActionBarView() {
// Reset the adapter before removing the header view from a list.
setAdapter(null);
removeHeaderView((DefaultActionItemBar) mShareActionItemBar);
removeHeaderView((DefaultActionItemBar) mQuickShareActionItemBar);
setAdapter(mAdapter);
}
@ -379,12 +385,12 @@ public class GeckoMenu extends ListView
}
mSecondaryActionItems.clear();
if (mShareActionItemBar != null) {
for (View item : mShareActionItems.values()) {
mShareActionItemBar.removeActionItem(item);
if (mQuickShareActionItemBar != null) {
for (View item : mQuickShareActionItems.values()) {
mQuickShareActionItemBar.removeActionItem(item);
}
}
mShareActionItems.clear();
mQuickShareActionItems.clear();
// Remove the view, too -- the first addActionItem will re-add it,
// and this is simpler than changing that logic.
@ -393,7 +399,7 @@ public class GeckoMenu extends ListView
}
removeSecondaryActionBarView();
removeShareActionBarView();
removeQuickShareActionBarView();
}
@Override
@ -448,7 +454,7 @@ public class GeckoMenu extends ListView
if (menuItem.isVisible() &&
!mPrimaryActionItems.containsKey(menuItem) &&
!mSecondaryActionItems.containsKey(menuItem) &&
!mShareActionItems.containsKey(menuItem))
!mQuickShareActionItems.containsKey(menuItem))
return true;
}
@ -525,15 +531,15 @@ public class GeckoMenu extends ListView
return;
}
if (mShareActionItems.containsKey(item)) {
if (mShareActionItemBar != null)
mShareActionItemBar.removeActionItem(mShareActionItems.get(item));
if (mQuickShareActionItems.containsKey(item)) {
if (mQuickShareActionItemBar != null)
mQuickShareActionItemBar.removeActionItem(mQuickShareActionItems.get(item));
mShareActionItems.remove(item);
mQuickShareActionItems.remove(item);
mItems.remove(item);
if (mShareActionItems.size() == 0) {
removeShareActionBarView();
if (mQuickShareActionItems.size() == 0) {
removeQuickShareActionBarView();
}
return;
@ -568,7 +574,7 @@ public class GeckoMenu extends ListView
public boolean hasActionItemBar() {
return (mPrimaryActionItemBar != null) &&
(mSecondaryActionItemBar != null) &&
(mShareActionItemBar != null);
(mQuickShareActionItemBar != null);
}
@Override
@ -592,7 +598,7 @@ public class GeckoMenu extends ListView
} else if (actionEnum == GeckoMenuItem.SHOW_AS_ACTION_IF_ROOM) {
actionView = mSecondaryActionItems.get(item);
} else {
actionView = mShareActionItems.get(item);
actionView = mQuickShareActionItems.get(item);
}
if (actionView != null) {
@ -601,7 +607,7 @@ public class GeckoMenu extends ListView
if (actionView instanceof MenuItemActionBar) {
((MenuItemActionBar) actionView).initialize(item);
} else {
((MenuItemSwitcherLayout) actionView).initialize(item);
((MenuItemActionView) actionView).initialize(item);
}
} else {
actionView.setVisibility(View.GONE);
@ -732,8 +738,8 @@ public class GeckoMenu extends ListView
params = new LinearLayout.LayoutParams(0, mRowHeight);
}
if (actionItem instanceof MenuItemSwitcherLayout) {
params.weight = ((MenuItemSwitcherLayout) actionItem).getChildCount();
if (actionItem instanceof MenuItemActionView) {
params.weight = ((MenuItemActionView) actionItem).getChildCount();
} else {
params.weight = 1.0f;
}
@ -812,17 +818,17 @@ public class GeckoMenu extends ListView
view = (GeckoMenuItem.Layout) convertView;
}
if (view == null || view instanceof MenuItemSwitcherLayout) {
if (view == null || view instanceof MenuItemActionView) {
// Always get from the menu item.
// This will ensure that the default activity is refreshed.
view = (MenuItemSwitcherLayout) item.getActionView();
view = (MenuItemActionView) item.getActionView();
// ListView will not perform an item click if the row has a focusable view in it.
// Hence, forward the click event on the menu item in the action-view to the ListView.
final View actionView = (View) view;
final int pos = position;
final long id = getItemId(position);
((MenuItemSwitcherLayout) view).setMenuItemClickListener(new View.OnClickListener() {
((MenuItemActionView) view).setMenuItemClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GeckoMenu listView = GeckoMenu.this;

View File

@ -18,11 +18,15 @@ import android.view.SubMenu;
import android.view.View;
public class GeckoMenuItem implements MenuItem {
private static final int SECONDARY_ACTION_BAR_HISTORY_SIZE = 0;
private static final int QUICK_SHARE_ACTION_BAR_HISTORY_SIZE = 3;
// These values mirror MenuItem values that are only available on API >= 11.
public static final int SHOW_AS_ACTION_NEVER = 0;
public static final int SHOW_AS_ACTION_IF_ROOM = 1;
public static final int SHOW_AS_ACTION_ALWAYS = 2;
public static final int SHOW_AS_ACTION_IF_ROOM_WITH_TEXT = 5;
public static final int SHOW_AS_ACTION_WITH_TEXT = 4;
public static final int SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW = 8;
// A View that can show a MenuItem should be able to initialize from
// the properties of the MenuItem.
@ -136,7 +140,13 @@ public class GeckoMenuItem implements MenuItem {
@Override
public View getActionView() {
if (mActionProvider != null) {
return mActionProvider.onCreateActionView(GeckoActionProvider.ActionViewType.DEFAULT);
if (getActionEnum() == MenuItem.SHOW_AS_ACTION_IF_ROOM) {
return mActionProvider.onCreateActionView(SECONDARY_ACTION_BAR_HISTORY_SIZE,
GeckoActionProvider.ActionViewType.DEFAULT);
} else {
return mActionProvider.onCreateActionView(QUICK_SHARE_ACTION_BAR_HISTORY_SIZE,
GeckoActionProvider.ActionViewType.QUICK_SHARE_ICON);
}
}
return mActionView;

View File

@ -20,34 +20,27 @@ import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
/**
* This class is a container view for menu items that:
* * Shows text if there is enough space and there are
* no action buttons ({@link #mActionButtons}).
* * Shows an icon if there is not enough space for text,
* or there are action buttons.
*/
public class MenuItemSwitcherLayout extends LinearLayout
implements GeckoMenuItem.Layout,
View.OnClickListener {
public class MenuItemActionView extends LinearLayout
implements GeckoMenuItem.Layout,
View.OnClickListener {
private final MenuItemDefault mMenuItem;
private final MenuItemActionBar mMenuButton;
private final List<ImageButton> mActionButtons;
private final List<View.OnClickListener> mActionButtonListeners = new ArrayList<View.OnClickListener>();
public MenuItemSwitcherLayout(Context context) {
public MenuItemActionView(Context context) {
this(context, null);
}
public MenuItemSwitcherLayout(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.menuItemSwitcherLayoutStyle);
public MenuItemActionView(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.menuItemActionViewStyle);
}
@TargetApi(14)
public MenuItemSwitcherLayout(Context context, AttributeSet attrs, int defStyle) {
public MenuItemActionView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.menu_item_switcher_layout, this);
LayoutInflater.from(context).inflate(R.layout.menu_item_action_view, this);
mMenuItem = (MenuItemDefault) findViewById(R.id.menu_item);
mMenuButton = (MenuItemActionBar) findViewById(R.id.menu_item_button);
mActionButtons = new ArrayList<ImageButton>();
@ -177,7 +170,7 @@ public class MenuItemSwitcherLayout extends LinearLayout
* Update the styles if this view is being used in the context menus.
*
* Ideally, we just use different layout files and styles to set this, but
* MenuItemSwitcherLayout is too integrated into GeckoActionProvider to provide
* MenuItemActionView is too integrated into GeckoActionProvider to provide
* an easy separation so instead I provide this hack. I'm sorry.
*/
public void initContextMenuStyles() {

View File

@ -0,0 +1,36 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.menu;
import android.annotation.TargetApi;
import android.content.Context;
import android.util.AttributeSet;
import org.mozilla.gecko.R;
/**
* A MenuItemActionView without the default child views.
*
* A better implementation would have the non-child view implementation as the parent of
* MenuItemActionView, but this is simpler and faster to implement for something intended to be
* uplifted, and this implementation will soon be replaced with the old implementation for adding
* the share plane to the menu (see https://bug1122302.bugzilla.mozilla.org/attachment.cgi?id=8572126).
*/
public class QuickShareBarActionView extends MenuItemActionView {
public QuickShareBarActionView(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.menuItemActionViewStyle);
}
@TargetApi(14)
public QuickShareBarActionView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// We remove the views so they are visible, but note that
// the child still does some computation on them.
removeAllViews();
}
}

View File

@ -424,10 +424,11 @@ gbjar.sources += [
'menu/GeckoMenuItem.java',
'menu/GeckoSubMenu.java',
'menu/MenuItemActionBar.java',
'menu/MenuItemActionView.java',
'menu/MenuItemDefault.java',
'menu/MenuItemSwitcherLayout.java',
'menu/MenuPanel.java',
'menu/MenuPopup.java',
'menu/QuickShareBarActionView.java',
'MotionEventInterceptor.java',
'NotificationClient.java',
'NotificationHandler.java',

View File

@ -104,7 +104,7 @@ public class SendTabDeviceListArrayAdapter extends ArrayAdapter<RemoteClient> {
if (currentState != State.LIST) {
// If we're in a special "Button-like" state, use the override string and a generic icon.
final Drawable sendTabIcon = context.getResources().getDrawable(R.drawable.shareplane);
final Drawable sendTabIcon = context.getResources().getDrawable(R.drawable.overlay_send_tab_icon);
row.setText(dummyRecordName);
row.setDrawable(sendTabIcon);
}

View File

@ -1,11 +1,17 @@
package org.mozilla.gecko.prompts;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.menu.MenuItemSwitcherLayout;
import org.mozilla.gecko.gfx.BitmapUtils;
import org.mozilla.gecko.menu.MenuItemActionView;
import org.mozilla.gecko.widget.GeckoActionProvider;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONException;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@ -19,6 +25,7 @@ import android.widget.CheckedTextView;
import android.widget.TextView;
import android.widget.ListView;
import android.widget.ArrayAdapter;
import android.widget.AdapterView;
import android.util.TypedValue;
import java.util.ArrayList;
@ -172,7 +179,7 @@ public class PromptListAdapter extends ArrayAdapter<PromptListItem> {
final GeckoActionProvider provider = GeckoActionProvider.getForType(item.getIntent().getType(), getContext());
provider.setIntent(item.getIntent());
final MenuItemSwitcherLayout view = (MenuItemSwitcherLayout) provider.onCreateActionView(
final MenuItemActionView view = (MenuItemActionView) provider.onCreateActionView(
GeckoActionProvider.ActionViewType.CONTEXT_MENU);
// If a quickshare button is clicked, we need to close the dialog.
view.addActionButtonClickListener(new View.OnClickListener() {
@ -188,7 +195,7 @@ public class PromptListAdapter extends ArrayAdapter<PromptListItem> {
return view;
}
private void updateActionView(final PromptListItem item, final MenuItemSwitcherLayout view, final ListView list, final int position) {
private void updateActionView(final PromptListItem item, final MenuItemActionView view, final ListView list, final int position) {
view.setTitle(item.label);
view.setIcon(item.getIcon());
view.setSubMenuIndicator(item.isParent);
@ -253,7 +260,7 @@ public class PromptListAdapter extends ArrayAdapter<PromptListItem> {
}
if (type == VIEW_TYPE_ACTIONS) {
updateActionView(item, (MenuItemSwitcherLayout) convertView, (ListView) parent, position);
updateActionView(item, (MenuItemActionView) convertView, (ListView) parent, position);
} else {
viewHolder.textView.setText(item.label);
maybeUpdateCheckedState((ListView) parent, position, item, viewHolder);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 947 B

After

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!-- It's difficult to set the menu item height because the code overrides
itself dynamically (bug xxx) so instead we add padding here. -->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetTop="2dp"
android:insetBottom="2dp"
android:insetLeft="2dp"
android:insetRight="2dp"
android:drawable="@drawable/shareplane"
/>

View File

@ -34,15 +34,19 @@
android:title="@string/overlay_share_reading_list_btn_label"
android:showAsAction="ifRoom"/>
<item android:id="@+id/send_to_device"
android:icon="@drawable/overlay_send_tab_icon_menu"
android:title="@string/overlay_share_send_other"
android:showAsAction="ifRoom"/>
<item android:id="@+id/share"
android:icon="@drawable/ic_menu_share"
android:title="@string/share"
android:showAsAction="ifRoom|withText"/>
android:showAsAction="ifRoom"/>
<!-- We only show the quick share items so no need for an icon or title.
The visibility is changed dynamically for v14+ - hide for previous versions. -->
<item android:id="@+id/quickshare"
android:visible="false"
android:enabled="false"
android:visibility="gone"
android:showAsAction="collapseActionView"/>
<item android:id="@+id/new_tab"
android:title="@string/new_tab"/>

View File

@ -34,15 +34,19 @@
android:title="@string/overlay_share_reading_list_btn_label"
android:showAsAction="ifRoom"/>
<item android:id="@+id/send_to_device"
android:icon="@drawable/overlay_send_tab_icon_menu"
android:title="@string/overlay_share_send_other"
android:showAsAction="ifRoom"/>
<item android:id="@+id/share"
android:icon="@drawable/ic_menu_share"
android:title="@string/share"
android:showAsAction="ifRoom|withText"/>
android:showAsAction="ifRoom"/>
<!-- We only show the quick share items so no need for an icon or title.
The visibility is changed dynamically for v14+ - hide for previous versions. -->
<item android:id="@+id/quickshare"
android:visible="false"
android:enabled="false"
android:visibility="gone"
android:showAsAction="collapseActionView"/>
<item android:id="@+id/new_tab"
android:title="@string/new_tab"/>

View File

@ -34,15 +34,19 @@
android:title="@string/overlay_share_reading_list_btn_label"
android:showAsAction="ifRoom"/>
<item android:id="@+id/send_to_device"
android:icon="@drawable/overlay_send_tab_icon_menu"
android:title="@string/overlay_share_send_other"
android:showAsAction="ifRoom"/>
<item android:id="@+id/share"
android:icon="@drawable/ic_menu_share"
android:title="@string/share"
android:showAsAction="ifRoom|withText"/>
android:showAsAction="ifRoom"/>
<!-- We only show the quick share items so no need for an icon or title.
The visibility is changed dynamically for v14+ - hide for previous versions. -->
<item android:id="@+id/quickshare"
android:visible="false"
android:enabled="false"
android:visibility="gone"
android:showAsAction="collapseActionView"/>
<item android:id="@+id/new_tab"
android:title="@string/new_tab"/>

View File

@ -30,9 +30,6 @@
android:icon="@drawable/ic_menu_new_private_tab"
android:title="@string/new_private_tab"/>
<item android:id="@+id/send_to_device"
android:title="@string/overlay_share_send_other"/>
<item android:id="@+id/share"
android:title="@string/share" />
@ -80,6 +77,16 @@
android:visible="false"
android:title="@string/exit_guest_session"/>
<!-- Android will eliminate v11+ resource files from pre-11 builds.
Those files are the only place in which certain IDs are defined.
This causes compilation errors.
To avoid nasty code workarounds, we define stub IDs here, but
hide the menu entries. -->
<item android:id="@+id/quickshare"
android:visible="false"
android:enabled="false" />
<item android:id="@+id/page"
android:visible="false"
android:enabled="false"

View File

@ -44,7 +44,7 @@
<item name="android:panelBackground">@drawable/menu_panel_bg</item>
<item name="android:spinnerDropDownItemStyle">@style/Widget.DropDownItem.Spinner</item>
<item name="android:spinnerItemStyle">@style/Widget.TextView.SpinnerItem</item>
<item name="menuItemSwitcherLayoutStyle">@style/Widget.MenuItemSwitcherLayout</item>
<item name="menuItemActionViewStyle">@style/Widget.MenuItemActionView</item>
<item name="menuItemDefaultStyle">@style/Widget.MenuItemDefault</item>
<item name="menuItemSecondaryActionBarStyle">@style/Widget.MenuItemSecondaryActionBar</item>
<item name="tabGridLayoutViewStyle">@style/Widget.TabsGridLayout</item>

View File

@ -20,7 +20,7 @@
<item name="android:panelBackground">@drawable/menu_panel_bg</item>
<item name="android:spinnerDropDownItemStyle">@style/Widget.DropDownItem.Spinner</item>
<item name="android:spinnerItemStyle">@style/Widget.TextView.SpinnerItem</item>
<item name="menuItemSwitcherLayoutStyle">@style/Widget.MenuItemSwitcherLayout</item>
<item name="menuItemActionViewStyle">@style/Widget.MenuItemActionView</item>
<item name="menuItemDefaultStyle">@style/Widget.MenuItemDefault</item>
<item name="menuItemSecondaryActionBarStyle">@style/Widget.MenuItemSecondaryActionBar</item>
</style>

View File

@ -40,7 +40,7 @@
<item name="android:panelBackground">@drawable/menu_panel_bg</item>
<item name="android:spinnerDropDownItemStyle">@style/Widget.DropDownItem.Spinner</item>
<item name="android:spinnerItemStyle">@style/Widget.TextView.SpinnerItem</item>
<item name="menuItemSwitcherLayoutStyle">@style/Widget.MenuItemSwitcherLayout</item>
<item name="menuItemActionViewStyle">@style/Widget.MenuItemActionView</item>
<item name="menuItemDefaultStyle">@style/Widget.MenuItemDefault</item>
<item name="menuItemSecondaryActionBarStyle">@style/Widget.MenuItemSecondaryActionBar</item>
<item name="tabGridLayoutViewStyle">@style/Widget.TabsGridLayout</item>

View File

@ -16,8 +16,8 @@
<!-- Style for MenuItemActionBar -->
<attr name="menuItemActionModeStyle" format="reference"/>
<!-- Style for MenuItemSwitcherLayout -->
<attr name="menuItemSwitcherLayoutStyle" format="reference"/>
<!-- Style for MenuItemActionView -->
<attr name="menuItemActionViewStyle" format="reference"/>
<!-- Style for MenuItemDefault -->
<attr name="menuItemDefaultStyle" format="reference"/>
@ -25,7 +25,7 @@
<!-- Style for MenuItemActionBar when shown in SecondaryActionBar -->
<attr name="menuItemSecondaryActionBarStyle" format="reference"/>
<!-- Style for MenuItemSwitcherLayout's ShareActionButton -->
<!-- Style for MenuItemActionView's ShareActionButton -->
<attr name="menuItemShareActionButtonStyle" format="reference"/>
<!-- Default style for the BookmarksListView -->

View File

@ -99,7 +99,7 @@
<item name="drawableTintList">@color/action_bar_secondary_menu_item_colors</item>
</style>
<style name="Widget.MenuItemSwitcherLayout">
<style name="Widget.MenuItemActionView">
<item name="android:gravity">left</item>
</style>

View File

@ -136,7 +136,6 @@
<string name="overlay_share_no_url">&overlay_share_no_url;</string>
<string name="overlay_share_select_device">&overlay_share_select_device;</string>
<string name="overlay_no_synced_devices">&overlay_no_synced_devices;</string>
<string name="menu_no_synced_devices">&menu_no_synced_devices;</string>
<string name="settings">&settings;</string>
<string name="settings_title">&settings_title;</string>

View File

@ -771,11 +771,23 @@ public class ActivityChooserModel extends DataSetObservable {
ResolveInfo resolveInfo = resolveInfos.get(i);
/**
* Mozilla: Do not display "Add to Firefox" from share menu.
* Mozilla: We want "Add to Firefox" to appear differently inside of Firefox than
* from external applications - override the name and icon here.
*
* Do not display the menu item if there are no devices to share to.
*
* Note: we check both the class name and the label to ensure we only change the
* label of the current channel.
*/
if (shareDialogClassName.equals(resolveInfo.activityInfo.name) &&
channelToRemoveLabel.equals(resolveInfo.loadLabel(packageManager))) {
continue;
// Don't add the menu item if there are no devices to share to.
if (!hasOtherSyncClients()) {
continue;
}
resolveInfo.labelRes = R.string.overlay_share_send_other;
resolveInfo.icon = R.drawable.icon_shareplane;
}
mActivities.add(new ActivityResolveInfo(resolveInfo));
@ -1292,6 +1304,32 @@ public class ActivityChooserModel extends DataSetObservable {
}
}
/**
* Mozilla: Return whether or not there are other synced clients.
*/
private boolean hasOtherSyncClients() {
// ClientsDatabaseAccessor returns stale data (bug 1145896) so we work around this by
// checking if we have accounts set up - if not, we can't have any clients.
if (!FirefoxAccounts.firefoxAccountsExist(mContext) &&
!SyncAccounts.syncAccountsExist(mContext)) {
return false;
}
final BrowserDB browserDB = GeckoProfile.get(mContext).getDB();
final TabsAccessor tabsAccessor = browserDB.getTabsAccessor();
final Cursor remoteClientsCursor = tabsAccessor
.getRemoteClientsByRecencyCursor(mContext);
if (remoteClientsCursor == null) {
return false;
}
try {
return remoteClientsCursor.getCount() > 0;
} finally {
remoteClientsCursor.close();
}
}
/**
* Mozilla: Reload activities on sync.
*/

View File

@ -10,7 +10,9 @@ import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.menu.MenuItemSwitcherLayout;
import org.mozilla.gecko.menu.MenuItemActionView;
import org.mozilla.gecko.menu.QuickShareBarActionView;
import org.mozilla.gecko.overlays.ui.ShareDialog;
import org.mozilla.gecko.util.ThreadUtils;
import android.content.Context;
@ -89,16 +91,24 @@ public class GeckoActionProvider {
* Creates the action view using the default history size.
*/
public View onCreateActionView(final ActionViewType viewType) {
return onCreateActionView(MAX_HISTORY_SIZE_DEFAULT, viewType);
}
public View onCreateActionView(final int maxHistorySize, final ActionViewType viewType) {
// Create the view and set its data model.
ActivityChooserModel dataModel = ActivityChooserModel.get(mContext, mHistoryFileName);
final MenuItemSwitcherLayout view;
final MenuItemActionView view;
switch (viewType) {
case DEFAULT:
view = new MenuItemSwitcherLayout(mContext, null);
view = new MenuItemActionView(mContext, null);
break;
case QUICK_SHARE_ICON:
view = new QuickShareBarActionView(mContext, null);
break;
case CONTEXT_MENU:
view = new MenuItemSwitcherLayout(mContext, null);
view = new MenuItemActionView(mContext, null);
view.initContextMenuStyles();
break;
@ -110,8 +120,8 @@ public class GeckoActionProvider {
final PackageManager packageManager = mContext.getPackageManager();
int historySize = dataModel.getDistinctActivityCountInHistory();
if (historySize > MAX_HISTORY_SIZE_DEFAULT) {
historySize = MAX_HISTORY_SIZE_DEFAULT;
if (historySize > maxHistorySize) {
historySize = maxHistorySize;
}
// Historical data is dependent on past selection of activities.
@ -142,6 +152,8 @@ public class GeckoActionProvider {
PackageManager packageManager = mContext.getPackageManager();
// Populate the sub-menu with a sub set of the activities.
final String shareDialogClassName = ShareDialog.class.getCanonicalName();
final String sendTabLabel = mContext.getResources().getString(R.string.overlay_share_send_other);
final int count = dataModel.getActivityCount();
for (int i = 0; i < count; i++) {
ResolveInfo activity = dataModel.getActivity(i);
@ -149,7 +161,13 @@ public class GeckoActionProvider {
// Pin internal actions to the top. Note:
// the order here does not affect quick share.
final int order = Menu.FIRST + (i | Menu.CATEGORY_SECONDARY);
final int order;
if (shareDialogClassName.equals(activity.activityInfo.name) &&
sendTabLabel.equals(activityLabel)) {
order = Menu.FIRST + i;
} else {
order = Menu.FIRST + (i | Menu.CATEGORY_SECONDARY);
}
subMenu.add(0, i, order, activityLabel)
.setIcon(activity.loadIcon(packageManager))
@ -249,6 +267,7 @@ public class GeckoActionProvider {
public enum ActionViewType {
DEFAULT,
QUICK_SHARE_ICON,
CONTEXT_MENU,
}
}

View File

@ -1477,6 +1477,8 @@ var Impl = {
/**
* Save both the "saved-session" and the "shutdown" pings to disk.
* This needs to be called after TelemetrySend shuts down otherwise pings
* would be sent instead of getting persisted to disk.
*/
saveShutdownPings: function() {
this._log.trace("saveShutdownPings");
@ -1492,9 +1494,8 @@ var Impl = {
let options = {
addClientId: true,
addEnvironment: true,
overwrite: true,
};
p.push(TelemetryController.addPendingPing(getPingType(shutdownPayload), shutdownPayload, options)
p.push(TelemetryController.submitExternalPing(getPingType(shutdownPayload), shutdownPayload, options)
.catch(e => this._log.error("saveShutdownPings - failed to submit shutdown ping", e)));
}
@ -1507,7 +1508,7 @@ var Impl = {
addClientId: true,
addEnvironment: true,
};
p.push(TelemetryController.addPendingPing(getPingType(payload), payload, options)
p.push(TelemetryController.submitExternalPing(getPingType(payload), payload, options)
.catch (e => this._log.error("saveShutdownPings - failed to submit saved-session ping", e)));
}

View File

@ -918,7 +918,8 @@ add_task(function* test_dailyDuplication() {
return;
}
clearPendingPings();
yield TelemetrySend.reset();
yield clearPendingPings();
PingServer.clearRequests();
let schedulerTickCallback = null;
@ -961,8 +962,8 @@ add_task(function* test_dailyDuplication() {
yield schedulerTickCallback();
// Shutdown to cleanup the aborted-session if it gets created.
yield TelemetrySession.shutdown();
PingServer.resetPingHandler();
yield TelemetrySession.shutdown();
});
add_task(function* test_dailyOverdue() {
@ -1025,7 +1026,7 @@ add_task(function* test_environmentChange() {
let timerCallback = null;
let timerDelay = null;
clearPendingPings();
yield clearPendingPings();
yield TelemetrySend.reset();
PingServer.clearRequests();
@ -1101,6 +1102,8 @@ add_task(function* test_savedPingsOnShutdown() {
const dir = TelemetryStorage.pingDirectoryPath;
yield OS.File.removeDir(dir, {ignoreAbsent: true});
yield OS.File.makeDir(dir);
// TODO: Remove the TelemetrySend manual shutdown when bug 1145188 lands.
yield TelemetrySend.shutdown();
yield TelemetrySession.shutdown();
PingServer.clearRequests();
@ -1339,6 +1342,8 @@ add_task(function* test_abortedSession() {
Assert.notEqual(abortedSessionPing.id, updatedAbortedSessionPing.id);
Assert.notEqual(abortedSessionPing.creationDate, updatedAbortedSessionPing.creationDate);
// TODO: Remove the TelemetrySend manual shutdown when bug 1145188 lands.
yield TelemetrySend.shutdown();
yield TelemetrySession.shutdown();
Assert.ok(!(yield OS.File.exists(ABORTED_FILE)),
"No aborted session ping must be available after a shutdown.");
@ -1349,6 +1354,8 @@ add_task(function* test_abortedSession() {
yield clearPendingPings();
PingServer.clearRequests();
// TODO: Remove the TelemetrySend manual setup when bug 1145188 lands.
yield TelemetrySend.setup(true);
yield TelemetrySession.reset();
yield TelemetryController.reset();
@ -1360,6 +1367,8 @@ add_task(function* test_abortedSession() {
Assert.equal(receivedPing.type, PING_TYPE_MAIN, "Should have the correct type");
Assert.equal(receivedPing.payload.info.reason, REASON_ABORTED_SESSION, "Ping should have the correct reason");
// TODO: Remove the TelemetrySend manual shutdown when bug 1145188 lands.
yield TelemetrySend.shutdown();
yield TelemetrySession.shutdown();
});
@ -1375,6 +1384,9 @@ add_task(function* test_abortedSession_Shutdown() {
let now = fakeNow(2040, 1, 1, 0, 0, 0);
// Fake scheduler functions to control aborted-session flow in tests.
fakeSchedulerTimer(callback => schedulerTickCallback = callback, () => {});
// TODO: Remove the TelemetrySend manual setup/reset when bug 1145188 lands.
yield TelemetrySend.setup(true);
yield TelemetrySend.reset();
yield TelemetrySession.reset();
Assert.ok((yield OS.File.exists(DATAREPORTING_PATH)),
@ -1393,6 +1405,8 @@ add_task(function* test_abortedSession_Shutdown() {
// not found) do not compromise the shutdown.
yield OS.File.remove(ABORTED_FILE);
// TODO: Remove the TelemetrySend manual shutdown when bug 1145188 lands.
yield TelemetrySend.shutdown();
yield TelemetrySession.shutdown();
});
@ -1415,6 +1429,9 @@ add_task(function* test_abortedDailyCoalescing() {
// Fake scheduler functions to control aborted-session flow in tests.
fakeSchedulerTimer(callback => schedulerTickCallback = callback, () => {});
// TODO: Remove the TelemetrySend manual setup/reset when bug 1145188 lands.
yield TelemetrySend.setup(true);
yield TelemetrySend.reset();
yield TelemetrySession.reset();
Assert.ok((yield OS.File.exists(DATAREPORTING_PATH)),
@ -1444,6 +1461,8 @@ add_task(function* test_abortedDailyCoalescing() {
Assert.equal(abortedSessionPing.payload.info.sessionId, dailyPing.payload.info.sessionId);
Assert.equal(abortedSessionPing.payload.info.subsessionId, dailyPing.payload.info.subsessionId);
// TODO: Remove the TelemetrySend manual shutdown when bug 1145188 lands.
yield TelemetrySend.shutdown();
yield TelemetrySession.shutdown();
});
@ -1456,6 +1475,8 @@ add_task(function* test_schedulerComputerSleep() {
const ABORTED_FILE = OS.Path.join(DATAREPORTING_PATH, ABORTED_PING_FILE_NAME);
clearPendingPings();
// TODO: Remove the TelemetrySend manual setup when bug 1145188 lands.
yield TelemetrySend.setup(true);
yield TelemetrySend.reset();
PingServer.clearRequests();
@ -1482,6 +1503,8 @@ add_task(function* test_schedulerComputerSleep() {
Assert.ok((yield OS.File.exists(ABORTED_FILE)),
"There must be an aborted session ping.");
// TODO: Remove the TelemetrySend manual shutdown when bug 1145188 lands.
yield TelemetrySend.shutdown();
yield TelemetrySession.shutdown();
});
@ -1500,6 +1523,9 @@ add_task(function* test_schedulerEnvironmentReschedules() {
yield clearPendingPings();
PingServer.clearRequests();
// TODO: Remove the TelemetrySend manual setup/reset when bug 1145188 lands.
yield TelemetrySend.setup(true);
yield TelemetrySend.reset();
// Set a fake current date and start Telemetry.
let nowDate = new Date(2060, 10, 18, 0, 0, 0);
@ -1528,6 +1554,8 @@ add_task(function* test_schedulerEnvironmentReschedules() {
Assert.ok(!!schedulerTickCallback);
yield schedulerTickCallback();
// TODO: Remove the TelemetrySend manual shutdown when bug 1145188 lands.
yield TelemetrySend.shutdown();
yield TelemetrySession.shutdown();
});
@ -1542,6 +1570,9 @@ add_task(function* test_schedulerNothingDue() {
// Remove any aborted-session ping from the previous tests.
yield OS.File.removeDir(DATAREPORTING_PATH, { ignoreAbsent: true });
yield clearPendingPings();
// TODO: Remove the TelemetrySend manual setup/reset when bug 1145188 lands.
yield TelemetrySend.setup(true);
yield TelemetrySend.reset();
// We don't expect to receive any ping in this test, so assert if we do.
PingServer.registerPingHandler((req, res) => {
@ -1566,6 +1597,8 @@ add_task(function* test_schedulerNothingDue() {
// Check that no aborted session ping was written to disk.
Assert.ok(!(yield OS.File.exists(ABORTED_FILE)));
// TODO: Remove the TelemetrySend manual shutdown when bug 1145188 lands.
yield TelemetrySend.shutdown();
yield TelemetrySession.shutdown();
PingServer.resetPingHandler();
});
@ -1581,6 +1614,9 @@ add_task(function* test_pingExtendedStats() {
yield clearPendingPings();
PingServer.clearRequests();
// TODO: Remove the TelemetrySend manual setup/reset when bug 1145188 lands.
yield TelemetrySend.setup(true);
yield TelemetrySend.reset();
yield TelemetrySession.reset();
yield sendPing();
@ -1666,6 +1702,8 @@ add_task(function* test_schedulerUserIdle() {
fakeIdleNotification("idle");
Assert.equal(schedulerTimeout, 10 * 60 * 1000);
// TODO: Remove the TelemetrySend manual shutdown when bug 1145188 lands.
yield TelemetrySend.shutdown();
yield TelemetrySession.shutdown();
});
@ -1676,8 +1714,11 @@ add_task(function* test_DailyDueAndIdle() {
}
yield TelemetrySession.reset();
clearPendingPings();
yield clearPendingPings();
PingServer.clearRequests();
// TODO: Remove the TelemetrySend setup when bug 1145188 lands.
yield TelemetrySend.setup(true);
yield TelemetrySend.reset();
let receivedPingRequest = null;
// Register a ping handler that will assert when receiving multiple daily pings.
@ -1716,6 +1757,8 @@ add_task(function* test_DailyDueAndIdle() {
checkPingFormat(receivedPing, PING_TYPE_MAIN, true, true);
Assert.equal(receivedPing.payload.info.reason, REASON_DAILY);
// TODO: Remove the TelemetrySend manual shutdown when bug 1145188 lands.
yield TelemetrySend.shutdown();
yield TelemetrySession.shutdown();
});
@ -1726,8 +1769,11 @@ add_task(function* test_userIdleAndSchedlerTick() {
}
yield TelemetrySession.reset();
clearPendingPings();
yield clearPendingPings();
PingServer.clearRequests();
// TODO: Remove the TelemetrySend setup when bug 1145188 lands.
yield TelemetrySend.setup(true);
yield TelemetrySend.reset();
let receivedPingRequest = null;
// Register a ping handler that will assert when receiving multiple daily pings.
@ -1766,6 +1812,8 @@ add_task(function* test_userIdleAndSchedlerTick() {
checkPingFormat(receivedPing, PING_TYPE_MAIN, true, true);
Assert.equal(receivedPing.payload.info.reason, REASON_DAILY);
// TODO: Remove the TelemetrySend manual shutdown when bug 1145188 lands.
yield TelemetrySend.shutdown();
yield TelemetrySession.shutdown();
});

View File

@ -729,9 +729,9 @@ nsUnknownContentTypeDialog.prototype = {
otherHandler.hidden = false;
}
var useDefault = this.dialogElement("useSystemDefault");
var openHandler = this.dialogElement("openHandler");
openHandler.selectedIndex = 0;
var defaultOpenHandler = this.dialogElement("defaultHandler");
if (this.mLauncher.MIMEInfo.preferredAction == this.nsIMIMEInfo.useSystemDefault) {
// Open (using system default).
@ -739,7 +739,8 @@ nsUnknownContentTypeDialog.prototype = {
} else if (this.mLauncher.MIMEInfo.preferredAction == this.nsIMIMEInfo.useHelperApp) {
// Open with given helper app.
modeGroup.selectedItem = this.dialogElement("open");
openHandler.selectedIndex = 1;
openHandler.selectedItem = (otherHandler && !otherHandler.hidden) ?
otherHandler : defaultOpenHandler;
} else {
// Save to disk.
modeGroup.selectedItem = this.dialogElement("save");
@ -747,11 +748,10 @@ nsUnknownContentTypeDialog.prototype = {
// If we don't have a "default app" then disable that choice.
if (!openWithDefaultOK) {
var useDefault = this.dialogElement("defaultHandler");
var isSelected = useDefault.selected;
var isSelected = defaultOpenHandler.selected;
// Disable that choice.
useDefault.hidden = true;
defaultOpenHandler.hidden = true;
// If that's the default, then switch to "save to disk."
if (isSelected) {
openHandler.selectedIndex = 1;