Merge "Omnibox supports search extra data"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 8e6934c..9fea44a 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -232,7 +232,6 @@
<receiver android:name=".OpenDownloadReceiver">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED"/>
- <data android:scheme="content" android:mimeType="vnd.android.cursor.item/download"/>
</intent-filter>
</receiver>
</application>
diff --git a/res/drawable-hdpi/bookmark_dialog_bg.9.png b/res/drawable-hdpi/bookmark_dialog_bg.9.png
new file mode 100644
index 0000000..9b8384d
--- /dev/null
+++ b/res/drawable-hdpi/bookmark_dialog_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi/cab_bg.9.png b/res/drawable-hdpi/cab_bg.9.png
new file mode 100644
index 0000000..8d0de94
--- /dev/null
+++ b/res/drawable-hdpi/cab_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi/crumb_divider.9.png b/res/drawable-hdpi/crumb_divider.9.png
new file mode 100644
index 0000000..f748ffa
--- /dev/null
+++ b/res/drawable-hdpi/crumb_divider.9.png
Binary files differ
diff --git a/res/drawable-hdpi/dialog_full.9.png b/res/drawable-hdpi/dialog_full.9.png
new file mode 100644
index 0000000..33a502b
--- /dev/null
+++ b/res/drawable-hdpi/dialog_full.9.png
Binary files differ
diff --git a/res/drawable-hdpi/empty_bookmark_image.png b/res/drawable-hdpi/empty_bookmark_image.png
new file mode 100644
index 0000000..7f9af71
--- /dev/null
+++ b/res/drawable-hdpi/empty_bookmark_image.png
Binary files differ
diff --git a/res/drawable-hdpi/fav_incognito.png b/res/drawable-hdpi/fav_incognito.png
new file mode 100644
index 0000000..b8acde2
--- /dev/null
+++ b/res/drawable-hdpi/fav_incognito.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_add_string.png b/res/drawable-hdpi/ic_add_string.png
new file mode 100644
index 0000000..0775776
--- /dev/null
+++ b/res/drawable-hdpi/ic_add_string.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_back_normal.png b/res/drawable-hdpi/ic_back_normal.png
new file mode 100644
index 0000000..1e1b446
--- /dev/null
+++ b/res/drawable-hdpi/ic_back_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_bookmarks_history_normal.png b/res/drawable-hdpi/ic_bookmarks_history_normal.png
new file mode 100644
index 0000000..5110097
--- /dev/null
+++ b/res/drawable-hdpi/ic_bookmarks_history_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_favorite_on_dark.png b/res/drawable-hdpi/ic_favorite_on_dark.png
new file mode 100644
index 0000000..c60cbbe
--- /dev/null
+++ b/res/drawable-hdpi/ic_favorite_on_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_favorite_on_normal.png b/res/drawable-hdpi/ic_favorite_on_normal.png
new file mode 100644
index 0000000..fec86e8
--- /dev/null
+++ b/res/drawable-hdpi/ic_favorite_on_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_folder.9.png b/res/drawable-hdpi/ic_folder.9.png
new file mode 100644
index 0000000..c1c9d54
--- /dev/null
+++ b/res/drawable-hdpi/ic_folder.9.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_forward_normal.png b/res/drawable-hdpi/ic_forward_normal.png
new file mode 100644
index 0000000..1cbf28a
--- /dev/null
+++ b/res/drawable-hdpi/ic_forward_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_go_dark.png b/res/drawable-hdpi/ic_go_dark.png
new file mode 100644
index 0000000..6c06ced
--- /dev/null
+++ b/res/drawable-hdpi/ic_go_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_archive_normal.png b/res/drawable-hdpi/ic_menu_archive_normal.png
new file mode 100644
index 0000000..368b125
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_archive_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_cab_close.png b/res/drawable-hdpi/ic_menu_cab_close.png
new file mode 100644
index 0000000..5cf7990
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_cab_close.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_cab_pencil.png b/res/drawable-hdpi/ic_menu_cab_pencil.png
new file mode 100644
index 0000000..a15878b
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_cab_pencil.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_downloads_normal.png b/res/drawable-hdpi/ic_menu_downloads_normal.png
new file mode 100644
index 0000000..b1ef0fe
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_downloads_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_findonpage_normal.png b/res/drawable-hdpi/ic_menu_findonpage_normal.png
new file mode 100644
index 0000000..f4f8f85
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_findonpage_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_incognito_normal.png b/res/drawable-hdpi/ic_menu_incognito_normal.png
new file mode 100644
index 0000000..dbecf6f
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_incognito_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_overflow.png b/res/drawable-hdpi/ic_menu_overflow.png
new file mode 100644
index 0000000..107de5e
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_overflow.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_pageinfo_normal.png b/res/drawable-hdpi/ic_menu_pageinfo_normal.png
new file mode 100644
index 0000000..b783a65
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_pageinfo_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_settings_normal.png b/res/drawable-hdpi/ic_menu_settings_normal.png
new file mode 100644
index 0000000..f07be97
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_settings_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_menu_share_normal.png b/res/drawable-hdpi/ic_menu_share_normal.png
new file mode 100644
index 0000000..b50b58f
--- /dev/null
+++ b/res/drawable-hdpi/ic_menu_share_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_refresh_normal.png b/res/drawable-hdpi/ic_refresh_normal.png
new file mode 100644
index 0000000..9ee3078
--- /dev/null
+++ b/res/drawable-hdpi/ic_refresh_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_search_normal.png b/res/drawable-hdpi/ic_search_normal.png
new file mode 100644
index 0000000..343d2ca
--- /dev/null
+++ b/res/drawable-hdpi/ic_search_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_stop_normal.png b/res/drawable-hdpi/ic_stop_normal.png
new file mode 100644
index 0000000..18ca67a
--- /dev/null
+++ b/res/drawable-hdpi/ic_stop_normal.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_tab_close.png b/res/drawable-hdpi/ic_tab_close.png
new file mode 100644
index 0000000..e501486
--- /dev/null
+++ b/res/drawable-hdpi/ic_tab_close.png
Binary files differ
diff --git a/res/drawable-hdpi/menu_dropdown.9.png b/res/drawable-hdpi/menu_dropdown.9.png
new file mode 100644
index 0000000..e388252
--- /dev/null
+++ b/res/drawable-hdpi/menu_dropdown.9.png
Binary files differ
diff --git a/res/drawable-hdpi/progress.9.png b/res/drawable-hdpi/progress.9.png
new file mode 100644
index 0000000..398bee4
--- /dev/null
+++ b/res/drawable-hdpi/progress.9.png
Binary files differ
diff --git a/res/drawable-hdpi/tabbar_bg.9.png b/res/drawable-hdpi/tabbar_bg.9.png
new file mode 100644
index 0000000..01dabd0
--- /dev/null
+++ b/res/drawable-hdpi/tabbar_bg.9.png
Binary files differ
diff --git a/res/drawable-hdpi/text_field.9.png b/res/drawable-hdpi/text_field.9.png
new file mode 100644
index 0000000..a30afd9
--- /dev/null
+++ b/res/drawable-hdpi/text_field.9.png
Binary files differ
diff --git a/res/drawable-hdpi/text_field_focused.9.png b/res/drawable-hdpi/text_field_focused.9.png
new file mode 100644
index 0000000..3888eef
--- /dev/null
+++ b/res/drawable-hdpi/text_field_focused.9.png
Binary files differ
diff --git a/res/drawable-hdpi/text_field_results.9.png b/res/drawable-hdpi/text_field_results.9.png
new file mode 100644
index 0000000..bd4bcc5
--- /dev/null
+++ b/res/drawable-hdpi/text_field_results.9.png
Binary files differ
diff --git a/res/drawable-hdpi/urlbar_bg.9.png b/res/drawable-hdpi/urlbar_bg.9.png
new file mode 100644
index 0000000..c35383e
--- /dev/null
+++ b/res/drawable-hdpi/urlbar_bg.9.png
Binary files differ
diff --git a/res/drawable-mdpi/button_selected.png b/res/drawable-mdpi/button_selected.png
new file mode 100644
index 0000000..5513bb3
--- /dev/null
+++ b/res/drawable-mdpi/button_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_folder.9.png b/res/drawable-mdpi/ic_folder.9.png
new file mode 100644
index 0000000..431aae8
--- /dev/null
+++ b/res/drawable-mdpi/ic_folder.9.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_folder.png b/res/drawable-mdpi/ic_folder.png
deleted file mode 100644
index ee85b28..0000000
--- a/res/drawable-mdpi/ic_folder.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_downloads.png b/res/drawable-mdpi/ic_menu_downloads.png
new file mode 100644
index 0000000..9851f60
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_downloads.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_pageinfo.png b/res/drawable-mdpi/ic_menu_pageinfo.png
new file mode 100644
index 0000000..adf5c2a
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_pageinfo.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_settings.png b/res/drawable-mdpi/ic_menu_settings.png
new file mode 100644
index 0000000..a98a18b
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_settings.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_share.png b/res/drawable-mdpi/ic_menu_share.png
new file mode 100644
index 0000000..b09e74d
--- /dev/null
+++ b/res/drawable-mdpi/ic_menu_share.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_reload.png b/res/drawable-mdpi/ic_reload.png
new file mode 100644
index 0000000..215ca02
--- /dev/null
+++ b/res/drawable-mdpi/ic_reload.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_star.png b/res/drawable-mdpi/ic_star.png
new file mode 100644
index 0000000..608d8a7
--- /dev/null
+++ b/res/drawable-mdpi/ic_star.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_stop.png b/res/drawable-mdpi/ic_stop.png
new file mode 100644
index 0000000..19b2e15
--- /dev/null
+++ b/res/drawable-mdpi/ic_stop.png
Binary files differ
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 072a0b1..639a75b 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -3184,9 +3184,14 @@
DownloadManager.Request request = new DownloadManager.Request(uri);
request.setMimeType(mimetype);
request.setDestinationInExternalFilesDir(this, null, filename);
+ // let this downloaded file be scanned by MediaScanner - so that it can show up
+ // in Gallery app, for example.
+ request.allowScanningByMediaScanner();
request.setDescription(webAddress.getHost());
String cookies = CookieManager.getInstance().getCookie(url);
request.addRequestHeader("cookie", cookies);
+ request.setNotificationVisibility(
+ DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
if (mimetype == null) {
ContentValues values = new ContentValues();
values.put(FetchUrlMimeType.URI, addressString);
diff --git a/src/com/android/browser/OpenDownloadReceiver.java b/src/com/android/browser/OpenDownloadReceiver.java
index f66c332..02dba51 100644
--- a/src/com/android/browser/OpenDownloadReceiver.java
+++ b/src/com/android/browser/OpenDownloadReceiver.java
@@ -17,17 +17,10 @@
package com.android.browser;
import android.app.DownloadManager;
-import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
-import android.database.Cursor;
import android.net.Uri;
-import android.provider.Downloads;
-import android.widget.Toast;
-
-import java.io.File;
/**
* This {@link BroadcastReceiver} handles clicks to notifications that
@@ -36,49 +29,41 @@
* a complete, successful download will open the file.
*/
public class OpenDownloadReceiver extends BroadcastReceiver {
+ @Override
public void onReceive(Context context, Intent intent) {
- ContentResolver cr = context.getContentResolver();
- Uri data = intent.getData();
- Cursor cursor = null;
- try {
- cursor = cr.query(data,
- new String[] { Downloads.Impl._ID, Downloads.Impl._DATA,
- Downloads.Impl.COLUMN_MIME_TYPE, Downloads.Impl.COLUMN_STATUS },
- null, null, null);
- if (cursor.moveToFirst()) {
- String filename = cursor.getString(1);
- String mimetype = cursor.getString(2);
- String action = intent.getAction();
- if (Downloads.Impl.ACTION_NOTIFICATION_CLICKED.equals(action)) {
- int status = cursor.getInt(3);
- if (Downloads.Impl.isStatusCompleted(status)
- && Downloads.Impl.isStatusSuccess(status)) {
- Intent launchIntent = new Intent(Intent.ACTION_VIEW);
- Uri path = Uri.parse(filename);
- // If there is no scheme, then it must be a file
- if (path.getScheme() == null) {
- path = Uri.fromFile(new File(filename));
- }
- launchIntent.setDataAndType(path, mimetype);
- launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- try {
- context.startActivity(launchIntent);
- } catch (ActivityNotFoundException ex) {
- Toast.makeText(context,
- R.string.download_no_application_title,
- Toast.LENGTH_LONG).show();
- }
- } else {
- // Open the downloads page
- Intent pageView = new Intent(
- DownloadManager.ACTION_VIEW_DOWNLOADS);
- pageView.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(pageView);
- }
- }
- }
- } finally {
- if (cursor != null) cursor.close();
+ String action = intent.getAction();
+ if (!DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action)) {
+ openDownloadsPage(context);
+ return;
}
+ long ids[] = intent.getLongArrayExtra(
+ DownloadManager.EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS);
+ if (ids == null || ids.length == 0) {
+ openDownloadsPage(context);
+ return;
+ }
+ long id = ids[0];
+ DownloadManager manager = (DownloadManager) context.getSystemService(
+ Context.DOWNLOAD_SERVICE);
+ Uri uri = manager.getUriForDownloadedFile(id);
+ if (uri == null) {
+ // Open the downloads page
+ openDownloadsPage(context);
+ } else {
+ Intent launchIntent = new Intent(Intent.ACTION_VIEW);
+ launchIntent.setDataAndType(uri, context.getContentResolver().getType(uri));
+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(launchIntent);
+ }
+ }
+
+ /**
+ * Open the Activity which shows a list of all downloads.
+ * @param context
+ */
+ private void openDownloadsPage(Context context) {
+ Intent pageView = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);
+ pageView.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(pageView);
}
}