| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.ui.base; | 5 package org.chromium.ui.base; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.PendingIntent; | 8 import android.app.PendingIntent; |
| 9 import android.content.ActivityNotFoundException; | 9 import android.content.ActivityNotFoundException; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 implements ApplicationStatus.ActivityStateListener, View.OnLayoutChangeL
istener { | 40 implements ApplicationStatus.ActivityStateListener, View.OnLayoutChangeL
istener { |
| 41 // Constants used for intent request code bounding. | 41 // Constants used for intent request code bounding. |
| 42 private static final int REQUEST_CODE_PREFIX = 1000; | 42 private static final int REQUEST_CODE_PREFIX = 1000; |
| 43 private static final int REQUEST_CODE_RANGE_SIZE = 100; | 43 private static final int REQUEST_CODE_RANGE_SIZE = 100; |
| 44 | 44 |
| 45 private static final String PERMISSION_QUERIED_KEY_PREFIX = "HasRequestedAnd
roidPermission::"; | 45 private static final String PERMISSION_QUERIED_KEY_PREFIX = "HasRequestedAnd
roidPermission::"; |
| 46 | 46 |
| 47 private final Handler mHandler; | 47 private final Handler mHandler; |
| 48 private final SparseArray<PermissionCallback> mOutstandingPermissionRequests
; | 48 private final SparseArray<PermissionCallback> mOutstandingPermissionRequests
; |
| 49 | 49 |
| 50 private int mNextRequestCode = 0; | 50 private int mNextRequestCode; |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * Creates an Activity-specific WindowAndroid with associated intent functio
nality. | 53 * Creates an Activity-specific WindowAndroid with associated intent functio
nality. |
| 54 * TODO(jdduke): Remove this overload when all callsites have been updated t
o | 54 * TODO(jdduke): Remove this overload when all callsites have been updated t
o |
| 55 * indicate their activity state listening preference. | 55 * indicate their activity state listening preference. |
| 56 * @param context Context wrapping an activity associated with the WindowAnd
roid. | 56 * @param context Context wrapping an activity associated with the WindowAnd
roid. |
| 57 */ | 57 */ |
| 58 public ActivityWindowAndroid(Context context) { | 58 public ActivityWindowAndroid(Context context) { |
| 59 this(context, true); | 59 this(context, true); |
| 60 } | 60 } |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 Activity activity = getActivity().get(); | 332 Activity activity = getActivity().get(); |
| 333 if (activity == null) return false; | 333 if (activity == null) return false; |
| 334 | 334 |
| 335 int requestCode = generateNextRequestCode(); | 335 int requestCode = generateNextRequestCode(); |
| 336 mOutstandingPermissionRequests.put(requestCode, callback); | 336 mOutstandingPermissionRequests.put(requestCode, callback); |
| 337 activity.requestPermissions(permissions, requestCode); | 337 activity.requestPermissions(permissions, requestCode); |
| 338 return true; | 338 return true; |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 } | 341 } |
| OLD | NEW |