Commit 0ced08c2 authored by Elliott Slaughter's avatar Elliott Slaughter
Browse files

Browser save page as web archive.

Change-Id: I01366f575f61fd6e2084ad003b860f5c6083258e
parent d9c3d74f
......@@ -84,6 +84,16 @@
<data android:mimeType="application/xhtml+xml"/>
<data android:mimeType="application/vnd.wap.xhtml+xml"/>
</intent-filter>
<!-- For viewing saved web archives. -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:scheme="file" />
<data android:mimeType="application/x-webarchive-xml"/>
</intent-filter>
<!-- We are also the main entry point of the browser. -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -44,6 +44,8 @@
android:title="@string/menu_preferences"
android:icon="@drawable/ic_menu_settings"
android:alphabeticShortcut="p" />
<item android:id="@+id/save_webarchive_menu_id"
android:title="@string/menu_save_webarchive" />
<!-- followings are debug only -->
<item android:id="@+id/dump_nav_menu_id"
android:title="@string/dump_nav"
......
......@@ -59,6 +59,8 @@
android:title="@string/menu_preferences"
android:icon="@drawable/ic_menu_settings"
android:alphabeticShortcut="p" />
<item android:id="@+id/save_webarchive_menu_id"
android:title="@string/menu_save_webarchive" />
<!-- followings are debug only -->
<item android:id="@+id/dump_nav_menu_id"
android:title="@string/dump_nav"
......
......@@ -217,6 +217,12 @@
<string name="copy_page_url">Copy page url</string>
<!-- Menu item -->
<string name="share_page">Share page</string>
<!-- Menu item for saving a page as a web archive. -->
<string name="menu_save_webarchive">Save as Web Archive</string>
<!-- Toast informing the user that the page has been saved. -->
<string name="webarchive_saved">Web archive saved.</string>
<!-- Toast informing the user that saving the page has failed. -->
<string name="webarchive_failed">Failed to save web archive.</string>
<!-- Context Menu item open the currently selected link in the current
window.-->
<string name="contextmenu_openlink">Open</string>
......
......@@ -1403,6 +1403,23 @@ public class BrowserActivity extends Activity
showFindDialog();
break;
case R.id.save_webarchive_menu_id:
if (LOGD_ENABLED) {
Log.d(LOGTAG, "Save as Web Archive");
}
String directory = getExternalFilesDir(null).getAbsolutePath() + File.separator;
getTopWindow().saveWebArchive(directory, true, new ValueCallback<String>() {
@Override
public void onReceiveValue(String value) {
if (value != null) {
Toast.makeText(BrowserActivity.this, R.string.webarchive_saved, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(BrowserActivity.this, R.string.webarchive_failed, Toast.LENGTH_SHORT).show();
}
}
});
break;
case R.id.page_info_menu_id:
showPageInfo(mTabControl.getCurrentTab(), false);
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment