Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4382)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/bookmark/ManageBookmarkActivity.java

Issue 1452323003: Remove the ability to trigger the edit bookmark dialog via URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/AndroidManifest.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/bookmark/ManageBookmarkActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmark/ManageBookmarkActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmark/ManageBookmarkActivity.java
index 04ac2863f8e8000c481a168862595df767ffda5a..f04aba107ee1c3cb06ed2418bb65c32da884981a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/bookmark/ManageBookmarkActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmark/ManageBookmarkActivity.java
@@ -11,7 +11,6 @@ import android.app.FragmentTransaction;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
-import android.net.Uri;
import android.nfc.NfcAdapter;
import android.os.Bundle;
import android.os.Process;
@@ -23,6 +22,8 @@ import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.chrome.browser.ChromeApplication;
+import org.chromium.chrome.browser.ChromeBrowserProviderClient;
+import org.chromium.chrome.browser.util.IntentUtils;
import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
import org.chromium.ui.UiUtils;
import org.chromium.ui.base.DeviceFormFactor;
@@ -33,9 +34,6 @@ import org.chromium.ui.base.DeviceFormFactor;
*/
public class ManageBookmarkActivity extends FragmentActivity {
- private static final String BOOKMARK_ID_URI_PARAM = "id";
- private static final String BOOKMARK_IS_FOLDER_URI_PARAM = "isfolder";
-
private static final String TAG = "ManageBookmarkActivity";
/* TODO(gb-deprecation): Use android.provider.BrowserContract.Bookmarks.IS_FOLDER */
@@ -197,36 +195,18 @@ public class ManageBookmarkActivity extends FragmentActivity {
throw new IllegalArgumentException("intent can not be null");
}
Intent intent = getIntent();
- Uri intentUri = intent.getData();
-
- Long bookmarkId = null;
- boolean isFolder = false;
- AddEditBookmarkFragment addEditFragment;
- if (intentUri != null && intentUri.getHost().equals("editbookmark")) {
- isFolder = intentUri.getBooleanQueryParameter(BOOKMARK_IS_FOLDER_URI_PARAM, false);
- String bookmarkIdParam = intentUri.getQueryParameter(BOOKMARK_ID_URI_PARAM);
- if (bookmarkIdParam != null) bookmarkId = Long.parseLong(bookmarkIdParam);
- addEditFragment = AddEditBookmarkFragment.newEditInstance(isFolder, bookmarkId);
- } else {
- Bundle extras = intent.getExtras();
- String url = null;
- String name = null;
- if (extras != null) {
- isFolder = extras.getBoolean(BOOKMARK_INTENT_IS_FOLDER, false);
-
- if (extras.containsKey(BOOKMARK_INTENT_TITLE)) {
- name = extras.getString(BOOKMARK_INTENT_TITLE);
- }
- if (extras.containsKey(BOOKMARK_INTENT_URL)) {
- url = extras.getString(BOOKMARK_INTENT_URL);
- url = DomDistillerUrlUtils.getOriginalUrlFromDistillerUrl(url);
- }
- if (extras.containsKey(BOOKMARK_INTENT_ID)) {
- bookmarkId = extras.getLong(BOOKMARK_INTENT_ID);
- }
- }
- addEditFragment = AddEditBookmarkFragment.newInstance(isFolder, bookmarkId, name, url);
- }
+
+ boolean isFolder = IntentUtils.safeGetBooleanExtra(
+ intent, BOOKMARK_INTENT_IS_FOLDER, false);
+ String name = IntentUtils.safeGetStringExtra(intent, BOOKMARK_INTENT_TITLE);
+ String url = IntentUtils.safeGetStringExtra(intent, BOOKMARK_INTENT_URL);
+ if (url != null) url = DomDistillerUrlUtils.getOriginalUrlFromDistillerUrl(url);
+ long bookmarkId = IntentUtils.safeGetLongExtra(
+ intent, BOOKMARK_INTENT_ID, ChromeBrowserProviderClient.INVALID_BOOKMARK_ID);
+
+ AddEditBookmarkFragment addEditFragment = AddEditBookmarkFragment.newInstance(
+ isFolder, bookmarkId, name, url);
+
setActionListenerOnAddEdit(addEditFragment);
return addEditFragment;
}
« no previous file with comments | « chrome/android/java/AndroidManifest.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698