merge fx-team to mozilla-central

This commit is contained in:
Carsten "Tomcat" Book 2014-05-08 13:57:32 +02:00
Родитель 1ac8701e16 bc99c6c94e
Коммит ef5d15a460
11 изменённых файлов: 127 добавлений и 52 удалений

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

@ -7,7 +7,6 @@ package org.mozilla.gecko;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.gecko.util.UiAsyncTask;
import org.json.JSONArray;
import org.json.JSONException;
@ -34,7 +33,8 @@ public final class TabsAccessor {
BrowserContract.Tabs.TITLE,
BrowserContract.Tabs.URL,
BrowserContract.Clients.GUID,
BrowserContract.Clients.NAME
BrowserContract.Clients.NAME,
BrowserContract.Clients.LAST_MODIFIED,
};
// Projection column numbers
@ -42,7 +42,8 @@ public final class TabsAccessor {
TITLE,
URL,
GUID,
NAME
NAME,
LAST_MODIFIED,
};
private static final String CLIENTS_SELECTION = BrowserContract.Clients.GUID + " IS NOT NULL";
@ -57,6 +58,11 @@ public final class TabsAccessor {
public String url;
public String guid;
public String name;
/**
* This is the last time the remote client uploaded a tabs record; that
* is, it is not per tab, but per remote client.
*/
public long lastModified;
}
public interface OnQueryTabsCompleteListener {
@ -105,6 +111,7 @@ public final class TabsAccessor {
tab.url = cursor.getString(TABS_COLUMN.URL.ordinal());
tab.guid = cursor.getString(TABS_COLUMN.GUID.ordinal());
tab.name = cursor.getString(TABS_COLUMN.NAME.ordinal());
tab.lastModified = cursor.getLong(TABS_COLUMN.LAST_MODIFIED.ordinal());
tabs.add(tab);
}

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

@ -49,6 +49,10 @@ public interface TelemetryContract {
// Generic action, usually for tracking menu and toolbar actions.
public static final String ACTION = "action.1";
// Launching (opening) an external application
// Note: Only used in JavaScript for now, but here for completeness.
public static final String LAUNCH = "launch.1";
}
/**
@ -82,6 +86,10 @@ public interface TelemetryContract {
// Action triggered from a suggestion provided to the user.
public static final String SUGGESTION = "suggestion";
// Action triggered from a pageaction in the URLBar.
// Note: Only used in JavaScript for now, but here for completeness.
public static final String PAGEACTION = "pageaction";
}
/**
@ -101,10 +109,10 @@ public interface TelemetryContract {
public static final String READER = "reader.1";
// URL bar focused.
public static final String URLBAR_FOCUSED = "urlbar.1:";
public static final String URLBAR_FOCUSED = "urlbar.1";
// Awesomescreen frecency search is active.
public static final String FRECENCY = "frecency.1:";
public static final String FRECENCY = "frecency.1";
}
/**

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

@ -434,3 +434,11 @@ just addresses the organization to follow, e.g. "This site is run by " -->
They are never shown to users -->
<!ENTITY actionbar_menu "Menu">
<!ENTITY actionbar_done "Done">
<!-- Localization note (remote_tabs_last_synced): the variable is replaced by a
"relative time span string" produced by Android. This string describes the
time the tabs were last synced relative to the current time; examples
include "42 minutes ago", "4 days ago", "last week", etc. The subject of
"Last synced" is one of the user's other Sync clients, typically Firefox on
their desktop or laptop.-->
<!ENTITY remote_tabs_last_synced "Last synced: &formatS;">

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

@ -4,24 +4,24 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/action_bar_button_inverse"
android:gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_height="@dimen/remote_tab_child_row_height"
android:gravity="center_vertical"
android:orientation="vertical"
android:background="@drawable/action_bar_button_inverse"
android:paddingLeft="2dp"
android:paddingRight="2dp">
<TextView android:id="@+id/tab"
style="@style/TabRowTextAppearance"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/TabRowTextAppearance"
android:textSize="14sp"/>
<TextView android:id="@+id/url"
style="@style/TabRowTextAppearance.Url"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/TabRowTextAppearance.Url"
android:textSize="12sp"/>
</LinearLayout>

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

@ -3,16 +3,28 @@
- 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/. -->
<org.mozilla.gecko.widget.AllCapsTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/client"
android:layout_width="fill_parent"
android:layout_height="@dimen/remote_tab_group_row_height"
style="@style/TabRowTextAppearance.Url"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@android:color/transparent"
android:paddingLeft="2dip"
android:paddingRight="2dip"
android:textStyle="bold"
android:textSize="12sp"
android:singleLine="false"
android:layout_width="fill_parent"
android:layout_height="@dimen/remote_tab_child_row_height"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="2dp"
android:paddingRight="2dp">
<org.mozilla.gecko.widget.AllCapsTextView android:id="@+id/client"
style="@style/TabRowTextAppearance"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:gravity="center_vertical"/>
android:singleLine="false"
android:textSize="14sp"
android:textStyle="bold" />
<TextView android:id="@+id/last_synced"
style="@style/TabRowTextAppearance.Url"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12sp"/>
</LinearLayout>

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

@ -4,25 +4,25 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@android:color/transparent"
android:gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_height="@dimen/remote_tab_child_row_height"
android:gravity="center_vertical"
android:orientation="vertical"
android:background="@drawable/action_bar_button_inverse"
android:paddingLeft="4dp"
android:paddingRight="4dp">
<TextView android:id="@+id/tab"
style="@style/TabRowTextAppearance"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/TabRowTextAppearance"
android:textSize="18sp" />
<TextView android:id="@+id/url"
style="@style/TabRowTextAppearance.Url"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/TabRowTextAppearance.Url"
android:textSize="14sp"
android:maxLength="1024"/>
android:maxLength="1024"
android:textSize="14sp" />
</LinearLayout>

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

@ -3,14 +3,27 @@
- 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/. -->
<org.mozilla.gecko.widget.AllCapsTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/client"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@android:color/transparent"
android:layout_width="fill_parent"
android:layout_height="@dimen/remote_tab_child_row_height"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="4dp"
android:paddingRight="4dp" >
<org.mozilla.gecko.widget.AllCapsTextView android:id="@+id/client"
style="@style/TabRowTextAppearance"
android:layout_width="fill_parent"
android:layout_height="@dimen/remote_tab_group_row_height"
android:textSize="18sp"
android:textStyle="bold" />
<TextView android:id="@+id/last_synced"
style="@style/TabRowTextAppearance.Url"
android:background="@android:color/transparent"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textStyle="bold"
android:textSize="14sp"
android:gravity="center_vertical"/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLength="1024"
android:textSize="14sp" />
</LinearLayout>

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

@ -404,4 +404,5 @@
<!-- Miscellaneous -->
<string name="ellipsis">&ellipsis;</string>
<string name="remote_tabs_last_synced">&remote_tabs_last_synced;</string>
</resources>

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

@ -4,14 +4,6 @@
package org.mozilla.gecko.tabspanel;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;
import android.widget.SimpleExpandableListAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -22,6 +14,14 @@ import org.mozilla.gecko.TabsAccessor;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import android.content.Context;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.SimpleExpandableListAdapter;
/**
* The actual list of synced tabs. This serves as the only child view of {@link RemoteTabsContainer}
* so it can be refreshed using a swipe-to-refresh gesture.
@ -30,9 +30,9 @@ class RemoteTabsList extends ExpandableListView
implements ExpandableListView.OnGroupClickListener,
ExpandableListView.OnChildClickListener,
TabsAccessor.OnQueryTabsCompleteListener {
private static final String[] CLIENT_KEY = new String[] { "name" };
private static final String[] CLIENT_KEY = new String[] { "name", "last_synced" };
private static final String[] TAB_KEY = new String[] { "title", "url" };
private static final int[] CLIENT_RESOURCE = new int[] { R.id.client };
private static final int[] CLIENT_RESOURCE = new int[] { R.id.client, R.id.last_synced };
private static final int[] TAB_RESOURCE = new int[] { R.id.tab, R.id.url };
private final Context context;
@ -92,10 +92,13 @@ class RemoteTabsList extends ExpandableListView
HashMap <String, String> client;
HashMap <String, String> tab;
final long now = System.currentTimeMillis();
for (TabsAccessor.RemoteTab remoteTab : remoteTabs) {
if (oldGuid == null || !TextUtils.equals(oldGuid, remoteTab.guid)) {
client = new HashMap <String, String>();
client.put("name", remoteTab.name);
client.put("last_synced", getLastSyncedString(now, remoteTab.lastModified));
clients.add(client);
tabsForClient = new ArrayList <HashMap <String, String>>();
@ -124,4 +127,16 @@ class RemoteTabsList extends ExpandableListView
expandGroup(i);
}
}
/**
* Return a relative "Last synced" time span for the given tab record.
*
* @param now local time.
* @param time to format string for.
* @return string describing time span
*/
protected String getLastSyncedString(long now, long time) {
CharSequence relativeTimeSpanString = DateUtils.getRelativeTimeSpanString(time, now, DateUtils.MINUTE_IN_MILLIS);
return getResources().getString(R.string.remote_tabs_last_synced, relativeTimeSpanString);
}
}

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

@ -8101,6 +8101,10 @@ var ExternalApps = {
icon: "drawable://icon_openinapp",
clickCallback: () => {
// Create a relative timestamp for telemetry
let uptime = Date.now() - Services.startup.getStartupInfo().linkerInitialized;
UITelemetry.addEvent("launch.1", "pageaction", uptime, "helper");
if (apps.length > 1) {
// Use the HelperApps prompt here to filter out any Http handlers
HelperApps.prompt(apps, {

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

@ -46,15 +46,22 @@ DEFINES += -DENABLE_MARIONETTE=1
endif
ifdef MOZ_PKG_MANIFEST_P
$(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P) $(GLOBAL_DEPS)
# When MOZ_CHROME_MULTILOCALE is defined, we write multilocale.json like:
# {"locales": ["en-US", "de", "ar", ...]}
$(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P) $(GLOBAL_DEPS) FORCE
$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $< -o $@)
ifdef MOZ_CHROME_MULTILOCALE
printf '\n[multilocale]\n' >> $@
printf '@BINPATH@/res/multilocale.json\n' >> $@
for LOCALE in en-US $(MOZ_CHROME_MULTILOCALE) ;\
do \
printf '$(BINPATH)/chrome/'"$$LOCALE"'$(JAREXT)\n' >> $@; \
printf '$(BINPATH)/chrome/'"$$LOCALE"'.manifest\n' >> $@; \
done
COMMA=,
echo '{"locales": [$(foreach l,$(MOZ_CHROME_MULTILOCALE),"$(l)"$(COMMA)) "en-US"]}' \
> $(FINAL_TARGET)/res/multilocale.json
endif
GARBAGE += $(MOZ_PKG_MANIFEST)