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.chrome.browser.notifications; | 5 package org.chromium.chrome.browser.notifications; |
6 | 6 |
7 import android.app.IntentService; | 7 import android.app.IntentService; |
8 import android.content.BroadcastReceiver; | 8 import android.content.BroadcastReceiver; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.Intent; | 10 import android.content.Intent; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 /** | 46 /** |
47 * Called when a Notification has been interacted with by the user. If we ca
n verify that | 47 * Called when a Notification has been interacted with by the user. If we ca
n verify that |
48 * the Intent has a notification Id, start Chrome (if needed) on the UI thre
ad. | 48 * the Intent has a notification Id, start Chrome (if needed) on the UI thre
ad. |
49 * | 49 * |
50 * @param intent The intent containing the specific information. | 50 * @param intent The intent containing the specific information. |
51 */ | 51 */ |
52 @Override | 52 @Override |
53 public void onHandleIntent(final Intent intent) { | 53 public void onHandleIntent(final Intent intent) { |
54 if (!intent.hasExtra(NotificationConstants.EXTRA_PERSISTENT_NOTIFICATION
_ID) | 54 if (!intent.hasExtra(NotificationConstants.EXTRA_NOTIFICATION_ID) |
55 || !intent.hasExtra(NotificationConstants.EXTRA_NOTIFICATION_INF
O_ORIGIN) | 55 || !intent.hasExtra(NotificationConstants.EXTRA_NOTIFICATION_INF
O_ORIGIN) |
56 || !intent.hasExtra(NotificationConstants.EXTRA_NOTIFICATION_INF
O_TAG)) { | 56 || !intent.hasExtra(NotificationConstants.EXTRA_NOTIFICATION_INF
O_TAG)) { |
57 return; | 57 return; |
58 } | 58 } |
59 | 59 |
60 ThreadUtils.runOnUiThread(new Runnable() { | 60 ThreadUtils.runOnUiThread(new Runnable() { |
61 @Override | 61 @Override |
62 public void run() { | 62 public void run() { |
63 dispatchIntentOnUIThread(intent); | 63 dispatchIntentOnUIThread(intent); |
64 } | 64 } |
(...skipping 19 matching lines...) Expand all Loading... |
84 | 84 |
85 // TODO(peter): Verify that the lifetime of the NotificationService
is sufficient | 85 // TODO(peter): Verify that the lifetime of the NotificationService
is sufficient |
86 // when a notification event could be dispatched successfully. | 86 // when a notification event could be dispatched successfully. |
87 | 87 |
88 } catch (ProcessInitException e) { | 88 } catch (ProcessInitException e) { |
89 Log.e(TAG, "Unable to start the browser process.", e); | 89 Log.e(TAG, "Unable to start the browser process.", e); |
90 System.exit(-1); | 90 System.exit(-1); |
91 } | 91 } |
92 } | 92 } |
93 } | 93 } |
OLD | NEW |