OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.permissions; | 5 package org.chromium.chrome.browser.permissions; |
6 | 6 |
| 7 import android.annotation.SuppressLint; |
7 import android.app.Activity; | 8 import android.app.Activity; |
8 import android.content.DialogInterface; | 9 import android.content.DialogInterface; |
9 import android.support.annotation.IntDef; | 10 import android.support.annotation.IntDef; |
10 import android.support.v7.app.AlertDialog; | 11 import android.support.v7.app.AlertDialog; |
11 import android.support.v7.widget.SwitchCompat; | 12 import android.support.v7.widget.SwitchCompat; |
12 import android.text.SpannableStringBuilder; | 13 import android.text.SpannableStringBuilder; |
13 import android.text.Spanned; | 14 import android.text.Spanned; |
14 import android.text.TextUtils; | 15 import android.text.TextUtils; |
15 import android.text.method.LinkMovementMethod; | 16 import android.text.method.LinkMovementMethod; |
16 import android.text.style.ClickableSpan; | 17 import android.text.style.ClickableSpan; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 private AlertDialog mDialog; | 49 private AlertDialog mDialog; |
49 private SwitchCompat mSwitchView; | 50 private SwitchCompat mSwitchView; |
50 private PermissionDialogDelegate mDialogDelegate; | 51 private PermissionDialogDelegate mDialogDelegate; |
51 private List<PermissionDialogDelegate> mRequestQueue; | 52 private List<PermissionDialogDelegate> mRequestQueue; |
52 | 53 |
53 /** Whether a decision has been made for the current dialog. */ | 54 /** Whether a decision has been made for the current dialog. */ |
54 @Decision private int mDecision; | 55 @Decision private int mDecision; |
55 | 56 |
56 // Static holder to ensure safe initialization of the singleton instance. | 57 // Static holder to ensure safe initialization of the singleton instance. |
57 private static class Holder { | 58 private static class Holder { |
| 59 // TODO(crbug.com/635567): Fix this properly. |
| 60 @SuppressLint("StaticFieldLeak") |
58 private static final PermissionDialogController sInstance = | 61 private static final PermissionDialogController sInstance = |
59 new PermissionDialogController(); | 62 new PermissionDialogController(); |
60 } | 63 } |
61 | 64 |
62 public static PermissionDialogController getInstance() { | 65 public static PermissionDialogController getInstance() { |
63 return Holder.sInstance; | 66 return Holder.sInstance; |
64 } | 67 } |
65 | 68 |
66 private PermissionDialogController() { | 69 private PermissionDialogController() { |
67 mRequestQueue = new LinkedList<>(); | 70 mRequestQueue = new LinkedList<>(); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 252 } |
250 | 253 |
251 return fullString; | 254 return fullString; |
252 } | 255 } |
253 | 256 |
254 private void destroyDelegate() { | 257 private void destroyDelegate() { |
255 mDialogDelegate.destroy(); | 258 mDialogDelegate.destroy(); |
256 mDialogDelegate = null; | 259 mDialogDelegate = null; |
257 } | 260 } |
258 } | 261 } |
OLD | NEW |