OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.components.gcm_driver; | 5 package org.chromium.components.gcm_driver; |
6 | 6 |
7 import android.app.PendingIntent; | 7 import android.app.PendingIntent; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.os.Bundle; | 10 import android.os.Bundle; |
(...skipping 25 matching lines...) Expand all Loading... |
36 private static final String ERROR_MAIN_THREAD = "MAIN_THREAD"; | 36 private static final String ERROR_MAIN_THREAD = "MAIN_THREAD"; |
37 private static final String ERROR_SERVICE_NOT_AVAILABLE = "SERVICE_NOT_AVAIL
ABLE"; | 37 private static final String ERROR_SERVICE_NOT_AVAILABLE = "SERVICE_NOT_AVAIL
ABLE"; |
38 private static final String EXTRA_DELETE = "delete"; | 38 private static final String EXTRA_DELETE = "delete"; |
39 private static final String EXTRA_REGISTRATION_ID = "registration_id"; | 39 private static final String EXTRA_REGISTRATION_ID = "registration_id"; |
40 private static final String EXTRA_SENDER = "sender"; | 40 private static final String EXTRA_SENDER = "sender"; |
41 private static final String EXTRA_MESSENGER = "google.messenger"; | 41 private static final String EXTRA_MESSENGER = "google.messenger"; |
42 private static final String EXTRA_SUBTYPE = "subtype"; | 42 private static final String EXTRA_SUBTYPE = "subtype"; |
43 private static final String EXTRA_SUBSCRIPTION = "subscription"; | 43 private static final String EXTRA_SUBSCRIPTION = "subscription"; |
44 | 44 |
45 private Context mContext; | 45 private Context mContext; |
46 private PendingIntent mAppPendingIntent = null; | 46 private PendingIntent mAppPendingIntent; |
47 private final Object mAppPendingIntentLock = new Object(); | 47 private final Object mAppPendingIntentLock = new Object(); |
48 | 48 |
49 public GoogleCloudMessagingV2(Context context) { | 49 public GoogleCloudMessagingV2(Context context) { |
50 mContext = context; | 50 mContext = context; |
51 } | 51 } |
52 | 52 |
53 @Override | 53 @Override |
54 public String subscribe(String source, String subtype, @Nullable Bundle data
) | 54 public String subscribe(String source, String subtype, @Nullable Bundle data
) |
55 throws IOException { | 55 throws IOException { |
56 if (data == null) { | 56 if (data == null) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 Intent target = new Intent(); | 188 Intent target = new Intent(); |
189 // Fill in the package, to prevent the intent from being used. | 189 // Fill in the package, to prevent the intent from being used. |
190 target.setPackage("com.google.example.invalidpackage"); | 190 target.setPackage("com.google.example.invalidpackage"); |
191 mAppPendingIntent = PendingIntent.getBroadcast( | 191 mAppPendingIntent = PendingIntent.getBroadcast( |
192 mContext.getApplicationContext(), 0, target, 0); | 192 mContext.getApplicationContext(), 0, target, 0); |
193 } | 193 } |
194 } | 194 } |
195 intent.putExtra(INTENT_PARAM_APP, mAppPendingIntent); | 195 intent.putExtra(INTENT_PARAM_APP, mAppPendingIntent); |
196 } | 196 } |
197 } | 197 } |
OLD | NEW |