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

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

Issue 2772453003: Keep WebBluetooth chooser open when permission prompt is shown on Android (Closed)
Patch Set: keep WebBluetooth chooser open when permission prompt is shown on Android Created 3 years, 9 months 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
Index: chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java
index 3ddfb79821af2d508304674fde109c920c626e65..170bbec197e48bd8e866d7381c0a8de99f98a39b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ItemChooserDialog.java
@@ -366,6 +366,10 @@ public class ItemChooserDialog {
// The maximum height of the listview in the dialog (in dp).
private static final int MAX_HEIGHT_DP = (int) (LIST_ROW_HEIGHT_DP * 8.5);
+ // If this variable is false, the window should be closed when it loses focus;
+ // Otherwise, the window should not be closed when it loses focus.
+ private boolean mIgnorePendingWindowFocusChangeForClose;
+
/**
* Creates the ItemChooserPopup and displays it (and starts waiting for data).
*
@@ -425,9 +429,22 @@ public class ItemChooserDialog {
getListHeight(mActivity.getWindow().getDecorView().getHeight(),
mActivity.getResources().getDisplayMetrics().density)));
+ mIgnorePendingWindowFocusChangeForClose = false;
+
showDialogForView(dialogContainer);
}
+ /**
+ * Sets whether the window should be closed when it loses focus.
+ *
+ * @param ignorePendingWindowFocusChangeForClose Whether the window should be closed when it
+ * loses focus.
+ */
+ public void setIgnorePendingWindowFocusChangeForClose(
+ boolean ignorePendingWindowFocusChangeForClose) {
+ mIgnorePendingWindowFocusChangeForClose = ignorePendingWindowFocusChangeForClose;
+ }
+
// Computes the height of the device list, bound to half-multiples of the
// row height so that it's obvious if there are more elements to scroll to.
@VisibleForTesting
@@ -444,7 +461,8 @@ public class ItemChooserDialog {
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
- if (!hasFocus) super.dismiss();
+ if (!mIgnorePendingWindowFocusChangeForClose && !hasFocus) super.dismiss();
+ setIgnorePendingWindowFocusChangeForClose(false);
}
};
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

Powered by Google App Engine
This is Rietveld 408576698