OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.physicalweb; | 5 package org.chromium.chrome.browser.physicalweb; |
6 | 6 |
7 import android.app.Notification; | 7 import android.app.Notification; |
8 import android.app.PendingIntent; | 8 import android.app.PendingIntent; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.content.Intent; | 10 import android.content.Intent; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 private PendingIntent createListUrlsIntent() { | 240 private PendingIntent createListUrlsIntent() { |
241 Intent intent = new Intent(mContext, ListUrlsActivity.class); | 241 Intent intent = new Intent(mContext, ListUrlsActivity.class); |
242 intent.putExtra(ListUrlsActivity.REFERER_KEY, ListUrlsActivity.NOTIFICAT
ION_REFERER); | 242 intent.putExtra(ListUrlsActivity.REFERER_KEY, ListUrlsActivity.NOTIFICAT
ION_REFERER); |
243 PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, int
ent, 0); | 243 PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, int
ent, 0); |
244 return pendingIntent; | 244 return pendingIntent; |
245 } | 245 } |
246 | 246 |
247 private PendingIntent createOptInIntent() { | 247 private PendingIntent createOptInIntent() { |
248 // TODO(mattreynolds): navigate to PhysicalWebOptInActivity | 248 Intent intent = new Intent(mContext, PhysicalWebOptInActivity.class); |
249 Intent intent = new Intent(mContext, ListUrlsActivity.class); | |
250 PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, int
ent, 0); | 249 PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, int
ent, 0); |
251 return pendingIntent; | 250 return pendingIntent; |
252 } | 251 } |
253 | 252 |
254 private void resolveUrl(final String url) { | 253 private void resolveUrl(final String url) { |
255 Set<String> urls = new HashSet<String>(Arrays.asList(url)); | 254 Set<String> urls = new HashSet<String>(Arrays.asList(url)); |
256 final long timestamp = SystemClock.elapsedRealtime(); | 255 final long timestamp = SystemClock.elapsedRealtime(); |
257 mPwsClient.resolve(urls, new PwsClient.ResolveScanCallback() { | 256 mPwsClient.resolve(urls, new PwsClient.ResolveScanCallback() { |
258 @Override | 257 @Override |
259 public void onPwsResults(Collection<PwsResult> pwsResults) { | 258 public void onPwsResults(Collection<PwsResult> pwsResults) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 .setAutoCancel(true) | 334 .setAutoCancel(true) |
336 .build(); | 335 .build(); |
337 mNotificationManager.notify(NotificationConstants.NOTIFICATION_ID_PHYSIC
AL_WEB, | 336 mNotificationManager.notify(NotificationConstants.NOTIFICATION_ID_PHYSIC
AL_WEB, |
338 notification); | 337 notification); |
339 } | 338 } |
340 | 339 |
341 private void clearNotification() { | 340 private void clearNotification() { |
342 mNotificationManager.cancel(NotificationConstants.NOTIFICATION_ID_PHYSIC
AL_WEB); | 341 mNotificationManager.cancel(NotificationConstants.NOTIFICATION_ID_PHYSIC
AL_WEB); |
343 } | 342 } |
344 } | 343 } |
OLD | NEW |