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 @SuppressLint("StaticFieldLeak") |
58 private static final PermissionDialogController sInstance = | 60 private static final PermissionDialogController sInstance = |
59 new PermissionDialogController(); | 61 new PermissionDialogController(); |
60 } | 62 } |
61 | 63 |
62 public static PermissionDialogController getInstance() { | 64 public static PermissionDialogController getInstance() { |
63 return Holder.sInstance; | 65 return Holder.sInstance; |
64 } | 66 } |
65 | 67 |
66 private PermissionDialogController() { | 68 private PermissionDialogController() { |
67 mRequestQueue = new LinkedList<>(); | 69 mRequestQueue = new LinkedList<>(); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 251 } |
250 | 252 |
251 return fullString; | 253 return fullString; |
252 } | 254 } |
253 | 255 |
254 private void destroyDelegate() { | 256 private void destroyDelegate() { |
255 mDialogDelegate.destroy(); | 257 mDialogDelegate.destroy(); |
256 mDialogDelegate = null; | 258 mDialogDelegate = null; |
257 } | 259 } |
258 } | 260 } |
OLD | NEW |