This commit is contained in:
Wes Kocher 2014-03-18 19:49:21 -07:00
Родитель 4bcf672e15 8b557da708
Коммит 245ba1fb31
17 изменённых файлов: 134 добавлений и 40 удалений

Просмотреть файл

@ -639,12 +639,14 @@
<toolbarbutton id="back-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&backCmd.label;"
command="Browser:BackOrBackDuplicate"
cui-areatype="toolbar"
onclick="checkForMiddleClick(this, event);"
tooltip="back-button-tooltip"
context="backForwardMenu"/>
<toolbarbutton id="forward-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&forwardCmd.label;"
command="Browser:ForwardOrForwardDuplicate"
cui-areatype="toolbar"
onclick="checkForMiddleClick(this, event);"
tooltip="forward-button-tooltip"
context="backForwardMenu"/>
@ -893,14 +895,17 @@
<toolbarbutton id="nav-bar-overflow-button"
class="toolbarbutton-1 chromeclass-toolbar-additional overflow-button"
cui-areatype="toolbar"
skipintoolbarset="true"
tooltiptext="&navbarOverflow.label;"/>
<toolbaritem id="PanelUI-button"
class="chromeclass-toolbar-additional"
cui-areatype="toolbar"
removable="false">
<toolbarbutton id="PanelUI-menu-button"
class="toolbarbutton-1"
cui-areatype="toolbar"
label="&brandShortName;"
tooltiptext="&appmenu.tooltip;"/>
</toolbaritem>

Просмотреть файл

