Merge fx-team to m-c.

This commit is contained in:
Ryan VanderMeulen 2013-12-04 17:34:58 -05:00
commit 815a957100
11 changed files with 159 additions and 71 deletions

View File

@ -116,6 +116,7 @@ let ScriptContexts = {};
["NavButtonSlider", "chrome://browser/content/NavButtonSlider.js"],
["ContextUI", "chrome://browser/content/ContextUI.js"],
["FlyoutPanelsUI", "chrome://browser/content/flyoutpanels/FlyoutPanelsUI.js"],
["SettingsCharm", "chrome://browser/content/flyoutpanels/SettingsCharm.js"],
["APZCObserver", "chrome://browser/content/apzc.js"],
].forEach(function (aScript) {
let [name, script] = aScript;

View File

@ -1276,70 +1276,3 @@ var DialogUI = {
return targetNode ? true : false;
}
};
/**
* Manage the contents of the Windows 8 "Settings" charm.
*/
var SettingsCharm = {
_entries: new Map(),
_nextId: 0,
/**
* Add a new item to the "Settings" menu in the Windows 8 charms.
* @param aEntry Object with a "label" property (string that will appear in the UI)
* and an "onselected" property (function to be called when the user chooses this entry)
*/
addEntry: function addEntry(aEntry) {
try {
let id = Services.metro.addSettingsPanelEntry(aEntry.label);
this._entries.set(id, aEntry);
} catch (e) {
// addSettingsPanelEntry does not work on non-Metro platforms
Cu.reportError(e);
}
},
init: function SettingsCharm_init() {
Services.obs.addObserver(this, "metro-settings-entry-selected", false);
// Options
this.addEntry({
label: Strings.browser.GetStringFromName("optionsCharm"),
onselected: function() FlyoutPanelsUI.show('PrefsFlyoutPanel')
});
/*
* Temporarily disabled until we can have sync prefs together with the
* Desktop browser's sync prefs.
// Sync
this.addEntry({
label: Strings.brand.GetStringFromName("syncBrandShortName"),
onselected: function() FlyoutPanelsUI.show('SyncFlyoutPanel')
});
*/
// About
this.addEntry({
label: Strings.browser.GetStringFromName("aboutCharm1"),
onselected: function() FlyoutPanelsUI.show('AboutFlyoutPanel')
});
// Help
this.addEntry({
label: Strings.browser.GetStringFromName("helpOnlineCharm"),
onselected: function() {
let url = Services.urlFormatter.formatURLPref("app.support.baseURL");
BrowserUI.addAndShowTab(url, Browser.selectedTab);
}
});
},
observe: function SettingsCharm_observe(aSubject, aTopic, aData) {
if (aTopic == "metro-settings-entry-selected") {
let entry = this._entries.get(parseInt(aData, 10));
if (entry)
entry.onselected();
}
},
uninit: function SettingsCharm_uninit() {
Services.obs.removeObserver(this, "metro-settings-entry-selected");
}
};

View File

@ -21,6 +21,8 @@
%prefsDTD;
<!ENTITY % aboutPanelDTD SYSTEM "chrome://browser/locale/aboutPanel.dtd">
%aboutPanelDTD;
<!ENTITY % searchPanelDTD SYSTEM "chrome://browser/locale/searchPanel.dtd">
%searchPanelDTD;
#ifdef MOZ_SERVICES_SYNC
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
%syncBrandDTD;
@ -686,6 +688,10 @@ Desktop browser's sync prefs.
<label class="text-link" href="https://www.mozilla.org/dnt">&doNotTrack.learnMoreLink;</label>
</settings>
</flyoutpanel>
<flyoutpanel id="search-flyoutpanel" class="flyout-narrow" headertext="&searchFlyoutHeader.title;">
<settings id="search-options" label="&searchSetting.title;">
</settings>
</flyoutpanel>
<!-- Chrome touch selection overlay -->
<box class="selection-overlay-hidden" id="chrome-selection-overlay"/>

View File

@ -22,6 +22,7 @@ let FlyoutPanelsUI = {
[
['AboutFlyoutPanel', 'chrome://browser/content/flyoutpanels/AboutFlyoutPanel.js'],
['PrefsFlyoutPanel', 'chrome://browser/content/flyoutpanels/PrefsFlyoutPanel.js'],
['SearchFlyoutPanel', 'chrome://browser/content/flyoutpanels/SearchFlyoutPanel.js'],
#ifdef MOZ_SERVICES_SYNC
['SyncFlyoutPanel', 'chrome://browser/content/flyoutpanels/SyncFlyoutPanel.js'],
#endif

View File

@ -0,0 +1,60 @@
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
/* 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/. */
"use strict";
Components.utils.import("resource://gre/modules/Services.jsm");
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let SearchFlyoutPanel = {
_isInitialized: false,
_hasShown: false,
init: function pv_init() {
if (this._isInitialized) {
Cu.reportError("Attempting to re-initialize PreferencesPanelView");
return;
}
this._topmostElement = document.getElementById("search-flyoutpanel");
this._isInitialized = true;
},
checked: function checked(aId) {
aId = aId.replace("search-", "");
Services.search.defaultEngine = this._engines[parseInt(aId)];
this.updateSearchEngines();
},
updateSearchEngines: function () {
// Clear the list
let setting = document.getElementById("search-options");
while(setting.hasChildNodes()) {
setting.removeChild(setting.firstChild);
}
// Build up the list and check the default
this._engines = Services.search.getVisibleEngines();
let defaultEngine = Services.search.defaultEngine;
this._engines.forEach(function (aEngine, aIndex) {
let radio = document.createElementNS(XUL_NS, "radio");
radio.setAttribute("id", "search-" + aIndex);
radio.setAttribute("label", aEngine.name);
radio.setAttribute("oncommand", "FlyoutPanelsUI.SearchFlyoutPanel.checked(this.id)");
if (defaultEngine == aEngine) {
radio.setAttribute("selected", true);
}
setting.appendChild(radio);
}.bind(this));
},
_show: function() {
if (!this._hasShown) {
this._hasShown = true;
this.updateSearchEngines();
}
this._topmostElement.show();
}
};

View File

@ -0,0 +1,76 @@
/**
* Manage the contents of the Windows 8 "Settings" charm.
*/
var SettingsCharm = {
_entries: new Map(),
_nextId: 0,
/**
* Add a new item to the "Settings" menu in the Windows 8 charms.
* @param aEntry Object with a "label" property (string that will appear in the UI)
* and an "onselected" property (function to be called when the user chooses this entry)
*/
addEntry: function addEntry(aEntry) {
try {
let id = Services.metro.addSettingsPanelEntry(aEntry.label);
this._entries.set(id, aEntry);
} catch (e) {
// addSettingsPanelEntry does not work on non-Metro platforms
Cu.reportError(e);
}
},
init: function SettingsCharm_init() {
Services.obs.addObserver(this, "metro-settings-entry-selected", false);
// Options
this.addEntry({
label: Strings.browser.GetStringFromName("optionsCharm"),
onselected: function() FlyoutPanelsUI.show('PrefsFlyoutPanel')
});
// Search providers
this.addEntry({
label: Strings.browser.GetStringFromName("searchCharm"),
onselected: function() FlyoutPanelsUI.show('SearchFlyoutPanel')
});
/*
* Temporarily disabled until we can have sync prefs together with the
* Desktop browser's sync prefs.
// Sync
this.addEntry({
label: Strings.brand.GetStringFromName("syncBrandShortName"),
onselected: function() FlyoutPanelsUI.show('SyncFlyoutPanel')
});
*/
// About
this.addEntry({
label: Strings.browser.GetStringFromName("aboutCharm1"),
onselected: function() FlyoutPanelsUI.show('AboutFlyoutPanel')
});
// Help
this.addEntry({
label: Strings.browser.GetStringFromName("helpOnlineCharm"),
onselected: function() {
let url = Services.urlFormatter.formatURLPref("app.support.baseURL");
BrowserUI.addAndShowTab(url, Browser.selectedTab);
}
});
},
observe: function SettingsCharm_observe(aSubject, aTopic, aData) {
if (aTopic == "metro-settings-entry-selected") {
let entry = this._entries.get(parseInt(aData, 10));
if (entry)
entry.onselected();
}
},
uninit: function SettingsCharm_uninit() {
Services.obs.removeObserver(this, "metro-settings-entry-selected");
}
};

View File

@ -30,9 +30,14 @@ chrome.jar:
content/bindings/notification.xml (content/bindings/notification.xml)
content/bindings/tabprompts.xml (content/bindings/tabprompts.xml)
content/flyoutpanels/SettingsCharm.js (content/flyoutpanels/SettingsCharm.js)
* content/flyoutpanels/FlyoutPanelsUI.js (content/flyoutpanels/FlyoutPanelsUI.js)
* content/flyoutpanels/AboutFlyoutPanel.js (content/flyoutpanels/AboutFlyoutPanel.js)
content/flyoutpanels/PrefsFlyoutPanel.js (content/flyoutpanels/PrefsFlyoutPanel.js)
content/flyoutpanels/SearchFlyoutPanel.js (content/flyoutpanels/SearchFlyoutPanel.js)
#ifdef MOZ_SERVICES_SYNC
content/flyoutpanels/SyncFlyoutPanel.js (content/flyoutpanels/SyncFlyoutPanel.js)
#endif
content/helperui/AlertsHelper.js (content/helperui/AlertsHelper.js)
content/helperui/IndexedDB.js (content/helperui/IndexedDB.js)
@ -81,9 +86,6 @@ chrome.jar:
content/TopSites.js (content/TopSites.js)
content/console.js (content/console.js)
content/dbg-metro-actors.js (content/dbg-metro-actors.js)
#ifdef MOZ_SERVICES_SYNC
content/flyoutpanels/SyncFlyoutPanel.js (content/flyoutpanels/SyncFlyoutPanel.js)
#endif
content/NavButtonSlider.js (content/NavButtonSlider.js)
content/ContextUI.js (content/ContextUI.js)
content/apzc.js (content/apzc.js)

View File

@ -44,6 +44,7 @@ clearPrivateData.message=Clear your private data?
# Settings Charms
aboutCharm1=About
optionsCharm=Options
searchCharm=Search
helpOnlineCharm=Help (online)
# General

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/. -->
<!ENTITY searchFlyoutHeader.title "Search">
<!ENTITY searchSetting.title "Default Search Provider">

View File

@ -16,6 +16,7 @@
locale/browser/config.dtd (%chrome/config.dtd)
locale/browser/preferences.dtd (%chrome/preferences.dtd)
locale/browser/aboutPanel.dtd (%chrome/aboutPanel.dtd)
locale/browser/searchPanel.dtd (%chrome/searchPanel.dtd)
locale/browser/checkbox.dtd (%chrome/checkbox.dtd)
locale/browser/sync.dtd (%chrome/sync.dtd)
locale/browser/sync.properties (%chrome/sync.properties)

View File

@ -158,7 +158,7 @@ var DebuggerServer = {
LONG_STRING_LENGTH: 10000,
LONG_STRING_INITIAL_LENGTH: 1000,
LONG_STRING_READ_LENGTH: 1000,
LONG_STRING_READ_LENGTH: 65 * 1024,
/**
* A handler function that prompts the user to accept or decline the incoming