Bug 1088220 - Add Config for Doorhangers. r=margaret
authorChenxia Liu <liuche@mozilla.com>
Mon, 23 Mar 2015 20:27:21 -0700
changeset 266251 c8a569d73bb0744fa7a596ed60a17b1169a20cc3
parent 266250 3249fc039d0888b65a922c3e7a4ccd11810d4077
child 266252 e734718125b0f7aceeae8c1d17acb78887ce3308
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1088220
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1088220 - Add Config for Doorhangers. r=margaret
mobile/android/base/moz.build
mobile/android/base/widget/DoorhangerConfig.java
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -487,16 +487,17 @@ gbjar.sources += [
     'widget/BasicColorPicker.java',
     'widget/ButtonToast.java',
     'widget/CheckableLinearLayout.java',
     'widget/ClickableWhenDisabledEditText.java',
     'widget/DateTimePicker.java',
     'widget/DefaultDoorHanger.java',
     'widget/Divider.java',
     'widget/DoorHanger.java',
+    'widget/DoorhangerConfig.java',
     'widget/EllipsisTextView.java',
     'widget/FadedMultiColorTextView.java',
     'widget/FadedSingleColorTextView.java',
     'widget/FadedTextView.java',
     'widget/FaviconView.java',
     'widget/FloatingHintEditText.java',
     'widget/FlowLayout.java',
     'widget/GeckoActionProvider.java',
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/widget/DoorhangerConfig.java
@@ -0,0 +1,93 @@
+/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
+ * 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/. */
+
+package org.mozilla.gecko.widget;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import org.mozilla.gecko.widget.DoorHanger.Type;
+
+public class DoorhangerConfig {
+
+    public static class Link {
+        public final String label;
+        public final String url;
+        public final String delimiter;
+
+        private Link(String label, String url, String delimiter) {
+            this.label = label;
+            this.url = url;
+            this.delimiter = delimiter;
+        }
+    }
+
+    private final int tabId;
+    private final String id;
+    private DoorHanger.Type type;
+    private String message;
+    private JSONObject options;
+    private Link link;
+    private JSONArray buttons;
+
+    public DoorhangerConfig() {
+        // XXX: This should only be used by SiteIdentityPopup doorhangers which
+        // don't need tab or id references, until bug 1141904 unifies doorhangers.
+        this(-1, null);
+    }
+
+    public DoorhangerConfig(int tabId, String id) {
+        this.tabId = tabId;
+        this.id = id;
+    }
+
+    public int getTabId() {
+        return tabId;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setType(Type type) {
+        this.type = type;
+    }
+
+    public Type getType() {
+        return type;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setOptions(JSONObject options) {
+        this.options = options;
+    }
+
+    public JSONObject getOptions() {
+        return options;
+    }
+
+    public void setButtons(JSONArray buttons) {
+        this.buttons = buttons;
+    }
+
+    public JSONArray getButtons() {
+        return buttons;
+    }
+
+    public void setLink(String label, String url, String delimiter) {
+        this.link = new Link(label, url, delimiter);
+    }
+
+    public Link getLink() {
+        return link;
+    }
+}