@ -73,6 +73,7 @@ function updateCombinedWidgetStyle(aNode, aArea, aModifyCloseMenu) {
if (aModifyCloseMenu) {
attrs.closemenu = inPanel ? "none" : null;
}
attrs["cui-areatype"] = aArea ? CustomizableUI.getAreaType(aArea) : null;
for (let i = 0, l = aNode.childNodes.length; i < l; ++i) {
if (aNode.childNodes[i].localName == "separator")
continue;
@ -431,32 +432,21 @@ const CustomizableWidgets = [{
let areaType = CustomizableUI.getAreaType(this.currentArea);
let inPanel = areaType == CustomizableUI.TYPE_MENU_PANEL;
let inToolbar = areaType == CustomizableUI.TYPE_TOOLBAR;
let closeMenu = inPanel ? "none" : null;
let cls = inPanel ? "panel-combined-button" : "toolbarbutton-1 toolbarbutton-combined";
if (!this.currentArea)
cls = null;
let buttons = [{
id: "zoom-out-button",
closemenu: closeMenu,
command: "cmd_fullZoomReduce",
class: cls,
label: true,
tooltiptext: "tooltiptext2",
shortcutId: "key_fullZoomReduce",
}, {
id: "zoom-reset-button",
closemenu: closeMenu,
command: "cmd_fullZoomReset",
class: cls,
tooltiptext: "tooltiptext2",
shortcutId: "key_fullZoomReset",
}, {
id: "zoom-in-button",
closemenu: closeMenu,
command: "cmd_fullZoomEnlarge",
class: cls,
label: true,
tooltiptext: "tooltiptext2",
shortcutId: "key_fullZoomEnlarge",
@ -515,6 +505,7 @@ const CustomizableWidgets = [{
}
updateZoomResetButton();
}
updateCombinedWidgetStyle(node, this.currentArea, true);
let listener = {
onWidgetAdded: function(aWidgetId, aArea, aPosition) {
@ -609,30 +600,21 @@ const CustomizableWidgets = [{
type: "custom",
defaultArea: CustomizableUI.AREA_PANEL,
onBuild: function(aDocument) {
let inPanel = (this.currentArea == CustomizableUI.AREA_PANEL);
let cls = inPanel ? "panel-combined-button" : "toolbarbutton-1 toolbarbutton-combined";
if (!this.currentArea)
cls = null;
let buttons = [{
id: "cut-button",
command: "cmd_cut",
class: cls,
label: true,
tooltiptext: "tooltiptext2",
shortcutId: "key_cut",
}, {
id: "copy-button",
command: "cmd_copy",
class: cls,
label: true,
tooltiptext: "tooltiptext2",
shortcutId: "key_copy",
}, {
id: "paste-button",
command: "cmd_paste",
class: cls,
label: true,
tooltiptext: "tooltiptext2",
shortcutId: "key_paste",
@ -656,6 +638,8 @@ const CustomizableWidgets = [{
node.appendChild(btnNode);
});
updateCombinedWidgetStyle(node, this.currentArea);
let listener = {
onWidgetAdded: function(aWidgetId, aArea, aPosition) {
if (aWidgetId != this.id)

Просмотреть файл

@ -272,6 +272,10 @@ Spectrum.prototype = {
},
updateHelperLocations: function() {
// If the UI hasn't been shown yet then none of the dimensions will be correct
if (!this.element.classList.contains('spectrum-show'))
return;
let h = this.hsv[0];
let s = this.hsv[1];
let v = this.hsv[2];

Просмотреть файл

@ -85,7 +85,7 @@ http://www.briangrinstead.com/blog/keep-aspect-ratio-with-html-and-css */
}
.spectrum-dragger, .spectrum-slider {
user-select: none;
-moz-user-select: none;
}
.spectrum-alpha {

Просмотреть файл

@ -746,8 +746,8 @@ toolbar .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker > .dropmarker-ic
list-style-image: url("chrome://browser/skin/Toolbar@2x.png");
}
:-moz-any(@primaryToolbarButtons@):-moz-lwtheme-brighttext,
#bookmarks-menu-button[cui-areatype="toolbar"]:-moz-lwtheme-brighttext > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
:-moz-any(@primaryToolbarButtons@):not(@inAnyPanel@):-moz-lwtheme-brighttext,
#bookmarks-menu-button:not(@inAnyPanel@):-moz-lwtheme-brighttext > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
list-style-image: url("chrome://browser/skin/Toolbar-inverted@2x.png");
}

Просмотреть файл

@ -3,8 +3,8 @@
list-style-image: url("chrome://browser/skin/Toolbar.png");
}
:-moz-any(@primaryToolbarButtons@):-moz-lwtheme-brighttext,
#bookmarks-menu-button:-moz-lwtheme-brighttext > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
:-moz-any(@primaryToolbarButtons@):not(@inAnyPanel@):-moz-lwtheme-brighttext,
#bookmarks-menu-button:not(@inAnyPanel@):-moz-lwtheme-brighttext > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
list-style-image: url(chrome://browser/skin/Toolbar-inverted.png);
}

Просмотреть файл

@ -23,11 +23,19 @@ using namespace mozilla::gfx;
NS_IMPL_ISUPPORTS1(MediaEngineTabVideoSource, MediaEngineVideoSource)
MediaEngineTabVideoSource::MediaEngineTabVideoSource()
: mName(NS_LITERAL_STRING("share tab")), mUuid(NS_LITERAL_STRING("uuid")),
: mName(NS_LITERAL_STRING("&getUserMedia.videoDevice.tabShare;")),
mUuid(NS_LITERAL_STRING("uuid")),
mData(0),
mMonitor("MediaEngineTabVideoSource")
{
}
MediaEngineTabVideoSource::~MediaEngineTabVideoSource()
{
if (mData)
free(mData);
}
nsresult
MediaEngineTabVideoSource::StartRunnable::Run()
{
@ -39,6 +47,7 @@ MediaEngineTabVideoSource::StartRunnable::Run()
mVideoSource->mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
mVideoSource->mTimer->InitWithCallback(mVideoSource, mVideoSource->mTimePerFrame, nsITimer:: TYPE_REPEATING_SLACK);
}
mVideoSource->mTabSource->NotifyStreamStart(mVideoSource->mWindow);
return NS_OK;
}
@ -54,6 +63,7 @@ MediaEngineTabVideoSource::StopRunnable::Run()
mVideoSource->mTimer->Cancel();
mVideoSource->mTimer = nullptr;
}
mVideoSource->mTabSource->NotifyStreamStop(mVideoSource->mWindow);
return NS_OK;
}
@ -83,10 +93,11 @@ MediaEngineTabVideoSource::InitRunnable::Run()
branch->GetIntPref("media.tabstreaming.time_per_frame", &mVideoSource->mTimePerFrame);
mVideoSource->mData = (unsigned char*)malloc(mVideoSource->mBufW * mVideoSource->mBufH * 4);
nsCOMPtr<nsITabSource> tabSource = do_GetService(NS_TABSOURCESERVICE_CONTRACTID, &rv);
mVideoSource->mTabSource = do_GetService(NS_TABSOURCESERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMWindow> win;
rv = tabSource->GetTabToStream(getter_AddRefs(win));
rv = mVideoSource->mTabSource->GetTabToStream(getter_AddRefs(win));
NS_ENSURE_SUCCESS(rv, rv);
if (!win)
return NS_OK;

Просмотреть файл

@ -7,6 +7,7 @@
#include "ImageContainer.h"
#include "nsITimer.h"
#include "mozilla/Monitor.h"
#include "nsITabSource.h"
namespace mozilla {
@ -16,7 +17,8 @@ class MediaEngineTabVideoSource : public MediaEngineVideoSource, nsIDOMEventList
NS_DECL_NSIDOMEVENTLISTENER
NS_DECL_NSITIMERCALLBACK
MediaEngineTabVideoSource();
~MediaEngineTabVideoSource() { free(mData); }
~MediaEngineTabVideoSource();
virtual void GetName(nsAString_internal&);
virtual void GetUUID(nsAString_internal&);
virtual nsresult Allocate(const mozilla::MediaEnginePrefs&);
@ -60,6 +62,6 @@ private:
nsCOMPtr<nsITimer> mTimer;
nsAutoString mName, mUuid;
Monitor mMonitor;
nsCOMPtr<nsITabSource> mTabSource;
};
}

Просмотреть файл

@ -121,10 +121,6 @@ MediaEngineWebRTC::EnumerateVideoDevices(nsTArray<nsRefPtr<MediaEngineVideoSourc
return;
}
#endif
if (mHasTabVideoSource)
aVSources->AppendElement(new MediaEngineTabVideoSource());
if (!mVideoEngine) {
if (!(mVideoEngine = webrtc::VideoEngine::Create())) {
return;
@ -229,6 +225,9 @@ MediaEngineWebRTC::EnumerateVideoDevices(nsTArray<nsRefPtr<MediaEngineVideoSourc
}
}
if (mHasTabVideoSource)
aVSources->AppendElement(new MediaEngineTabVideoSource());
return;
#endif
}

Просмотреть файл

@ -10,6 +10,8 @@
interface nsITabSource : nsISupports
{
nsIDOMWindow getTabToStream();
void notifyStreamStart(in nsIDOMWindow window);
void notifyStreamStop(in nsIDOMWindow window);
};
%{C++

Просмотреть файл

@ -124,7 +124,10 @@ var WebrtcUI = {
// if this is a Camera input, convert the name to something readable
let res = /Camera\ \d+,\ Facing (front|back)/.exec(device.name);
if (res)
return Strings.browser.GetStringFromName("getUserMedia." + aType + "." + res[1]);
return Strings.browser.GetStringFromName("getUserMedia." + aType + "." + res[1] + "Camera");
if (device.name.startsWith("&") && device.name.endsWith(";"))
return Strings.browser.GetStringFromName(device.name.substring(1, device.name.length -1));
if (device.name.trim() == "") {
defaultCount++;

Просмотреть файл

@ -100,6 +100,10 @@ contract @mozilla.org/payment/ui-glue;1 {3c6c9575-f57e-427b-a8aa-57bc3cbff48f}
component {18a4e042-7c7c-424b-a583-354e68553a7f} FilePicker.js
contract @mozilla.org/filepicker;1 {18a4e042-7c7c-424b-a583-354e68553a7f}
# TabSource.js
component {5850c76e-b916-4218-b99a-31f004e0a7e7} TabSource.js
contract @mozilla.org/tab-source-service;1 {5850c76e-b916-4218-b99a-31f004e0a7e7}
# Snippets.js
component {a78d7e59-b558-4321-a3d6-dffe2f1e76dd} Snippets.js
contract @mozilla.org/snippets;1 {a78d7e59-b558-4321-a3d6-dffe2f1e76dd}

Просмотреть файл

@ -0,0 +1,75 @@
const { classes: Cc, interfaces: Ci, manager: Cm, utils: Cu, results: Cr } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Prompt.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "sendMessageToJava",
"resource://gre/modules/Messaging.jsm");
function TabSource() {
}
TabSource.prototype = {
classID: Components.ID("{5850c76e-b916-4218-b99a-31f004e0a7e7}"),
classDescription: "Fennec Tab Source",
contractID: "@mozilla.org/tab-source-service;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsITabSource]),
getTabToStream: function() {
let app = Services.wm.getMostRecentWindow("navigator:browser").BrowserApp;
let tabs = app.tabs;
if (tabs == null || tabs.length == 0) {
Services.console.logStringMessage("ERROR: No tabs");
return null;
}
let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
let title = bundle.GetStringFromName("tabshare.title")
let prompt = new Prompt({
title: title,
window: null
}).setSingleChoiceItems(tabs.map(function(tab) {
return { label: tab.browser.contentTitle || tab.browser.contentURI.spec }
}));
let result = null;
prompt.show(function(data) {
result = data.button;
});
// Spin this thread while we wait for a result.
let thread = Services.tm.currentThread;
while (result == null) {
thread.processNextEvent(true);
}
if (result == -1) {
return null;
}
return tabs[result].browser.contentWindow;
},
notifyStreamStart: function(window) {
let app = Services.wm.getMostRecentWindow("navigator:browser").BrowserApp;
let tabs = app.tabs;
for (var i in tabs) {
if (tabs[i].browser.contentWindow == window) {
sendMessageToJava({ type: "Tab:Streaming", tabID: tabs[i].id });
}
}
},
notifyStreamStop: function(window) {
let app = Services.wm.getMostRecentWindow("navigator:browser").BrowserApp;
let tabs = app.tabs;
for (let i in tabs) {
if (tabs[i].browser.contentWindow == window) {
sendMessageToJava({ type: "Tab:NotStreaming", tabID: tabs[i].id });
}
}
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TabSource]);

Просмотреть файл

@ -24,6 +24,7 @@ EXTRA_COMPONENTS += [
'PromptService.js',
'SiteSpecificUserAgent.js',
'Snippets.js',
'TabSource.js',
'WebappsUpdateTimer.js',
'XPIDialogService.js',
]

Просмотреть файл

@ -335,6 +335,7 @@
@BINPATH@/components/amContentHandler.js
@BINPATH@/components/amWebInstallListener.js
@BINPATH@/components/nsBlocklistService.js
@BINPATH@/components/TabSource.js
@BINPATH@/components/webvtt.xpt
@BINPATH@/components/WebVTT.manifest
@BINPATH@/components/WebVTTParserWrapper.js

Просмотреть файл

@ -302,10 +302,11 @@ getUserMedia.shareCameraAndMicrophone.message = Would you like to share your cam
getUserMedia.denyRequest.label = Don't Share
getUserMedia.shareRequest.label = Share
getUserMedia.videoDevice.default = Camera %S
getUserMedia.videoDevice.front = Front facing
getUserMedia.videoDevice.back = Back facing
getUserMedia.videoDevice.frontCamera = Front facing camera
getUserMedia.videoDevice.backCamera = Back facing camera
getUserMedia.videoDevice.none = No Video
getUserMedia.videoDevice.prompt = Camera to use
getUserMedia.videoDevice.tabShare = Choose a tab to stream
getUserMedia.videoDevice.prompt = Video source
getUserMedia.audioDevice.default = Microphone %S
getUserMedia.audioDevice.none = No Audio
getUserMedia.audioDevice.prompt = Microphone to use
@ -322,6 +323,8 @@ openInApp.pageAction = Open in App
openInApp.ok = OK
openInApp.cancel = Cancel
#Tab sharing
tabshare.title = "Choose a tab to stream"
#Tabs in context menus
browser.menu.context.default = Link
browser.menu.context.img = Image

Просмотреть файл

@ -3,13 +3,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["gDevToolsExtensions"];
this.EXPORTED_SYMBOLS = ["gDevToolsExtensions"];
Components.utils.import("resource://gre/modules/Services.jsm");
let globalsCache = {};
const gDevToolsExtensions = {
this.gDevToolsExtensions = {
addContentGlobal: function(options) {
if (!options || !options.global || !options['inner-window-id']) {
throw Error('Invalid arguments');